Revert "Capture more metadata"

This reverts commit 910737202f93a744d4208664c8166bf2e2d2d73f.
This commit is contained in:
CPD 2025-03-12 16:44:48 +01:00
parent 55b4c20865
commit 8f39459234

View File

@ -25,8 +25,7 @@ def measure(
stop_on_script_end: bool=False,
verbose: bool=False,
command_queue: None|Queue=None,
data_queue: None|Queue=None,
add_measurement_info_to_metadata=True
data_queue: None|Queue=None
):
"""
Perform a measurement
@ -63,24 +62,22 @@ def measure(
The default is None.
data_queue : None|Queue, optional
A queue to put data in. The default is None.
add_measurement_info_to_metadata : bool, optional
If True, add measurement info to the metadata:
time, measurement_interval, measurement_use_buffer, measurement_voltage_device, measurement_led_device
The default is True.
Returns
-------
None.
"""
get_time = lambda: datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
if add_measurement_info_to_metadata:
data.metadata["measurement_interval"] = str(delta_t)
data.metadata["measurement_use_buffer"] = str(use_buffer)
data.metadata["measurement_voltage_device"] = str(vm_dev)
data.metadata["measurement_led_device"] = str(led_dev)
data.metadata["measurement_time_start"] = get_time()
# write metadata to disk
data.write_metadata()
# old hack when using multiprocessing instead of mulithreading:
# devices are not pickleable and thus cant be moved to / shared with the measurement process
# if led_dev is None:
# led_dev = LEDD1B()
# if vm_dev is None:
# vm_dev = init("GPIB0::22::INSTR")
# if no "time" in metadata, set the current local time in ISO 8601 format
# and without microseconds
if not "time" in data.metadata:
data.metadata["time"] = datetime.datetime.now().replace(microsecond=0).astimezone().isoformat()
vm_dev.reset(True)
if use_buffer:
vm_dev.buffer_measure(delta_t, verbose=True)
@ -151,10 +148,6 @@ def measure(
except KeyboardInterrupt:
pass
if add_measurement_info_to_metadata:
data.metadata["measurement_time_stop"] = get_time()
# Write again after having updated the stop time
data.write_metadata()
data.flush(verbose=verbose)
led_dev.off()