Skip to content

manifest

yousleep-manifest: write an analysis manifest for a hand run of a container.

The platform writes manifests itself; this generator exists so a container can be run outside the platform in two commands::

yousleep-manifest --recording in.edf --config-id my-analysis-v1
    --channel "EEG Fpz-Cz" --channel "EOG horizontal" --param threshold=0.5 > manifest.json
docker run --rm -v "$PWD:/local" my-analysis --manifest-file /local/manifest.json

It reads the EDF header for channel indices, units and sampling rates, infers channel types from labels, and fills paths as the container sees them with the working directory mounted at /local.

With --config my-analysis.yaml the manifest says what the platform's would: the configuration's id, its cores, the memory it projects for this recording, its parameter defaults with --param on top, and its slots bound in selection order; a selection the platform would refuse is refused here. Without --channel the channels are selected as the platform selects them: those matching the configuration's requirements at an accepted sampling rate, the first ones in montage order where a type has more than the analysis takes. --age, --sex and --bmi give the subject values the configuration declares; a declared value not given is null, as it is on the platform for a study that does not record it. --config-id alone writes a manifest for an analysis without a configuration yet, with guessed resources and untyped parameters.

EdfHeader dataclass

The parts of an EDF header the manifest needs.

EdfSignal dataclass

One signal header of an EDF file.

build_manifest(*, header, recording_path, output_path, config_id, channels, channel_types, params, cpus, memory_mib, events_path=None)

Assemble a manifest from a parsed header and the run's choices.

main(argv=None)

Entry point of yousleep-manifest.

package_version()

Return the installed package version, for --version.

read_edf_header(path)

Parse the fixed and signal headers of an EDF file (no data records are read).

subject_metadata(subject, declared)

Return the manifest's metadata for the given subject values, as the platform fills it.

Parameters:

Name Type Description Default
subject dict[MetadataType, object]

The values given, by metadata type.

required
declared list[MetadataType] | None

The subject values the configuration declares, or None when there is no configuration to consult.

required

Returns:

Type Description
ManifestMetadata | None

The metadata, and the given values the configuration does not

list[MetadataType]

declare, which are left out. With a configuration, only its declared

tuple[ManifestMetadata | None, list[MetadataType]]

values are filled, a declared value not given is null, and a

tuple[ManifestMetadata | None, list[MetadataType]]

configuration that declares none gets no metadata. Without a

tuple[ManifestMetadata | None, list[MetadataType]]

configuration, the given values are filled.