opynsim.solvers#
Classes
|
A solver that can warp a source |
- class opynsim.solvers.ModelWarper(*args, **kwargs)#
Bases:
objectA solver that can warp a source
opynsim.ModelSpecification.Instances of this class are usually constructed from data files (scaling documents) via
from_xml().- __init__(self) None#
Constructs a blank
ModelWarperthat performs no warping operations (i.e. an identity warp).
- from_xml(source: str | os.PathLike) solvers.ModelWarper#
Returns a
ModelWarperparsed from an XML file (source).- Parameters:
source – Filesystem path to a
<ModelWarperV3Document>XML file (e.g. from OpenSim Creator’s model warper).- Returns:
A
ModelWarper, initialized with the scaling steps and parameters defined insource.- Raises:
RuntimeError – If
sourcecannot be found, read, or is invalid.
- warp(
- self,
- model_specification: ModelSpecification,
Returns a warped copy of
model_specification.- Parameters:
model_specification – An
opynsim.ModelSpecificationthat will be copied and warped by the model warper. Must be compatible with the model warping pipeline that the model warper executes.- Returns:
An
opynsim.ModelSpecificationwith all warping (scaling) steps applied to it. For performance reasons, the warper may produce resources that are stored in-memory. Useopynsim.ModelSpecification.flush_in_memory_resources_to()to flush those resources to disk, if you need to save those resources.- Raises:
RuntimeError – If
model_specificationcannot be warped by this model warper’s warping pipeline.