What is a measurement? Well, it is a run of an actual experiment, usually connected with a display, and characterised by a series of settings and parameters. Usually, you would have some graphical user interface where you can set values for all the necessary parameters, start the measurement and watch the progress all in one window.
Recipe-driven measurements follow a different approach: You have a recipe where you define all the ingredients (i.e., parameters and settings) as well as the tools necessary to “cook” the recipe (i.e,, experiment and display). Think of a very user-friendly way of defining such recipes. All you need to do is copy a file, adjust a few settings, and afterwards execute (“cook”) this recipe. Curious, how this would look like? Here you go.
The dummy experiment recipe-driven¶
A recipe (saved to the file
measurement.yaml) for a very basic measurement, using the
eprcontrol.experiments.DummyExperiment class and the most generic display, may look like this:
experiment: name: DummyExperiment parameters: settings: display: name: Display
Note that this is really the most basic setting we can come up with. We’re only defining an experiment, no additional parameters or (hardware) settings, and a display.
Now, for the “cooking” part. That’s a simple two-liner in MATLAB®:
measurement = eprcontrol.measurements.Measurement('measurement.yaml'); measurement.perform();
What did we do here? We’ve created an instance of the class
eprcontrol.measurements.Measurement, and as we provided our recipe file when creating the class, it did prepare already everything necessary to perform the measurement. In the second step, we’ve simply performed the measurement, i.e., run the experiment.
Not used to object-oriented programming? Never mind, it can be even simpler:
What’s the advantages?¶
Well, first of all, human-readable and writable text files as user interface are easy to implement, yet very powerful.
Besides that, it allows for a general separation between control software and formulation and documentation of an actual measurement (i.e., a particular experiment in time and space using a particular setup and a particular sample).
Eventually, this leads to a basic reproducibility and documentation of the measurements performed if you store your measurement recipes together with the data they created, ideally sharing the same file basename.
Sounds somewhat familiar? Well, indeed. If you’ve come along the ASpecD framework, you may have heard about “recipe-driven data analysis”, a very powerful approach for a simple user interface to data analysis that is at the same time fully automatable and allows for full reproducibility.