LabExT / LabExT

LabExT, short for Laboratory Experiment Tool, is a free software environment developed to facilitate performing laboratory experiments.
GNU General Public License v3.0
22 stars 15 forks source link

Measurement settings indistinguishable from meta data in sweep association file #205

Open boris-vukovic opened 3 months ago

boris-vukovic commented 3 months ago

With the new measurement settings sweep feature, sweep association data is saved i) in each measurement file and ii) in a sweep summary file. Within there, a sweep_association_list gives a dictionary overview over all measurements, however inside this dictionary it is unclear if a key is a measurement setting or associated metadata. See this example:

XYZ_sweep_summary.json

{
    "software": {
        "name": "LabExT",
        "version": "2.3.0",
        "git rev": "599b10f5",
        "computer": "<redacted>"
    },
    "sweep_association_list": {
        "OBR4600Trace (shortened id = c22e2)": {
                "gain": 0,  # is measurement setting
                "averaging": 1,  # is measurement setting
            "id": "726945f0abe540fa95a4639193fc22e2",  # is metadata!
            "file_path": "<redacted>"  # is metadata!
        },
        "OBR4600Trace (shortened id = e1015)": {
            "gain": 0,
            "averaging": 5,
            "id": "61012d14532b441aa38b26b8320e1015",
            "file_path": "<redacted>"
        },
        "OBR4600Trace (shortened id = b2429)": {
            "gain": 0,
            "averaging": 9,
            "id": "5bb14920dcf641beba99043bfbdb2429",
            "file_path": "<redacted>"
        },
        "some more stuff here": {
            "more stuff": 1337,
        }
    }
}

I suggest to move the measurement settings (in the example gain and averaging to their own dictionary, e.g.:

"sweep_association_list": {
  "OBR4600Trace (shortened id = c22e2)": {
          "measurement settings": {
            "gain": 0,  # is measurement setting
            "averaging": 1  # is measurement setting
          },
      "id": "726945f0abe540fa95a4639193fc22e2",  # is metadata!
      "file_path": "<redacted>"  # is metadata!
  }

such that the distinction between swept measurement setting and meta data is clear.

marcoep commented 3 months ago

@DJAntivenom - you will probably want to use a MultiIndex in your pandas dataframe which tracks the different measurements in a sweep. With one category metadata containing id, name, filepath etc. and another category measurement settings containing the swept paramters.

See here for examples: https://stackoverflow.com/questions/21443963/pandas-multilevel-column-names