fino2py.ingesting package

Submodules

fino2py.ingesting.read_nova_demographics module

This module provides a function to read the demographics data (Participant ID, age, height, weight) from the specified folder path and return a DataFrame containing the data. This can then be used to merge the demographics data with any of the other permutations of the cardiovascular/hemodynamic data produced by these functions. .. rubric:: Notes

  • The function expects the finometer data to be stored in a single .csv file within the specified folder.

  • The function reads the data from the .csv file, performs preprocessing steps (such as dropping unnecessary columns and converting timestamps), and calculates the average of each measure over the selected time period.

Example

P1_demographics = read_raw_demographics(‘path/to/folder’)

fino2py.ingesting.read_nova_demographics.read_nova_demographics(folder_path: str) pandas.DataFrame[source]

Reads in the demographics from the nova press .csv file and returns a DataFrame row containing the data.

Parameters: file_path (str): Path to the demographics file.

Returns: demographics_df (pd.DataFrame): DataFrame containing the demographics data.

fino2py.ingesting.read_raw_demographics module

This module provides a function to read the demographics data (Participant ID, age, height, weight) from the specified folder path and return a DataFrame containing the data. This can then be used to merge the demographics data with any of the other permutations of the cardiovascular/hemodynamic data produced by these functions. .. rubric:: Notes

  • The function expects the finometer data to be stored in a single .txt file within the specified folder.

  • The function reads the data from the .txt file, performs preprocessing steps (such as dropping unnecessary columns and converting timestamps), and calculates the average of each measure over the selected time period.

Example

P1_demographics = read_raw_demographics(‘path/to/folder’)

fino2py.ingesting.read_raw_demographics.read_raw_demographics(folder_path: str) pandas.DataFrame[source]

Reads in the demographics from the .txt file and returns a DataFrame row containing the data.

Parameters: file_path (str): Path to the demographics file.

Returns: demographics_df (pd.DataFrame): DataFrame containing the demographics data.

fino2py.ingesting.read_raw_finometer_data module

fino2py.ingesting.read_raw_finometer_data.read_raw_finometer_data(folder_path: str | Path, interval: str | None = None, save_csv: bool = False) Tuple[pandas.DataFrame, str][source]

Imports the raw finometer data and calculates the average of each measure over the selected time period.

This function imports the raw finometer data from the specified folder path or file and calculates the average of each measure over a selected time period. The default time period is 1 minute, but it can be changed by setting the interval parameter to a different value. This function is a convenient way to preprocess the data before further analysis.

Parameters:
  • folder_path (Union[str, pathlib.Path]) – The path to the folder containing the .txt file.

  • interval (str, optional) – If provided, the data is resampled to the given interval. Defaults to None.

  • save_csv (bool, optional) – If True, the imported data (or the resampled data if interval is provided) is saved as a CSV file in the same folder as the data file. Defaults to False.

Raises:
  • TypeError – If folder_path is not a pathlib.Path object or a string.

  • ValueError – If folder_path does not exist or is not a directory. If there is not exactly one .txt file in the folder.

Returns:

A tuple containing the following:
  • A DataFrame with the raw finometer data resampled to the given interval.

  • The Participant ID of the participant whose data is being imported.

Return type:

Tuple[pd.DataFrame, str]

Notes

  • The function expects the finometer data to be stored in a single .txt file within the specified folder.

  • The function reads the data from the .txt file, performs preprocessing steps (such as dropping unnecessary columns and converting timestamps), and calculates the average of each measure over the selected time period.

  • If interval is provided, the data is resampled to the given interval using the mean value for each resampled interval.

  • If save_csv is True, the imported data (or the resampled data if interval is provided) is saved as a CSV file in the same folder as the data file.

Example

df, id = read_raw_finometer_data(‘/path/to/folder’, interval=’1T’, save_csv=True)

fino2py.ingesting.read_raw_nova_data module

This module provides a function to read the raw NovaPress data from the specified folder path or file and return a DataFrame containing the data.

This function imports the raw NovaPress data from the specified folder path or file and calculates the average of each measure over a selected time period. The default time period is 1 secong, but it can be changed by setting the interval parameter to a different value. This function is a convenient way to preprocess the data before further analysis. By default it combines data from the ‘Basic Nova’ and ‘Advanced_Hemodynamics’ CSV files by matching on the ‘Time(sec)’ column. This can be changed by setting the required_files parameter to a different list of strings specifying the names of the CSV files to be imported and processed.

Notes

  • The function expects the data to be stored in one or more .csv files in the specified folder.

  • The function reads the data from the CSV files, performs preprocessing steps (such as dropping unnecessary columns and converting timestamps), and calculates the average of each measure over the selected time period.

  • The date is extracted from the file name and used to convert the ‘Time(sec)’ column to a datetime object.

  • If interval is provided, the data is resampled to the given interval using the mean value for each resampled interval, however the default interval is 1

second because otherwise we end up with duplicate timestamps and a lot of NaN values.

Example

df, id = read_raw_nova_data(‘/path/to/folder’, interval=’1T’, save_csv=True)

fino2py.ingesting.read_raw_nova_data.read_raw_nova_data(folder_path: str | Path, interval: str | None = '1s', save_csv: bool = False, required_files: list = ['Basic Nova', 'Advanced_Hemodynamics']) Tuple[str, pandas.DataFrame][source]

Imports the raw NovaPress data, processes it, and calculates the average of each measure over the selected time period.

This function imports the raw NovaPress data from the specified folder path or file and calculates the average of each measure over a selected time period. The default time period is 1 minute, but it can be changed by setting the interval parameter to a different value. This function is a convenient way to preprocess the data before further analysis. It combines data from the ‘Basic Nova’ and ‘Advanced_Hemodynamics’ CSV files by matching on the ‘Time(sec)’ column.

Parameters:
  • folder_path (Union[str, pathlib.Path]) – The path to the folder containing the .csv files.

  • file_prefix (str, optional) – If provided, only files with names starting with this prefix will be considered. Defaults to None.

  • interval (str, optional) – The interval over which the average of each measure is calculated. Defaults to ‘1s’.

  • save_csv (bool, optional) – If True, the imported data (or the resampled data if interval is provided) is saved as a CSV file in the same folder as the data file. Defaults to False.

  • required_files (list, optional) – A list of strings specifying the names of the CSV files to be imported and processed. Defaults to [‘Basic Nova’, ‘Advanced_Hemodynamics’].

Raises:
  • TypeError – If folder_path is not a pathlib.Path object or a string.

  • ValueError – If folder_path does not exist or is not a directory, or if no matching CSV files are found.

Returns:

A tuple containing the following:
  • A string representing the Participant ID of the participant whose data is being imported.

  • A pandas DataFrame with the raw NovaPress data resampled to the given interval (if provided).

Return type:

Tuple[str, pd.DataFrame]

Notes

  • The function expects the data to be stored in one or more .csv files in the specified folder.

  • If file_prefix is provided, only files with names starting with the specified prefix will be considered.

  • The function reads the data from the CSV files, performs preprocessing steps (such as dropping unnecessary columns and converting timestamps), and calculates the average of each measure over the selected time period.

  • If interval is provided, the data is resampled to the given interval using the mean value for each resampled interval.

  • If save_csv is True, the imported data (or the resampled data if interval is provided) is saved as a CSV file in the same folder as the data file.

Example

df, id = read_raw_nova_data(‘/path/to/folder’, interval=’1T’, save_csv=True)

Module contents