swarmpal.toolboxes.tfa.processes#
Attributes#
Classes#
Prepare data for input to other TFA tools |
|
Clean TFA_Variable by removing outliers and interpolate gaps |
|
High-pass filter the TFA_Variable, using the SciPy Chebysev Type II filter |
|
Apply wavelet analysis |
|
Screen out potential false waves |
Functions#
|
Returns the relevant subtree when Preprocess has been applied |
|
Get the sampling rate set by Preprocess |
Module Contents#
- swarmpal.toolboxes.tfa.processes.FLAG_THRESHOLDS#
- class swarmpal.toolboxes.tfa.processes.Preprocess(config: dict | None = None, active_tree: str = '/', inplace: bool = True)[source]#
Bases:
swarmpal.io.PalProcessPrepare data for input to other TFA tools
- property process_name: str#
- set_config(dataset: str = '', timevar: str = 'Timestamp', active_variable: str = '', active_component: int | None = None, sampling_rate: float = 1, remove_model: bool = False, model: str = '', convert_to_mfa: bool = False, use_magnitude: bool = False, clean_by_flags: bool = False, flagclean_varname: str = '', flagclean_flagname: str = '', flagclean_maxval: int | None = None, output_dataset: str = 'PAL_TFA') None[source]#
Set the process configuration
- Parameters:
dataset (str) – Selects this dataset from the datatree
timevar (str) – Identifies the name of the time variable, usually “Timestamp” or “Time”
active_variable (str) – Selects the variable to use from within the dataset
active_component (int, optional) – Selects the component to use (if active_variable is a vector)
sampling_rate (float, optional) – Identify the sampling rate of the data input (in Hz), by default 1
remove_model (bool, optional) – Remove a magnetic model prediction or not, by default False
model (str, optional) – The name of the model
convert_to_mfa (bool, optional) – Rotate B to mean-field aligned (MFA) coordinates, by default False
use_magnitude (bool, optional) – Use the magnitude of a vector instead, by default False
clean_by_flags (bool, optional) – Whether to apply additional flag cleaning or not, by default False
flagclean_varname (str, optional) – Name of the variable to clean
flagclean_flagname (str, optional) – Name of the flag to use to clean by
flagclean_maxval (int, optional) – Maximum allowable flag value
output_dataset (str) – Sets the name of the dataset in the data tree that TFA processes will write results to, by default “PAL_TFA”
Notes
Some special
active_variablenames exist which are added to the dataset on-the-fly:- “B_NEC_res_Model”
where a model prediction must be available in the data, like
"B_NEC_<Model>", andremove_modelhas been set. The name of the model can be set with, for example,model="CHAOS".
- “B_MFA”
when
convert_to_mfahas been set.
- “Eh_XYZ” and “Ev_XYZ”
when using the TCT datasets, with vectors defined in
("Ehx", "Ehy", "Ehz")and("Evx", "Evy", "Evz")respectively.
- property active_variable#
- property active_component#
- swarmpal.toolboxes.tfa.processes._get_tfa_active_subtree(datatree, output_dataset)[source]#
Returns the relevant subtree when Preprocess has been applied
- swarmpal.toolboxes.tfa.processes._get_sampling_rate(datatree, output_dataset)[source]#
Get the sampling rate set by Preprocess
- class swarmpal.toolboxes.tfa.processes.Clean(config: dict | None = None, active_tree: str = '/', inplace: bool = True)[source]#
Bases:
swarmpal.io.PalProcessClean TFA_Variable by removing outliers and interpolate gaps
- property process_name: str#
- set_config(window_size: int = 10, method: str = 'iqr', multiplier: float = 0.5, output_dataset: str = 'PAL_TFA') None[source]#
Set the process configuration
- Parameters:
window_size (int, optional) – The size (number of points) of the rolling window, by default 10
method (str, optional) – “normal” or “iqr”, by default “iqr”
multiplier (float, optional) – Indicates the spread of the zone of accepted values, by default 0.5
output_dataset (str) – Sets the name of the dataset in the data tree that TFA processes will write results to, by default “PAL_TFA”
- class swarmpal.toolboxes.tfa.processes.Filter(config: dict | None = None, active_tree: str = '/', inplace: bool = True)[source]#
Bases:
swarmpal.io.PalProcessHigh-pass filter the TFA_Variable, using the SciPy Chebysev Type II filter
- property process_name: str#
- set_config(cutoff_frequency: float = 20 / 1000, output_dataset: str = 'PAL_TFA') None[source]#
Set the process configuration
- Parameters:
cutoff_frequency (float, optional) – The cutoff frequency (in Hz), by default 20/1000
output_dataset (str) – Sets the name of the dataset in the data tree that TFA processes will write results to, by default “PAL_TFA”
- class swarmpal.toolboxes.tfa.processes.Wavelet(config: dict | None = None, active_tree: str = '/', inplace: bool = True)[source]#
Bases:
swarmpal.io.PalProcessApply wavelet analysis
- property process_name: str#
- set_config(min_frequency: float | None = None, max_frequency: float | None = None, min_scale: float | None = None, max_scale: float | None = None, dj: float = 0.1, output_dataset: str = 'PAL_TFA') None[source]#
Set the process configuration
- Parameters:
min_frequency (float | None, optional) – _description_, by default None
max_frequency (float | None, optional) – _description_, by default None
min_scale (float | None, optional) – _description_, by default None
max_scale (float | None, optional) – _description_, by default None
dj (float, optional) – _description_, by default 0.1
output_dataset (str) – Sets the name of the dataset in the data tree that TFA processes will write results to, by default “PAL_TFA”
- class swarmpal.toolboxes.tfa.processes.WaveDetection(config: dict | None = None, active_tree: str = '/', inplace: bool = True)[source]#
Bases:
swarmpal.io.PalProcessScreen out potential false waves
Removes part of the wavelet spectrum that might be due to spikes, data gaps, ESFs or trailing parts of wave activity from either above or below the range of frequencies that were used to perform the wavelet transform.
- property process_name: str#