Menu

Q Histogram Functions

Ramneek

This document explains the functions in eSBMTools that were used in this example.


→ 2 modules from eSBMTools were imported into PlotQhistogram.py:

            -Qvalue.py
            -MathTools.py

Additionally, we also import matplotlib.pylab and matplotlib.collections.

→ The function

            numpy.loadtxt('fileName')

is used to load the data from a file in the current directory containing
the qvalues of a simulation.

This is a function of numpy.

→ Next we describe the Gaussian curve to be drawn and fit it to a set of data
values, in this case the Q values obtained from the previous function.

→ After this, we define the various parameters of the graph using functions of
matplotlib, the first section under '#Q values over time' for the first graph
using functions such as

    adding a subplot (add_subplot)
    setting the X-axis & Y-axis limits (set_xlim, set_ylim)
    set the X-axis ticks and their labels (set_xticks, set_xtickslabels)
    label the axes (set_xlabel, set_ylabel)

The histogram is set up in 'folded', a BrokenBarHCollection from collections
and then added to the subplot with ax1.add_collection(folded).

The second histogram is set up under '#Q value histogram'

Finally the graph is drawn with the command plt.show().


Cheers!


MongoDB Logo MongoDB