Skip to content

Commit

Permalink
clean up nomad stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
arvedes committed Nov 16, 2022
1 parent 017f3c2 commit e721842
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 52 deletions.
14 changes: 8 additions & 6 deletions multilog/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,22 @@ def write_nomad_file(self):
.strip()
.decode("utf-8")
)
data["process"]["start_time"] = datetime.datetime.now(datetime.timezone.utc).astimezone().isoformat(timespec='milliseconds').replace('T', ' ')
data["data_processing"].update(
{
"software": f"multilog {multilog_version}",
"sampling_time": self.config["settings"]["dt-main"],
"image_time": self.config["settings"]["dt-camera"],
}
)

inst_ir_cam = nomad_dict.pop("instrumentation_IR-camera_template")
inst_camera = nomad_dict.pop("instrumentation_camera_template")
inst_sensors = nomad_dict.pop("instrumentation_sensors_template")
template_ir_cam = nomad_dict.pop("instrumentation_IR-camera_template")
template_camera = nomad_dict.pop("instrumentation_camera_template")
template_sensor = nomad_dict.pop("instrumentation_sensors_template")
for device_name in self.devices:
nomad_name = device_name.replace(" ", "_").replace("-", "_")
if "Optris-IP-640" in device_name:
instrument = deepcopy(inst_ir_cam)
instrument = deepcopy(template_ir_cam)
instrument["section"]["quantities"]["ir_camera"]["type"] = f"../upload/raw/{device_name}.archive.yaml#IR_camera"
nomad_dict["definitions"]["sections"]["MeltCzochralski"]["sub_sections"]["instrumentation"]["section"]["sub_sections"].update(
{nomad_name: instrument}
Expand All @@ -336,7 +338,7 @@ def write_nomad_file(self):
"ir_camera": f"../upload/raw/{device_name}.archive.yaml#data"
}
elif "Basler" in device_name:
instrument = deepcopy(inst_camera)
instrument = deepcopy(template_camera)
instrument["section"]["quantities"]["camera"]["type"] = f"../upload/raw/{device_name}.archive.yaml#camera"
nomad_dict["definitions"]["sections"]["MeltCzochralski"]["sub_sections"]["instrumentation"]["section"]["sub_sections"].update(
{nomad_name: instrument}
Expand All @@ -345,7 +347,7 @@ def write_nomad_file(self):
"camera": f"../upload/raw/{device_name}.archive.yaml#data"
}
else:
instrument = deepcopy(inst_sensors)
instrument = deepcopy(template_sensor)
instrument["section"]["quantities"]["sensors_list"]["type"] = f"../upload/raw/{device_name}.archive.yaml#Sensors_list"
nomad_dict["definitions"]["sections"]["MeltCzochralski"]["sub_sections"]["instrumentation"]["section"]["sub_sections"].update(
{nomad_name: instrument}
Expand Down
93 changes: 47 additions & 46 deletions multilog/nomad/archive_template_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,8 @@ definitions:
m_annotations:
eln:
component: StringEditQuantity
# fan:
# type: str
# m_annotations:
# eln:
# component: StringEditQuantity
# pump:
# type: str
# m_annotations:
# eln:
# component: StringEditQuantity
# sensors:
# type: str
# m_annotations:
# eln:
# component: StringEditQuantity
data_processing:
section:
quantities:
software:
type: str
m_annotations:
eln:
component: StringEditQuantity
description: "Software used for logging"
sampling_time:
type: np.float64
unit: ms
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit: ms
description: "Time between sampled points"
instrumentation:
# keep listing other useful parameters here
configuration:
section:
m_annotations:
eln:
Expand Down Expand Up @@ -110,6 +79,37 @@ definitions:
m_annotations:
eln:
component: StringEditQuantity
data_processing:
section:
quantities:
software:
type: str
m_annotations:
eln:
component: StringEditQuantity
description: "Software used for logging"
sampling_time:
type: np.float64
unit: ms
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit: ms
description: "Time between sampled points"
image_time:
type: np.float64
unit: ms
m_annotations:
eln:
component: NumberEditQuantity
defaultDisplayUnit: ms
description: "Time between recorded images"
instrumentation:
section:
m_annotations:
eln:
lane_width: 200px
sub_sections: {}
# templates form below will be inserted here

instrumentation_IR-camera_template:
Expand Down Expand Up @@ -154,13 +154,22 @@ instrumentation_sensors_template:

data:
m_def: MeltCzochralski
data_processing: #section name - not to be filled
process:
# activity_identifier: my_id
# activity_method: Melt Czochralski
start_time: "2021-03-04 10:15:00+01" # will be set automatically
# activity_category: crystal growth synthesis
# end_time: 2021-03-04 10:15:00+01
# location: Berlin
data_processing:
software: multilog vXXX # will be set automatically
sampling_time: -1 # will be set automatically
instrumentation: #section name - not to be filled
furnace: #section name - not to be filled
furnace_type: Test-Cz
# heating: #section name - not to be filled
image_time: -1 # will be set automatically
instrumentation:
{}
# furnace:
# furnace_type: Test-Cz
# heating:
# heater_type:
# heater_id: vXXX

Expand All @@ -172,11 +181,3 @@ data:
# sensors_locations: sensor_geometry.png # TODO fill name here
# sensors_list: ../upload/raw/Sensors.archive.yaml#data # TODO fill name here

# TODO complete this
# process: #section name - not to be filled
# activity_identifier: my_id
# activity_category: crystal growth synthesis
# activity_method: Melt Czochralski
# location: Berlin
# start_time: 2021-03-04 10:15:00+01
# end_time: 2021-03-04 10:15:00+01

0 comments on commit e721842

Please sign in to comment.