adds get_instruments method to Layer class
get_instruments returns a dictionary with the names of every system used during the deposition unfortunately, NeXus standard allows for a single value of all three keys per every sample - not every layer this means that every layer has its own data for laser, rheed system and depo chamber which IDEALLY is the same for every layer, but in practice they COULD be different and I still don't know how to deal with this
This commit is contained in:
@@ -16,8 +16,9 @@ class Layer:
|
||||
self.extra = layer_data["metadata_decoded"]["extra_fields"]
|
||||
self.layer_number = self.extra["Layer Progressive Number"]["value"] # integer
|
||||
self.target_elabid = self.extra["Target"]["value"] # elabid
|
||||
self.rheed_system_elabid = self.extra["RHEED System"]["value"] # elabid
|
||||
self.laser_system_elabid = self.extra["Laser System"]["value"] # elabid
|
||||
self.chamber_elabid = self.extra["Chamber"]["value"] # elabid
|
||||
self.rheed_system_elabid = self.extra["RHEED System"]["value"] # elabid
|
||||
self.start_time = layer_data.get("created_at")
|
||||
self.operator = layer_data.get("fullname")
|
||||
self.description = layer_data.get("body")
|
||||
@@ -71,6 +72,16 @@ class Layer:
|
||||
# Some keys are not required and can be called through the .get() method - which is permissive and allows null values;
|
||||
# Other keys are required so if they can't be called (invalid or null) raise error and stop execution of the program:
|
||||
raise KeyError(f"The provided dictionary lacks a \"{k}\" key. Check the deposition layer entry on eLabFTW and make sure you used the correct Experiment template.")
|
||||
def get_instruments(self, apikey):
|
||||
raw_lasersys_data = APIHandler(apikey).get_entry_from_elabid(self.laser_system_elabid, entryType="items")
|
||||
raw_chamber_data = APIHandler(apikey).get_entry_from_elabid(self.chamber_elabid, entryType="items")
|
||||
raw_rheedsys_data = APIHandler(apikey).get_entry_from_elabid(self.rheed_system_elabid, entryType="items")
|
||||
instruments_used = {
|
||||
"laser_system": raw_lasersys_data.get("title") or None,
|
||||
"deposition_chamber": raw_chamber_data.get("title") or None,
|
||||
"rheed_system": raw_rheedsys_data.get("title") or None,
|
||||
}
|
||||
return instruments_used
|
||||
|
||||
class Entrypoint:
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user