Feature #747

Document customisation of histogram reducer use case

Added by Jackson, Mike over 12 years ago. Updated about 12 years ago.

Jackson, Mike
Target version:
Start date:
17 October 2011
Due date:
% Done:


Estimated time:
New Issue


Add a section to doc_src/maus_user_guide.tex with explanation of how src/reduce/ReduceHistogramTDCADCCounts/ 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/
  • Describe some example changes to make.
  • Rebuild MAUS and use.

Updated by Jackson, Mike over 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 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/
  • 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
  • _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 over 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)


Updated by Jackson, Mike over 12 years ago

Added wiki page - Reducers and histograms.


Updated by Rogers, Chris about 12 years ago

  • Category set to Documentation
  • Status changed from Open to Closed
  • Target version set to Future MAUS release
  • % Done changed from 0 to 100

I think this is done?


Updated by Rogers, Chris about 12 years ago

  • Target version changed from Future MAUS release to MAUS-v0.2.2

Updated by Jackson, Mike about 12 years ago

Yes, the wiki and existing source code should be fine.

Also available in: Atom PDF