mooonpy.thermospace.thermospace module
- class mooonpy.thermospace.thermospace.Thermospace(filename=None, **kwargs)[source]
Bases:
ColTableClass to hold data found in LAMMPS logs. Data is organized into columns
- join_restart(restart, step_col='Step', restart_step_ind=0, this_step_ind=None)[source]
Appends data from a restarted thermospace to the current one. Uses (step_col, restart_step_ind) as the start of the appended section, and finds the last matching (step_col, this_step_ind) and overwrites after that
step_col is the column used for indexing, defaults to ‘Step’ but ‘v_Time’ may also be used
restart_step_ind = 0 uses 0th index step, and so on this_step_ind = None uses last matching value
- sect(sect_string: str | range | list | int | ndarray | None = None, priority='off') ColTable[source]
Extract a subset of data by section ID(s).
- Parameters:
sect_string – Section selector. int for single section, list/array of ints for multiple, range for a range of IDs, None for all sections. str supports comma-separated values and colon ranges with stride (inclusive, 1-indexed, negative indexing):
"1:3""6:""-3:""::-1""1:5:2""1,3,-1"priority – ‘first’ drops the first row of non-first sections, ‘last’ drops the last row of non-first sections, ‘off’ keeps all rows.
- mooonpy.thermospace.thermospace.readlog_basic(file: [<class 'mooonpy.tools.file_utils.Path'>, <class 'str'>], silence_error_line: bool = False, out: ~mooonpy.thermospace.thermospace.Thermospace = None) Thermospace[source]
Read a single log file into a Thermospace object. Only reads thermo table, no timing or variable information.
- Parameters:
file ([Path,str]) – path to a log file
silence_error_line (bool) – silences error line and warnings if True (default False)
- Returns:
Thermospace object
- Return type:
- Example:
>>> import mooonpy >>> file = mooonpy.Path('somepath.log.lammps') >>> MyLog = mooonpy.readlog_basic(file) >>> MyLog.csv(file.new_ext('.csv'))
See also
thermospace.Thermospace,tables.ColTableWarning
Files with no thermo data, or incorrect format, will raise a warning, then return an empty Thermospace object.
Note
This function is capable reading logs with pauses for XRD, and changes to ‘LAMMMPS thermo_style’_. Columns with missing data from style changes are padded with np.nan values in a float array. Complete columns that are intergers are converted to int arrays.
Todo
Unit tests for failure modes and column changes