adamspy package

Submodules

adamspy.adamspy module

Functions for manipulating adams files and data

exception adamspy.adamspy.AdmFileError[source]

Bases: Exception

exception adamspy.adamspy.AviewError[source]

Bases: Exception

Raise this error to if a known error occurs in the log file.

adamspy.adamspy.get_log_errors(log_file)[source]

Checks the log file for errors of the type AviewError.

Parameters:log_file (str) – Filename of aview log file (usulally aview.log)
adamspy.adamspy.get_mdi()[source]

Determine the command used to launch Adams MDI.

This function resolves the Adams MDI launcher using the following priority: 1. If the environment variable ADAMS_LAUNCH_COMMAND is set and refers to

an executable found on the system PATH, that value is used.
  1. If ADAMS_LAUNCH_COMMAND is set but invalid, the default MDI launcher is used if available, and a warning is issued.
  2. If ADAMS_LAUNCH_COMMAND is not set, the default MDI launcher is used if available.
  3. If neither the environment variable nor the default launcher can be resolved, an exception is raised.

The function never returns an empty string and will fail fast if no valid MDI launcher can be found.

Returns:Command used to launch Adams MDI (e.g., mdi or mdi.bat).
Return type:str
Raises:FileNotFoundError – If ADAMS_LAUNCH_COMMAND is set but invalid and the default MDI launcher is not available, or if neither option can be resolved.
adamspy.adamspy.get_n_threads(adm_file)[source]

Searches adm_file for the NTHREADS statement and returns its value.

Parameters:adm_file (str) – Path to an Adams Dataset (.adm) file
Returns:Number of threads set adm_file
Return type:int
adamspy.adamspy.get_simdur_from_acf(acf_file)[source]

Reads an Adams command file (.acf) and returns the total duration of the simulation.

Parameters:acf_file (str) – Filepath to an Adams message file (.msg)
Raises:RuntimeError – Returned if no simulation end time was found in the specified message file
Returns:Total duration of the simulation
Return type:float
adamspy.adamspy.get_simdur_from_msg(msg_file)[source]

Reads an Adams message file (.msg) and returns the total duration of the simulation.

Parameters:msg_file (str) – Filepath to an Adams message file (.msg)
Raises:RuntimeError – Returned if no simulation end time was found in the specified message file
Returns:Total duration of the simulation
Return type:float
adamspy.adamspy.modify_xmt_path(cmd_file, new_xmt_path)[source]
adamspy.adamspy.set_n_threads(adm_file, n_threads)[source]

Changes or creates the NTHREADS option on the PREFERENCES statement in adm_file.

Parameters:
  • adm_file (str) – File path to an Adams Dataset (.adm) file
  • n_threads (int) – Number of threads to use when running the model specified in adm_file
adamspy.adamspy.solve(acf_file, wait=False, use_adams_car=False)[source]

Runs Adams Solver to solve the model specified in acf_file

Parameters:acf_file (str) – Path to an Adams Command (.acf) File

Module contents

adamspy is a set of python tools for manipulating MSC Adams files and data

Available subpackages

adripy
A set of python tools for manipulating MSC Adams Drill files and data

Available modules

adamspy
Functions for manipulating adams files and data