helikite.instruments
Submodules
Attributes
Classes
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
Package Contents
- helikite.instruments.stap
- helikite.instruments.stap_raw
- helikite.instruments.mcpc
- helikite.instruments.flight_computer_v1
- helikite.instruments.flight_computer_v2
- helikite.instruments.pico
- helikite.instruments.pops
- helikite.instruments.smart_tether
- helikite.instruments.ozone_monitor
- helikite.instruments.msems_readings
- helikite.instruments.msems_inverted
- helikite.instruments.msems_scan
- class helikite.instruments.Instrument(dtype: Dict[Any, Any] = {}, na_values: List[Any] | None = None, header: int | None = 0, delimiter: str = ',', lineterminator: str | None = None, comment: str | None = None, names: List[str] | None = None, index_col: bool | int | None = None, cols_export: List[str] = [], cols_housekeeping: List[str] = [], export_order: int | None = None, pressure_variable: str | None = None)
Bases:
abc.ABC
Helper class that provides a standard way to create an ABC using inheritance.
- dtype
- na_values = None
- header = 0
- delimiter = ','
- lineterminator = None
- comment = None
- names = None
- index_col = None
- cols_export = []
- cols_housekeeping = []
- export_order = None
- pressure_variable = None
- filename: str | None = None
- date: datetime.datetime | None = None
- pressure_offset_housekeeping: float | None = None
- time_offset: Dict[str, int]
- name: str | None = None
- time_range: Tuple[Any, Any] | None = None
- add_config(yaml_props: Dict[str, Any])
Adds the application’s config to the Instrument class
This is called from the main() function in helikite.py
- abstractmethod data_corrections(df, *args, **kwargs)
Default callback function for data corrections.
Return with no changes
- create_plots(df: pandas.DataFrame) List[plotly.graph_objects.Figure | None]
Default callback for generated figures from dataframes
Return nothing, as anything else will populate the list that is written out to HTML.
- abstractmethod file_identifier(first_lines_of_csv: List[str])
Default file identifier callback
Must return false. True would provide false positives.
- date_extractor(first_lines_of_csv: List[str])
Returns the date of the data sample from a CSV header
Can be used for an instrument that reports the date in header instead of in the data field.
Return None if there is nothing to do here
- add_device_name_to_columns(df: pandas.DataFrame) pandas.DataFrame
Updates dataframe with column names prefixed by instrument name
- property housekeeping_columns: List[str]
Returns housekeeping columns, prefixed with the instrument name
If there are no housekeeping variables, return an empty list
- property export_columns: List[str]
Returns export datafile columns, prefixed with the instrument name
If there are no variables, return an empty list
The export data file is a combined output, similar to housekeeping
- abstractmethod set_time_as_index(df: pandas.DataFrame) pandas.DataFrame
This function is used to set the date in the file to the index
By default no action is taken, but this can be overridden in the instrument class to set the date as the index.
- correct_time_from_config(df: pandas.DataFrame, trim_start: pandas.Timestamp | None = None, trim_end: pandas.Timestamp | None = None) pandas.DataFrame
Correct the time offset and trim from the configuration
- set_housekeeping_pressure_offset_variable(df: pandas.DataFrame, column_name=constants.HOUSEKEEPING_VAR_PRESSURE) pandas.DataFrame
Generate variable to offset pressure value for housekeeping
Using an offset in the configuration, a new variable is created that offset’s the instruments pressure variable. This is used to align the pressure value on the plot to help align pressure.
- abstractmethod read_data() pandas.DataFrame
Read data into dataframe
This allows a custom read function to parse the CSV/TXT into a dataframe, for example cleaning dirty data at the end of the file in memory without altering the input file (see flight computer conf).
- detect_from_folder(input_folder: str, lines_to_read=constants.QTY_LINES_TO_IDENTIFY_INSTRUMENT, quiet=False)
Scans an input folder for the instrument file
If there are two files that match the instrument, the function will raise an error. This is to prevent the program from trying to process the same file twice.
- read_from_folder(input_folder: str, quiet=False) pandas.DataFrame
Reads the data from the detected file in the input folder
- remove_duplicates(df: pandas.DataFrame) pandas.DataFrame
Remove duplicate rows from the dataframe
- class helikite.instruments.Filter(*args, **kwargs)
Bases:
helikite.instruments.base.Instrument
Helper class that provides a standard way to create an ABC using inheritance.
- name = 'filter'
- file_identifier(first_lines_of_csv) bool
Default file identifier callback
Must return false. True would provide false positives.
- data_corrections(df, *args, **kwargs)
Default callback function for data corrections.
Return with no changes
- set_time_as_index(df: pandas.DataFrame) pandas.DataFrame
Set the DateTime as index of the dataframe
Filter instrument contains date and time separately and appears to include an extra whitespace in the field of each of those two columns
- read_data() pandas.DataFrame
Read data into dataframe
This allows a custom read function to parse the CSV/TXT into a dataframe, for example cleaning dirty data at the end of the file in memory without altering the input file (see flight computer conf).
- helikite.instruments.filter