cbasspy.constantsPlotting package

Submodules

cbasspy.constantsPlotting.example_run module

cbasspy.constantsPlotting.fromFileNames module

class constFile(fileName, columns, labels, inDir='./', isNoisediodeFile=False)

Bases: object

Data file object with built in plotting methods.

Parameters:

fileName : str

File name of constants file

columns : array_like

Array of strings, identifying each column, e.g. Tnd

labels : array_like

Array of strings, labelling each column, e.g. $T_{ND}$

inDir : str, ‘./’

Directory containing the file

isNoisediodeFile : bool, False

The noisediode files have a strange format. If this is set to True then some hardwired code is used to interpret them. If the format of these files is changed then this parameter won’t work. – LJ 21st August 2018 –

Attributes

fileName (str) File name of constants file
columns (array_like) Array of strings, identifying each column, e.g. Tnd
labels (array_like) Array of strings, labelling each column, e.g. $T_{ND}$
inDir (str, ‘./’) Directory containing the file
numOfColumns (int) Number of columns of data (number of fields/categories)
numOfRows (int) Number of rows of data (number of entries)
extraFlags (array of ints, [1,…,1]) 1 where to accept data, 0 where to flag. Extra flags that the user can add. Should be of length numOfRows
data (dict) Dictionary containing the data
data_labels (dict) Dictionary containing the labels for the columns

Methods

formatMjdTimes(column)

Convert MJD dates under ``column’’ into matplotlib date numbers. Do this before plotting for nicer looking plots.

Can then call xaxisFormatDates to format into actual dates.

overwriteFlags(newExtraFlags)

Overwrite the extraFlags with newExtraFlags

plotSimpleScatter(ax, columnX, columnY, fmt='.k', columnXerr=None, columnYerr=None, label='', labelX=None, labelY=None, factorX=1.0, factorY=1.0, **kwargs)

Simple script to quickly make scatter plots

Parameters:

ax : object

Matplotlib axis handle

columnX : str

Which column to plot on x-axis

columnY : str

Which column to plot on x-axis

fmt : str

Format of data points

columnXerr : str, None

Which column to plot as x-error-bar

columnYerr : str, None

Which column to plot as y-error-bar

label : str, ‘ ‘

Legend label for these points

labelX : str, None

If None, does nothing. Otherwise, overwrites the automatic x-axis label with this string.

labelY : str, None

If None, does nothing. Otherwise, overwrites the automatic y-axis label with this string.

factorX : float, 1.0

Factor by which to multiply the x data.

factorY : float, 1.0

Factor by which to multiply the x data.

**kwargs : kwargs

Pass to matplotlib.pyplot.errorbar

resetFlags()

Reset the extra flags.

overplotStraightLine(ax, slope, intercept, color, ls='-', lw=1.5)

Over plot a straight line parametrized by slope and intercept.

Parameters:

ax : object

slope : float

intercept : float

color : str

ls : str, ‘-‘

lw : float, 1.5

xaxisFormatDates(ax, xory='x', majorYears=False, minorMonths=True, majorFmt='%Y-%m-%d')

Function that formats either the x or y axis in a matplotlib axis to show dates (rather than date numbers).

Parameters:

ax : object

matplotlib axis handle

xory : str, {‘x’,’y’}

whether to format the x or y axis

majorYears : bool, False

Put a major tick mark on each year

minorMonths : bool, True

Put a minor tick mark on each month

majorFmt : str, ‘%Y-%m-%d’

The format of the major ticks