ada.database_utils.fetch_files — ADA 1.0.3 documentation

Skip to main content
`Ctrl`+`K`

# ada.database_utils.fetch_files

## Functions

`fetch_acti`(files, tag_file) | Find all actigraphic recordings corresponding to given obci.tag.
`fetch_from_acti`(acti_file, xml_folder, tag_folder[, tag]) | For given actigraphic file find corresponding .xml and .tag files.
`fetch_from_tag`(tag_file, acti_folder, xml_folder[, hand]) | For given obci.tag file fetch corrersponding actigraphic data and .xml with PSG metadata.
`hand_paths`(files[, hand]) | Return path to recordings from given hand.
`uniqe_files`(files) | Files are duplicated (2 recordings from the same hand for each subject.) Return only one of them.

## Module Contents

fetch_acti(files, tag_file)

  Find all actigraphic recordings corresponding to given obci.tag.

  Parameters:

    - files (str | list[str]) – Unix-style path pattern or list of paths to files.

    - tag_file (str) – Path to desired obci.tag file.

  Returns:

    List of paths.

  Return type:

    list[str]

fetch_from_acti(acti_file, xml_folder, tag_folder, tag=True)

  For given actigraphic file find corresponding .xml and .tag files.

  Parameters:

    - acti_file (str) – Path to actigraphic data file.

    - xml_folder (str) – Path to folder with .xml metadata corresponding to PSG recordings.

    - tag_folder (str) – Path to folder with .tag tags corresponding to PSG recordings.

    - tag (bool) – If True, raise error if tag is not found. When False, path to tag might be meaningless. Defaults to True.

  Raises:

    RuntimeError – Can’t match .tag or .xml files to provided actigraphic file.

  Returns:

    Path to .xml and .tag files corresponding to provided actigraphic file.

  Return type:

    Tuple[str, str]

fetch_from_tag(tag_file, acti_folder, xml_folder, hand='left')

  For given obci.tag file fetch corrersponding actigraphic data and .xml with PSG metadata.

  Parameters:

    - tag_file (str) – Path to obci.tag file.

    - acti_folder (str) – Path to folder with actigraphic data.

    - xml_folder (str) – Path to folder with .xml metadadata corresponding to PSG recordings.

    - hand (str, optional) – Desired hand. Can be ‘left’ or ‘right’. Defaults to ‘left’.

  Raises:

    RuntimeError – Can’t match actigraphic data or .xml to provided obci.tag.

  Returns:

    Path to .xml and to actigraphic data, respectively.

  Return type:

    Tuple[str, str]

hand_paths(files, hand='left')

  Return path to recordings from given hand.

  Parameters:

    - files (str | list[str]) – Unix-style path pattern or list of paths to files.

    - hand (str, optional) – Desired hand. Can be ‘left’ or ‘right’. Defaults to ‘left’.

  Returns:

    List of paths.

  Return type:

    list[str]

uniqe_files(files)

  Files are duplicated (2 recordings from the same hand for each subject.) Return only one of them.

  Parameters:

    files (str | list[str]) – Unix-style path pattern or list of paths to files.

  Returns:

    List of paths.

  Return type:

    list[str]