biopsykit.io.fibion module

Module for importing data recorded by the Fibion sensor system.

class biopsykit.io.fibion.FibionDataset(data_dict, sampling_rate_dict, start_time=None, tz=None)[source]

Bases: object

Get new Dataset instance.

Note

Usually you shouldn’t use this init directly. Use the provided from_edf_file, from_csv_file, or from_folder constructors to handle loading recorded Fibion Sessions.

Parameters
  • data_dict (dict) – Dictionary containing data of the channels as pandas.DataFrame. The keys of the dictionary are the channel names.

  • sampling_rate_dict (dict) – Dictionary containing the sampling rate of the channels. The keys of the dictionary are the channel names.

  • start_time (pandas.Timestamp, optional) – Start time of the recording, if present, or None if no start time is available.

  • tz (str, optional) – Timezone of the recording, if present or None if no timezone is available.

classmethod from_edf_file(path, tz='Europe/Berlin')[source]

Create a new Dataset from a valid .edf file.

Parameters
  • path (pathlib.Path or str) – Path to the file

  • tz (str, optional) – Timezone str of the recording. This can be used to localize the start and end time. Note, this should not be the timezone of your current PC, but the timezone relevant for the specific recording.

classmethod from_csv_file(path, tz='Europe/Berlin')[source]

Create a new Dataset from a valid .csv file.

Parameters
  • path (pathlib.Path or str) – Path to the file

  • tz (str, optional) – Timezone str of the recording. This can be used to localize the start and end time. Note, this should not be the timezone of your current PC, but the timezone relevant for the specific recording.

classmethod from_folder(path, tz='Europe/Berlin')[source]

Create a new Dataset from a valid .edf file.

Parameters
  • path (pathlib.Path or str) – Path to the file

  • tz (str, optional) – Timezone str of the recording. This can be used to localize the start and end time. Note, this should not be the timezone of your current PC, but the timezone relevant for the specific recording.

property start_time_unix: pandas._libs.tslibs.timestamps.Timestamp | None

Start time of the recording in UTC time.

property timezone: str

Timezone the dataset was recorded in.

data_as_df(datastreams=None, index=None, start_time=None)[source]

Return all data as one combined pandas.DataFrame.

Parameters
  • datastreams (str, optional) – name(s) of datastream to return in dataframe. If None, all datastreams are returned.

  • index (str, optional) – Specify which index should be used for the dataset. The options are: * “time”: For the time in seconds since the first sample * “utc”: For the utc time stamp of each sample * “utc_datetime”: for a pandas DateTime index in UTC time * “local_datetime”: for a pandas DateTime index in the timezone set for the session * None: For a simple index (0…N)

  • start_time (str, datetime.datetime, pandas.Timestamp, optional) – Start time of the recording. Can be used to provide a custom start time if no start time can be inferred from the recording or to overwrite the start time extracted from the recording.

Return type

DataFrame