Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if path[-1] == 'time':
if key.endswith("_utc"):
value = convert_time_to_nexus_string(ttime.gmtime(value))
else:
value = convert_time_to_nexus_string(ttime.localtime(value))
mdata[key] = value
break
stop_document = hdr.stop
if stop_document:
if "time" in stop_document:
t = stop_document["time"]
mdata["scan_time_stop"] = convert_time_to_nexus_string(ttime.localtime(t))
mdata["scan_time_stop_utc"] = convert_time_to_nexus_string(ttime.gmtime(t))
if "exit_status" in stop_document:
mdata["scan_exit_status"] = stop_document["exit_status"]
else:
mdata["scan_exit_status"] = "incomplete"
# Add full beamline name (if available, otherwise don't create the entry).
# Also, don't overwrite the existing name if it was read from the start document
if "scan_instrument_id" in mdata and "scan_instrument_name" not in mdata:
instruments = {
"srx": "Submicron Resolution X-ray Spectroscopy",
"hxn": "Hard X-ray Nanoprobe",
"tes": "Tender Energy X-ray Absorption Spectroscopy",
"xfm": "X-ray Fluorescence Microprobe"
----------
quant_fluor_data_dict: dict
Dictionary with XRF reference sample data. This dictionary is modified by the function.
The dictionary must satisfy the '_xrf_quant_fluor_schema' schema.
Returns
-------
No value is returned. Instead ``quant_fluor_data_dict`` is modified.
"""
# TODO: Documentation and tests
# Set creation time (current local time in NEXUS format)
quant_fluor_data_dict["creation_time_local"] = convert_time_to_nexus_string(ttime.localtime())
ref = ref[p]
else:
ref = None
break
# At this point 'ref' must be a dictionary
value = None
if ref is not None and isinstance(ref, dict):
if path[-1] in ref:
value = ref[path[-1]]
# Now we finally arrived to the end of the path: the 'value' must be a scalar or a list
if value is not None and not isinstance(value, dict):
if path[-1] == 'time':
if key.endswith("_utc"):
value = convert_time_to_nexus_string(ttime.gmtime(value))
else:
value = convert_time_to_nexus_string(ttime.localtime(value))
mdata[key] = value
break
stop_document = hdr.stop
if stop_document:
if "time" in stop_document:
t = stop_document["time"]
mdata["scan_time_stop"] = convert_time_to_nexus_string(ttime.localtime(t))
mdata["scan_time_stop_utc"] = convert_time_to_nexus_string(ttime.gmtime(t))
if "exit_status" in stop_document:
mdata["scan_exit_status"] = stop_document["exit_status"]
else:
if value is not None and not isinstance(value, dict):
if path[-1] == 'time':
if key.endswith("_utc"):
value = convert_time_to_nexus_string(ttime.gmtime(value))
else:
value = convert_time_to_nexus_string(ttime.localtime(value))
mdata[key] = value
break
stop_document = hdr.stop
if stop_document:
if "time" in stop_document:
t = stop_document["time"]
mdata["scan_time_stop"] = convert_time_to_nexus_string(ttime.localtime(t))
mdata["scan_time_stop_utc"] = convert_time_to_nexus_string(ttime.gmtime(t))
if "exit_status" in stop_document:
mdata["scan_exit_status"] = stop_document["exit_status"]
else:
mdata["scan_exit_status"] = "incomplete"
# Add full beamline name (if available, otherwise don't create the entry).
# Also, don't overwrite the existing name if it was read from the start document
if "scan_instrument_id" in mdata and "scan_instrument_name" not in mdata:
instruments = {
"srx": "Submicron Resolution X-ray Spectroscopy",
"hxn": "Hard X-ray Nanoprobe",
"tes": "Tender Energy X-ray Absorption Spectroscopy",
break
if p in ref:
ref = ref[p]
else:
ref = None
break
# At this point 'ref' must be a dictionary
value = None
if ref is not None and isinstance(ref, dict):
if path[-1] in ref:
value = ref[path[-1]]
# Now we finally arrived to the end of the path: the 'value' must be a scalar or a list
if value is not None and not isinstance(value, dict):
if path[-1] == 'time':
if key.endswith("_utc"):
value = convert_time_to_nexus_string(ttime.gmtime(value))
else:
value = convert_time_to_nexus_string(ttime.localtime(value))
mdata[key] = value
break
stop_document = hdr.stop
if stop_document:
if "time" in stop_document:
t = stop_document["time"]
mdata["scan_time_stop"] = convert_time_to_nexus_string(ttime.localtime(t))
mdata["scan_time_stop_utc"] = convert_time_to_nexus_string(ttime.gmtime(t))
if "exit_status" in stop_document:
mdata["scan_exit_status"] = stop_document["exit_status"]