Configuration#

The opynsim API contains a few high-level functions for configuring the global state of the system. These are usually necessary for debugging or legacy compatibility with OpenSim conventions.

API Reference#

opynsim.set_logging_level(python_logging_level: int) None#

Set the global logging level for OPynSim.

By default, OPynSim minimizes log output so that downstream Python applications can control their own logging configuration. However, some modelling components (particularly those originating from OpenSim) emit useful diagnostic information to the log.

This function configures OPynSim’s internal logging verbosity using standard Python logging levels.

Parameters:

python_logging_level (int) – A logging level from the Python (logging) module such as logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, or logging.CRITICAL.

opynsim.add_opensim_geometry_directory(geometry_directory_path: str | os.PathLike) None#

Globally adds the provided path to OpenSim’s geometry search path, which OpenSim uses whenever it cannot find a mesh file that an OpenSim model file references.

By default, relative paths in OpenSim models are resolved as Geometry/${mesh_path} in the directory of the model file (if it’s on disk). For example, if you have an OpenSim model file directory/model.osim that contains a <Mesh> component with a mesh_file called r_pelvis.vtp, then OpenSim will search:

  • directory/Geometry/r_pelvis.vtp

  • ${geometry_directory_path[0]}/r_pelivs.vtp

  • ${geometry_directory_path[1]}/r_pelivs.vtp

Where ${geometry_directory_path[i]} is the ith geometry_directory_path provided to this function.

Parameters:

geometry_directory_path – An absolute path to the fallback directory.