sandialabs / pyscan

Scientific Measurement Toolbox
https://pyscan.readthedocs.io/en/latest/
MIT License
4 stars 4 forks source link

Add json converter #193

Closed rsbrost closed 6 days ago

i-am-mounce commented 3 weeks ago

On the encoder: we need to understand why the default JSON converter behavior is not being applied rather than rewriting it.

On the decoder: why is the hook recursive? Is it not, by default already called recursively?

rsbrost commented 3 weeks ago

Is saving measure function with metadata. The whole measure function definition is written as a string value for the corresponding measure_function key. In demo nb1 that looks like this: "measure_function": "def get_voltage_data(expt):\n \"\"\"\n Reads the voltage from v1, v2, and v3 devices. Also adds a calculated value vsum.\n \"\"\"\n\n runinfo = expt.runinfo\n devices = expt.devices\n\n d = ps.ItemAttribute()\n\n d.v1_readout = devices.v1.voltage\n d.v2_readout = devices.v2.voltage\n d.v3_readout = devices.v3.voltage\n\n d.vsum = d.v1_readout + d.v2_readout + d.v3_readout\n \n return d\n"

rsbrost commented 3 weeks ago

This should be ready to go, but please note it includes a save change to now include measure functions substance as metadata (see note above for more info).

rsbrost commented 1 week ago

These requested changes have been addressed.