Package fieldpy :: Package stream_gauging :: Module calibration :: Class SingleCalibration
[hide private]
[frames] | no frames]

Class SingleCalibration

source code


This class holds all the methods to read and process the salt calibation of the electical conductivity (EC) sensor.

Instance Methods [hide private]
 
__init__(self, filename=None, plot_yes=True)
Initialises the class.
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
numpy array or float
readout2conductance(self, readout)
Calcualtes the conductance across the sensor electrodes for a given sensor readout.
source code
numpy array or float
readout2concentration(self, readout, background_readout=None)
Function which calculates the concentration for a given sensor readout using the least square line fitted to the conductance-concentration relation.
source code
 
conductance2concentration(self, conductance, background=None) source code
dict: {function, float, float, float, float}
make_calibration(self)
Makes the calibaration, afterwards the the method readout2concentration is available to be used.
source code
list of matplotlib axes object
plot_it(self, axs=None)
Plot the calibration curve.
source code

Inherited from core.experiment_classes.LoggedData: check

Inherited from core.extra_classes.TimeSeries: check_constant_sampling_interval, check_monotonically_inc_time, cut_time_series, filter_and_resample, get_ind, get_ind_as_slice, get_index_after, get_index_before, get_index_nearest, integrate, plot_date, plot_ts, time_filter_gauss

Inherited from core.extra_classes.Data: filter_by_freq, filter_low_pass, mask_if_true, mask_jumps, mask_jumps_one_dir, mask_value, pickle

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Instance Variables [hide private]

Inherited from core.extra_classes.Data: data, md

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename=None, plot_yes=True)
(Constructor)

source code 

Initialises the class. If filename is set to None, the class needs to be initialised by hand.

Parameters:
  • filename (string) - The file name of the calibration file in .maw file format
  • plot_yes (boolean) - Plot the linear regression if True (default)
    >>> from fieldpy.stream_gauging.calibration import *
    >>> sc = SingleCalibration('../stream_gauging/test_data/calibration_13JUL10.maw', plot_yes=False)
    Linear regression of conductance vs concentration
    a=345.72 b=-0.08, root mean squared error= 0.000, R^2 = 0.997
    >>> sc
    Conductivity sensor calibration at 2010-07-13 10:30
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

readout2conductance(self, readout)

source code 

Calcualtes the conductance across the sensor electrodes for a given sensor readout.

Parameters:
  • readout (float or numpy array of floats) - the sensor readout
Returns: numpy array or float
conductance

readout2concentration(self, readout, background_readout=None)

source code 

Function which calculates the concentration for a given sensor readout using the least square line fitted to the conductance-concentration relation. If a background_readout is given then this is take into consideration.

Parameters:
  • readout (float or numpy array of floats) - the sensor readout
  • background_readout (float) - the sensor readout at zero salt concentration (default=1)
Returns: numpy array or float
concentration

make_calibration(self)

source code 

Makes the calibaration, afterwards the the method readout2concentration is available to be used.

Returns: dict: {function, float, float, float, float}
A dictionary containing:
  • 'a': a in ax+b
  • 'b': b in ax+b
  • 'R_squared': R^2
  • 'rmse': root mean squared error'

plot_it(self, axs=None)

source code 

Plot the calibration curve.

Parameters:
  • axs (list of matplotlib axes object) - two matplotlib axes in which to plot (default None: make a new ones).
Returns: list of matplotlib axes object
list of the used matplotlib axes