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

Class AllCalibrations

source code


This class can hold several calibrations and provides the following functions to convert sensor readout to concentration:

Instance Methods [hide private]
 
__init__(self, list_of_filenames, plot_yes=False)
Initialises the class with
source code
 
__repr__(self)
repr(x)
source code
 
check(self)
Does integrity checks:
source code
 
plot_all(self)
Plots all calibrations.
source code
numpy array or float
conductance2concentration_average(self, times, conductance, background_cond, verbose_=False)
Converts the conductance into a concentration using an average of the calibartions.
source code
numpy array or float
readout2concentration_average(self, times, readouts, background_readout, verbose_=False)
Converts the readout into a concentration using an average of the calibartions.
source code
numpy array or float
readout2concentration_closest(self, times, readouts, background_readout, verbose_=False)
Converts the readout into a concentration using the calibration closest in time to the readouts (note only the time of first readout is checked).
source code
numpy array or float
conductance2concentration_closest(self, times, readouts, background_readout, verbose_=False)
Converts the readout into a concentration using the calibration closest in time to the readouts (note only the time of first readout is checked).
source code
numpy array or float
readout2concentration_weighted(self, times, readouts, background_readout)
Converts the readout into a concentration using the weighted calibration of the two calibrations closest in time to the readout.
source code

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__, __str__, __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, list_of_filenames, plot_yes=False)
(Constructor)

source code 

Initialises the class with

Parameters:
  • list_of_filenames (list of strings) - The file names of the calibration files in .maw file format
  • plot_yes (boolean) - Plot the linear regression if True (default = False)
    >>> from fieldpy.stream_gauging.calibration import *
    >>> dir_ = '../stream_gauging/test_data/'
    >>> fielns = ['calibration_13JUL10.maw', 'calibration_18JUL10_1.maw', 'calibration_18JUL10_2.maw']
    >>> ac = AllCalibrations([dir_ + fl for fl in fielns])
    Linear regression of conductance vs concentration
    a=345.72 b=-0.08, root mean squared error= 0.000, R^2 = 0.997
    Linear regression of conductance vs concentration
    a=363.19 b=-0.10, root mean squared error= 0.001, R^2 = 0.996
    Linear regression of conductance vs concentration
    a=254.78 b=-0.03, root mean squared error= 0.000, R^2 = 0.999
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

check(self)

source code 

Does integrity checks:

  • check that all SingleCalibration.md.reference_resistor are the same
Overrides: core.extra_classes.Data.check

conductance2concentration_average(self, times, conductance, background_cond, verbose_=False)

source code 

Converts the conductance into a concentration using an average of the calibartions.

Parameters:
  • times (numpy array matplotlib time stamps) - times of sensor readout
  • conductance (numpy array) - sensor readouts converted to conductance
  • background_cond (float) - the conductance at zero salt concentration
  • verbose_ (boolean) - print which calibration was used
Returns: numpy array or float
concentration

readout2concentration_average(self, times, readouts, background_readout, verbose_=False)

source code 

Converts the readout into a concentration using an average of the calibartions.

Parameters:
  • times (numpy array matplotlib time stamps) - times of sensor readout
  • readouts (numpy array) - sensor readouts
  • background_readout (float) - the sensor readout at zero salt concentration (default=1)
  • verbose_ (boolean) - print which calibration was used
Returns: numpy array or float
concentration

readout2concentration_closest(self, times, readouts, background_readout, verbose_=False)

source code 

Converts the readout into a concentration using the calibration closest in time to the readouts (note only the time of first readout is checked).

Parameters:
  • times (numpy array matplotlib time stamps) - times of sensor readout
  • readouts (numpy array) - sensor readouts
  • background_readout (float) - the sensor readout at zero salt concentration (default=1)
  • verbose_ (boolean) - print which calibration was used
Returns: numpy array or float
concentration

conductance2concentration_closest(self, times, readouts, background_readout, verbose_=False)

source code 

Converts the readout into a concentration using the calibration closest in time to the readouts (note only the time of first readout is checked).

Parameters:
  • times (numpy array matplotlib time stamps) - times of sensor readout
  • readouts (numpy array) - sensor readouts
  • background_readout (float) - the sensor readout at zero salt concentration (default=1)
  • verbose_ (boolean) - print which calibration was used
Returns: numpy array or float
concentration

readout2concentration_weighted(self, times, readouts, background_readout)

source code 

Converts the readout into a concentration using the weighted calibration of the two calibrations closest in time to the readout.

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