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