NSRRDataBase

class torch_ecg.databases.NSRRDataBase(db_name: str, db_dir: Optional[Union[str, pathlib.Path]] = None, working_dir: Optional[str] = None, verbose: int = 1, **kwargs: Any)[source]

Bases: torch_ecg.databases.base._DataBase

Base class for readers for the NSRR database.

For a full list of available databases, and their descriptions, please visit the NSRR database webpage 1.

Parameters
  • db_name (str) – Name of the database.

  • db_dir (str or pathlib.Path, optional) – Local storage path of the database.

  • working_dir (str, optional) – Working directory, to store intermediate files and log files.

  • verbose (int, default 1) – Verbosity level for logging.

  • kwargs (dict, optional) – Auxilliary key word arguments.

References

1

https://sleepdata.org/

get_subject_id(rec: Union[str, int]) int[source]

Attach a unique subject ID for the record.

Parameters

rec (str or int) – Record name or index of the record in all_records.

Returns

Subject ID associated with the record.

Return type

int

helper(items: Optional[Union[str, List[str]]] = None) None[source]

Print corr. meanings of symbols belonging to items.

Parameters

items (str or List[str], optional) – Items to print. If is None, then a comprehensive printing of meanings of all symbols will be performed.

Return type

None

safe_edf_file_operation(operation: str = 'close', full_file_path: Optional[Union[str, pathlib.Path]] = None) None[source]

Safe IO operation for edf file.

Parameters
  • operation ({"open", "close"}, optional) – Operation name, by default “close”.

  • full_file_path (str or pathlib.Path, optional) – Path of the file which contains the data. If is None, default path will be used.

Return type

None

Raises

ValueError – If the operation is not supported.

show_rec_stats(rec: Union[str, int]) None[source]

Print the statistics about the record.

Parameters

rec (str or int) – Record name or index of the record in all_records.

Return type

None