Package fieldpy :: Package core :: Module extra_classes :: Class Data
[hide private]
[frames] | no frames]

Class Data

source code


Parent class for all kinds of data. The data itself should be held in self.data as a masked record array (masked np.ma.core.MaskedArray)


To Do: at the moment only working for 1D data, maybe extend it to N-D

Instance Methods [hide private]
 
__init__(self)
Sets up the basic structure
source code
 
check(self)
Do integrity checks; should be invoked at the end of __init__ [NOT IMPLEMENTED]
source code
 
pickle(self, filename)
Pickel self.
source code
 
mask_value(self, field, value)
Filters out the given value of from the given field by masking them.
source code
 
mask_jumps(self, field, jump_size)
Maskes datapoint for which the absolute difference between them and the point before is more then jump_size.
source code
 
mask_if_true(self, field, bool_fn)
Masks all the values of field where bool_fn is True.
source code
 
mask_jumps_one_dir(self, field, jump_size)
Maskes datapoint for which the difference between them and the point before is more/less then jump_size, for jump_size positive/negative.
source code
 
filter_by_freq(self, field, output_field, sample_rate, cutoff, bandwidth=None, mode='lowpass')
Perform filtering with a windowed sinc frequency-domain filter.
source code
 
filter_low_pass(self, field, output_field, bandwidth, sample_rate, cutoff_freq)
This implements a sinc filter which is a low pass filter (i.e.
source code

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

Instance Variables [hide private]
  data
where the data is held
  md
where the metadata is held
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Sets up the basic structure

Overrides: object.__init__

To Do: introduce a way to handle units

pickle(self, filename)

source code 

Pickel self.

Parameters:
  • filename (string) - the name of the picklefile (reccomended to use .pkl extension)

mask_value(self, field, value)

source code 

Filters out the given value of from the given field by masking them.

Parameters:
  • field (string) - the name of the self.data field
  • value (?) - the value which should be masked

mask_jumps(self, field, jump_size)

source code 

Maskes datapoint for which the absolute difference between them and the point before is more then jump_size.

Parameters:
  • field (string) - the name of the self.data field
  • jump_size (?) - The size of jump which is masked

mask_if_true(self, field, bool_fn)

source code 

Masks all the values of field where bool_fn is True.

Parameters:
  • field (string) - the name of the self.data field
  • bool_fn (function) - function which takes self.data['field'] as argument and returns a boolean

mask_jumps_one_dir(self, field, jump_size)

source code 

Maskes datapoint for which the difference between them and the point before is more/less then jump_size, for jump_size positive/negative.

Parameters:
  • field (string) - the name of the self.data field
  • jump_size (?) - The size of jump which is filtered

filter_by_freq(self, field, output_field, sample_rate, cutoff, bandwidth=None, mode='lowpass')

source code 

Perform filtering with a windowed sinc frequency-domain filter. Can be used for either lowpass or highpass filtering, useful for removing rapid signal variations or long-wavelength trends, respectively.

The call signature is complicated and should be streamlined.

Parameters:
  • field (string) - the name of the self.data field to filter
  • output_field (string) - the name of the output field in self.data
  • sample_rate (float) - the time or distance per sample, i.e. sampling interval
  • cutoff (float) - the e-folding cutoff frequency or wavenumber
  • bandwidth (float) - transition bandwidth (narrow means sharper response at the expense of a longer filtering kernel and slower convolution)
  • mode (str) - either 'lowpass' or 'highpass'

filter_low_pass(self, field, output_field, bandwidth, sample_rate, cutoff_freq)

source code 

This implements a sinc filter which is a low pass filter (i.e. a step filter in the frequency domain).

Parameters:
  • field (string) - the name of the self.data field
  • output_field (string) - the name of the output field of self.data
  • bandwidth (float) - is the precision of the filter narrower bandwidth would seem better, but increases numerical artefacts. Set to a few times more than what you wanna filter
  • sample_rate (float) - is the sampling interval
  • cutoff_freq - float
  • cutoff_freq - is the centre frequency to cut off at example: you have day-long events and hour-long noise so use a cut-off period of a few hours