register_loader#
- movement.io.load.register_loader(source_software, *, file_validators=None)[source]#
Register a loader function for a given source software.
The decorator also handles file validation using any provided file validator(s).
- Parameters:
- Returns:
A decorator that registers the loader function.
- Return type:
Callable[[Callable[[Concatenate[TypeVar(TInputFile,Path,str,NWBFile),ParamSpec(P, bound=None)]],Dataset]],Callable[[Concatenate[TypeVar(TInputFile,Path,str,NWBFile),ParamSpec(P, bound=None)]],Dataset]]
Notes
If file validators are provided, the
fileargument passed to the decorated loader function will be an instance of the appropriatemovement.validators.files.ValidFilesubclass, instead of the original file path orpynwb.file.NWBFileobject.Examples
>>> from movement.io.load import register_loader >>> from movement.validators.files import ( ... ValidDeepLabCutH5, ... ValidDeepLabCutCSV, ... ) >>> @register_loader( ... "DeepLabCut", ... file_validators=[ValidDeepLabCutH5, ValidDeepLabCutCSV], ... ) ... def from_dlc_file(file: str | Path, fps=None, **kwargs): ... pass