Project

General

Profile

Feature #747

Document customisation of histogram reducer use case

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

Status:
Closed
Priority:
Normal
Assignee:
Jackson, Mike
Category:
Documentation
Target version:
Start date:
17 October 2011
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

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.
#1

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:

src/reduce/ReducePyHistogramTDCADCCounts/ReducePyHistogramTDCADCCounts.py

This extends a base class in:
src/reduce/ReducePyMatplotlibHistogram/ReducePyMatplotlibHistogram.py

The base class takes care of handling default configuration of the merger. This
includes:

  • Recording the type of image data (e.g. EPS, PNG, JPG) to be output by the
    merger.
  • 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.
#2

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)

#3

Updated by Jackson, Mike almost 12 years ago

Added wiki page - Reducers and histograms.

#4

Updated by Rogers, Chris over 11 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?

#5

Updated by Rogers, Chris over 11 years ago

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

Updated by Jackson, Mike over 11 years ago

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

Also available in: Atom PDF