Document customisation of histogram reducer use case
Add a section to doc_src/maus_user_guide.tex with explanation of how src/reduce/ReduceHistogramTDCADCCounts/ReduceHistogramTDCADCCounts.py can be customised to plot other data and how this relates to the base class. Base round example of:
- Make new src/reduce/ReduceCustomHistogram/ directory
- cp src/reduce/ReduceHistogramTDCADCCounts/ReduceCustomHistogramMyData.py
- Describe some example changes to make.
- Rebuild MAUS and use.
Updated by Jackson, Mike about 12 years ago
Notes to turn into TEX:
MAUS ships with an example merger which takes in a spill, extracts their TDC and ADC counts and updates a histogram graphing these counts. The updated histogram is then output as image data within a JSON document.
The class uses matplotlib which is installed when you build MAUS. matplotlib is a 2D plotting library and its web site at http://matplotlib.sourceforge.net/ contains an introduction, tutorials and other useful documentation about its capabilities.
You can customise this class to create your own histograms. The class is in:
This extends a base class in:
The base class takes care of handling default configuration of the merger. This
- Recording the type of image data (e.g. EPS, PNG, JPG) to be output by the
- Checking that matplotlib supports this image type.
- Recording whether each image is to be auto-numbered.
If you wish to change the nature of the histograms output then you can:
- Edit src/reduce/ReducePyHistogramTDCADCCounts/ReducePyHistogramTDCADCCounts.py
- The histogram is in a self._histogram attribute. This is a matplotlib FigureCanvas object.
- If you want to see how this is created, look at the _create_histogram method in ReducePyMatplotlibHistogram.py.
- _configure_at_birth initialises the worker and the histogram. When this is called you can assume that self._histogram has been initialised. You can, as shown in the class, set the axes labels or change other aspects of the histogram.
- _update_histogram is responsible for updating self._histogram when a new spill is received.
- It extracts the data from the spill and plots it and also updates the histogram title.
- This is done using standard matplotlib API calls e.g. scatter, get_axes, set_title etc.
- Any errors that arise e.g. if the data to be plotted is missing, can be reported as shown where there is no "digits" field.
Updated by Jackson, Mike almost 12 years ago
- Workflow set to New Issue
OutputPyImage reads the JSON and looks for the image tag. It will then derive a directory and file name. It uses defaults unless flags and values are specified in the data cards which will override these.
OutputPyImage expects a JSON document with the image data in a format that can be directly saved into a file (it doesn't do anything beyond save the data into the file name it creates)