gplately.PlateModelManager
- class gplately.PlateModelManager(model_manifest: str = '', timeout=(None, None))[source]
Bases:
objectManage discovery and loading of plate reconstruction model metadata.
Model manifests can be loaded from a local file or an HTTP(S) endpoint. Retrieved model configurations are used to construct
PlateModelinstances.- __init__(model_manifest: str = '', timeout=(None, None))[source]
Create a
PlateModelManagerinstance.If
model_manifestis omitted, the manager probes known PMM manifest endpoints and uses the first reachable URL.- Parameters:
model_manifest – Local path or HTTP(S) URL for a
models.jsonmanifest. Use this when hosting a custom model repository.timeout – Timeout tuple passed to HTTP requests.
- Raises:
InvalidConfigFile – If the manifest path/URL is invalid or does not contain valid JSON.
ServerUnavailable – If the manifest URL cannot be reached.
Methods
__init__([model_manifest, timeout])Create a
PlateModelManagerinstance.download_all_models([data_dir])Download layer data for all available models into
data_dir.Return all model keys from the loaded manifest.
Return the first reachable default model-manifest URL.
get_local_available_model_names(local_dir)Return locally available model names from
local_dir.get_model([model_name, data_dir, ...])Return a
PlateModelformodel_name.Attributes
Return metadata for all configured models.
- download_all_models(data_dir: str = './') None[source]
Download layer data for all available models into
data_dir.- Parameters:
data_dir (str) – Destination directory for downloaded model data.
- static get_default_repo_url()[source]
Return the first reachable default model-manifest URL.
Endpoints are probed in order using HTTP
HEADrequests.- Returns:
Reachable manifest URL.
- Return type:
- Raises:
ServerUnavailable – If none of the default endpoints are reachable.
- static get_local_available_model_names(local_dir: str)[source]
Return locally available model names from
local_dir.
- get_model(model_name: str = 'default', data_dir: str = '.', reference_frame: ReferenceFrame | None = None) PlateModel | None[source]
Return a
PlateModelformodel_name.The method resolves aliases, applies optional reference-frame handling, and instantiates
PlateModelwith the resolved configuration.- Parameters:
model_name – Model name or alias (case-insensitive). Defaults to
"default".data_dir – Parent directory for model downloads and cache files.
reference_frame – Optional reference frame. When PMAG is requested and a
_pmag_refvariant exists, that variant is selected automatically.
- Returns:
A configured
PlateModel, orNoneif the model is unavailable or incompatible with the requested reference frame.- Raises:
InvalidConfigFile – If alias resolution detects an invalid alias chain.