Skip to content

Analyses and Features

Here is reported a list of implemented features and available analyses for SCT:

The SCT framework uses a plugin-based architecture for analyses and all analyses are automatically discovered and registered at runtime.

Architecture Summary

Each analysis:

  1. Lives under sct/analyses/<analysis_name>/
  2. Registers itself in its 🐍 __init__.py
  3. Is auto-loaded by sct.analyses.load_analyses
  4. Its CLI command is attached to the root sct.cli.cli CLI group
Directory Structure Example
📁 sct/
    📁 analyses/
        🐍 __init__.py
        📁 <analysis_name>/
            🐍 __init__.py
            🐍 cli.py
            🐍 main.py
            🐍 config.py

Analyses are automatically discovered and registered at runtime using function:

load_analyses

Python
load_analyses() -> None

Loading all analyses defined in this package module

Source code in .nox/build_doc/lib/python3.12/site-packages/sct/analyses/__init__.py
Python
def load_analyses() -> None:
    """Loading all analyses defined in this package module"""
    import importlib
    import pkgutil
    from pathlib import Path

    package_path = Path(__file__).parent

    for module_info in pkgutil.iter_modules([str(package_path)]):
        if module_info.ispkg:
            importlib.import_module(f"{__name__}.{module_info.name}")

Analysis documentation

Each analysis documentation is organized as follows:

<analysis_name>

  • Analysis description: overview of the analysis, methodology, and intended use cases.
  • Configuration description: detailed explanation of available configuration options and parameters.
  • Usage: usage description of the implemented analysis, calling the functionalities from CLI and Python API.
  • API: detailed description of the implemented python API, including the available functions and classes.