pymovements.Phenotype.save#

Phenotype.save(path: Path | str, *, verify_bids: Literal['REQUIRED', 'RECOMMENDED'] | bool = 'REQUIRED', metadata_path: Path | str | None = None, separator: str = '\t', write_csv_kwargs: dict[str, Any] | None = None, metadata_encoding: str = 'utf-8') → None[source]#

Save phenotypic data including metadata.

By default, null values are written as 'n/a' per BIDS. This can be overridden via write_csv_kwargs.

Parameters:
  • path (Path | str) – Save phenotypic data to this file path, e.g. phenotype/acds_adult.tsv.

  • verify_bids (Literal['REQUIRED', 'RECOMMENDED'] | bool) – Verify BIDS conformity before saving. If True, raise exception on non-conformity at REQUIRED level. If ‘REQUIRED’ or ‘RECOMMENDED’, emit warnings for non-conformity at that level. If False, do not verify. (default: 'REQUIRED')

  • metadata_path (Path | str | None) – Save metadata json to this path. If this is a relative path it is assumed to be relative to the directory of the data file. If None: use stem from path and save as <stem>.json in same directory as data file. (default: None)

  • separator (str) – Separator in the tabular data file. (default: \t)

  • write_csv_kwargs (dict[str, Any] | None) – Pass these additional keyword arguments to polars.DataFrame.write_csv(). Takes precedence over the separator argument. (default: None)

  • metadata_encoding (str) – Use this encoding for writing the metadata json file. (default: utf-8)