Skip to main content
`Ctrl`+`K`

# ada.io.acti_eeg

## Classes

`ActiPSG` | A class for storing and handling actigraphic data with corresponding PSG staging.

## Module Contents

class ActiPSG

  A class for storing and handling actigraphic data with corresponding PSG staging.

  acti_data
    Return type:

      ada.data_containers._base._Raw | ada.data_containers._base._Epoched | ada.data_containers.generic.GenericData

  Actigraphic data.

  Type:

    _Raw | _Epoched | GenericData

  eeg_data
    Return type:

      ada.data_containers.scored.PSGScore

  Container with PSG stages converted to sleep/wake scoring.

  Type:

    PSGScore

  trim_to_eeg

  If True, actigraphic data will be trimmed to start and end in the same time as PSG scoring. If False, time before and after PSG scoring is assumed to be wake. Defaults to False.

  Type:

    bool

  cut_by_dates(start_date, end_date)

    Create new object with the data cut by given dates.

    Parameters:

      - start_date (str) – ISO-formated date of outputa data beginning.

      - end_date (str) – ISO-formated date of output data end.

    Returns:

      Object containing the cutted data of the same type as input data.

    Return type:

      _ActiEEG

  cut_by_timestamp(start_ts, end_ts)

    Create new object with the data cut by given timestamps.

    Parameters:

      - start_ts (float) – Unix timestamp of output data beginning.

      - end_ts (float) – Unix timestamp of output data end.

    Returns:

      Object containing the cutted data.

    Return type:

      ActiPSG

  export(path)

    Save data to a file. Output is an ordinary zip archive containing actigraphic data and psg score in the data-specific format.

    Parameters:

      path (str) – Path to the output file.

  static from_continous_stages(acti_data, stages, stages_first_ts, collapse_stages=True, trim_to_eeg=False)

    Create data container from continous PSG tags of constant length (YASA-like).

    Parameters:

      - acti_data (_Raw | _Epoched | GenericData) – Actigraphic data corresponding to the provided staging.

      - stages (list[dict]) – List of tags. Each tag is a dictionary with at least following fields: name, start_timestamp, end_timestamp. Timestamps should be relative to the EEG start.

      - stages_first_ts (float) – Unix timestamp of the first epoch (tag) beginning.

      - collapse_stages (bool | Callable, optional) – If True, PSG stages will be converted to binary sleep/wake scorings using built-in heuristic. If callable, it is a custom function used to convert PSG stages to binary sleep/wake scorings. Defaults to True.

      - trim_to_eeg (bool, optional) – If True, actigraphic data will be trimmed to start and end in the same time as PSG scoring. If False, time before and after PSG scoring is assumed to be wake. Defaults to False.

    Returns:

      Object containing actigraphic data and correspondning PSG stages.

    Return type:

      ActiPSG

  static load_file(path)

    Load zip file created by the export method.

    Parameters:

      path (str) – Path to the file.

    Returns:

      Data loaded from file.

    Return type:

      ActiPSG

  ActiEEG
  property acti_data: ada.data_containers._base._Raw | ada.data_containers._base._Epoched | ada.data_containers.generic.GenericData

    Actigraphic data held in the container.

    Return type:

      ada.data_containers._base._Raw | ada.data_containers._base._Epoched | ada.data_containers.generic.GenericData

  property eeg_data: ada.data_containers.scored.PSGScore

    Sleep/wake scoring held in the container.

    Return type:

      ada.data_containers.scored.PSGScore

  property first_sample_timestamp: float

    Unix timestamp of first sample.

    Return type:

      float

  property last_sample_timestamp: float

    Unix timestamp of last sample.

    Return type:

      float

  property timestamp: numpy.ndarray

    Vector with relative timestamp for each sample.

    Return type:

      numpy.ndarray