osl_dynamics.config_api#

Config API for specifying and running pipelines.

The config API allows you to define a full analysis pipeline (data loading, preparation, and model training) as a YAML config and run it in a single call. For example, to train a TDE-HMM:

config = '''
    load_data:
        inputs: training_data
        prepare:
            tde_pca: {n_embeddings: 15, n_pca_components: 80}
            standardize: {}
    train_hmm:
        config_kwargs:
            n_states: 8
            learn_means: False
            learn_covariances: True
'''

run_pipeline(config, output_dir="results")

Command line usage#

The config API can also be used from the command line:

osl-dynamics <config-file> <output-directory>

where <config-file> is a YAML file containing the config and <output-directory> is the output directory.

To restrict to a specific GPU:

osl-dynamics <config-file> <output-directory> --restrict 0

Remember to activate the osld conda environment first.

Modules#

  • pipelinerun_pipeline() for executing a config.

  • wrappers — Wrapper functions for each pipeline step.

Python example scripts#

Code to reproduce the eLife paper results can be found here. The different pipelines are: