mahautils.multics.SimResults¶
- class mahautils.multics.SimResults(path: str | Path | None = None, unit_converter: UnitConverter | None = None)¶
Bases:
MahaMulticsConfigFileAn object representing a Maha Multics simulation results file
The Maha Multics software uses simulation results files to configure which simulation results will be generated and to store the results. This class is capable of parsing such files and providing an interface through which users can interact with and manipulate data in the file.
Important
This class does NOT provide identical functionality as the Maha Multics software. There are aspects of the Maha Multics software that can be unintuitive, so some simplifications have been made to this class to make it more intuitive.
Note that the numerical simulation results data parsed by this class should always match that outputted by the Maha Multics software – this class does NOT alter simulation results data generated by Maha Multics. However, there may be some simulation results files with complex and unusual variable names that the Maha Multics software may accept but will throw exceptions or be ignored if attempting to read them with the
SimResultsclass.For more information, refer to the
SimResults.parse()method.Attributes
A dictionary containing options with which the Maha Multics software was compiled
The Git commit hash of the Maha Multics software with which the simulation was compiled
The version of the Maha Multics software with which the simulation was compiled
The number of time steps in the data array of the simulation results file
The simulation version of the
main.cppfile which was used to generate the data in the simulation results fileA title describing the contents of the simulation results file
A tuple containing all variable names listed in the simulation results file
Methods
__init__([path, unit_converter])Creates an object that can read and write Maha Multics simulation results files
append(key, required, units[, data, ...])Adds a variable to the simulation results file
clear()Removes all data stored in this object
clear_data([regex_pattern])Removes simulation results data for any variable(s) with names matching a given regex pattern
get_data(key, units)Extracts simulation results data by variable name
get_description(key)Returns the description (if assigned) of a variable in the simulation results file
get_group(key)Returns the name of the group (if assigned) of a variable in the simulation results file
get_required(key)Returns whether a variable in the simulation results file is specified as "required"
get_units(key)Returns the "raw" units in which data in the simulation results file are stored
Returns a tuple containing all variable groups in the simulation results file
parse()Parses the file content in the
contentslist and populates attributes (such astitle) with extracted dataremove(key)Removes a simulation results variable
search(keyword[, search_fields, ...])Searches the simulation results file for a given search term
set_data(key, data[, units])Adds or replaces simulation results data by variable name
set_description(key, description)Adds or modifies the description of a variable in the simulation results file
set_group(key, group)Sets or modifies the name of the group of a variable in the simulation results file
set_required(key, required)Modifies whether a variable in the simulation results file is specified as "required"
set_units(key, units[, action_if_data_present])Modifies the units of a variable in the simulation results file
update_contents([add_sim_data, indent, padding])Updates the
contentslist based on object attributesInherited Attributes
A tuple of all characters considered to denote comments
A reference to a list containing the (potentially modified) file content of each line of the file
A copy of the dictionary containing any file hashes previously computed for the file specified by the
pathattributeThe character(s) used to denote the end of lines in the text file
Path describing the location of the file on the disk
A copy of the raw file content
Whether the original file had a newline at the end of the file
The unit converter used to convert the units of quantities stored in the file
Inherited Methods
clean_contents([remove_comments, ...])Clean
contentsin-placeClears any stored file hashes
compute_file_hashes([hash_functions, store])Computes hashes of the file specified by the
pathattributeextract_section_by_keyword(section_label, ...)Extracts a section from the
contentslist of file linesReturns whether the file specified by the
pathattribute has changed since the last time file hashes were computedoverwrite([prologue, epilogue, line_ending])read([path, parse])Read file from disk
set_contents(contents, trailing_newline[, ...])Add data to the
contentslistset_read_metadata([path])Configures metadata related to file to be read from disk
store_file_hashes([hash_functions])Computes and stores hashes of the file specified by the
pathattributetrack_new_file(path[, hash_functions])Shortcut for simultaneously modifying the
pathattribute and storing file hasheswrite(output_file[, write_mode, ...])Write file to disk
- __init__(path: str | Path | None = None, unit_converter: UnitConverter | None = None) None¶
Creates an object that can read and write Maha Multics simulation results files
Creates an instance of the
SimResultsclass and optionally reads and parses a specified Maha Multics simulation results file.- Parameters:
path (str or pathlib.Path, optional) – The path and filename of the simulation results file to read and parse (default is
None). If set toNone, no file is readunit_converter (pyxx.units.UnitConverter, optional) – A
pyxx.units.UnitConverterinstance which will be used to convert units of quantities stored in the simulation results file (default isNone). If set toNone, theMahaMulticsUnitConverterunit converter will be used to perform unit conversions
- property trailing_newline: bool¶
Whether the original file had a newline at the end of the file
- property compile_options: Dict[str, str]¶
A dictionary containing options with which the Maha Multics software was compiled
Note that this dictionary is returned by reference, so modifying the returned value will modify the object attribute.
- property maha_multics_commit: str | None¶
The Git commit hash of the Maha Multics software with which the simulation was compiled
- property maha_multics_version: str | None¶
The version of the Maha Multics software with which the simulation was compiled
- property num_time_steps: int¶
The number of time steps in the data array of the simulation results file
- property sim_version: str | None¶
The simulation version of the
main.cppfile which was used to generate the data in the simulation results file
- property title: str | None¶
A title describing the contents of the simulation results file
- property variables: Tuple[str, ...]¶
A tuple containing all variable names listed in the simulation results file
This property contains all variables listed in the “printDict” section of the simulation results file. There may or may not be simulation results data available for any given variable.
- append(key: str, required: bool, units: str, data: ndarray | List[float] | Tuple[float, ...] | None = None, description: str | None = None, group: str | None = None) None¶
Adds a variable to the simulation results file
Adds a new variable to the simulation results file, placing it at the end of the
variableslist.- Parameters:
key (str) – A unique name to identify the variable
required (bool) – Whether the simulation results variable is required to be outputted by Maha Multics
units (str) – The units of the variable’s data
data (np.ndarray or list or tuple, optional) – If desired, a 1D array consisting of the simulation results data for the variable can be provided (default is
None)description (str, optional) – An optional description of the simulation results variable (default is
None)group (str, optional) – An optional group to which the variable belongs (default is
None)
- Raises:
SimResultsOverwriteError – If a variable
keyalready exists in the simulation results file
- clear() None¶
Removes all data stored in this object
- clear_data(regex_pattern: str = '.+') List[str]¶
Removes simulation results data for any variable(s) with names matching a given regex pattern
- Parameters:
regex_pattern (str, optional) – Any variables in
variablesmatching this regex pattern will have existing simulation results data deleted (default is'.+', which matches all variable names)- Returns:
A list containing the variable names whose data were deleted
- Return type:
list
- get_data(key: str, units: str) ndarray¶
Extracts simulation results data by variable name
Extracts data corresponding to a specific simulation results variable and returns it as a NumPy array with user-specified units, performing a unit conversion if necessary.
- Parameters:
key (str) – The name of the variable whose data to extract
units (str) – The units in which the simulation results data should be returned
- Returns:
A NumPy array containing the simulation results data for variable
key, in units ofunits- Return type:
np.ndarray
- clean_contents(remove_comments: bool = False, skip_full_line_comments: bool = False, strip: bool = False, concat_lines: bool = False, remove_blank_lines: bool = False) None¶
Clean
contentsin-placeCleans
contents(removing comments, blank lines, etc.) based on user-defined rules. Modifications are made in-place (i.e., the resulting content is stored incontents).- Parameters:
remove_comments (bool, optional) – Whether to remove comments from file (default is
True)skip_full_line_comments (bool, optional) – Whether to skip removing comments where the comment is the only text on a line. Only applies if
remove_commentsisTrue(default isFalse)strip (bool, optional) – Whether to strip leading and trailing whitespace from each line (default is
True)concat_lines (bool, optional) – Whether to concatenate lines ending with a backslash with the following line (default is
True)remove_blank_lines (bool, optional) – Whether to remove lines that contain no content after other cleaning operations have completed (default is
True)
- clear_file_hashes() None¶
Clears any stored file hashes
- property comment_chars: Tuple[str, ...] | None¶
A tuple of all characters considered to denote comments
- compute_file_hashes(hash_functions: tuple | str = ('md5', 'sha256'), store: bool = False) Dict[str, str]¶
Computes hashes of the file specified by the
pathattributeComputes and returns the hashes of the file specified by the
pathattribute, with the option to populate thehashesdictionary with their values.- Parameters:
hash_functions (tuple or str, optional) – Tuple of strings (or individual string) specifying which hash(es) to compute. Any hash functions supported by
hashlibcan be used. Default is('md5', 'sha256')store (bool, optional) – Whether to store the computed hashes in the
hashesdictionary (default isFalse)
- Returns:
A dictionary containing the file hashes specified by
hash_functions- Return type:
dict
See also
pyxx.files.compute_file_hashFunction used to compute file hashes
Notes
Prior to calling this method, the
pathattribute must be defined. To simultaneously set thepathattribute and store file hashes, usetrack_new_file().
- property contents: List[str]¶
A reference to a list containing the (potentially modified) file content of each line of the file
Warning
This attribute returns the list by reference. This means that if you set a variable equal to this reference, then editing this variable will edit the
contentsattribute (e.g., if you setmy_content = MyTextFile.contents, then editingmy_contentwill change the content stored inMyTextFile).Notes
If trying to set the
contentsattribute, do not try to set this attribute directly (i.e., don’t use code similar toMyTextFile.contents = ['line1', 'line2', 'line3']). Instead, use theset_contents()method, as it offers greater control over whether the contents are passed by reference or value.
- extract_section_by_keyword(section_label: str, begin_regex: str, end_regex: str, section_line_regex: str = '(.*)', max_sections: int | None = None, begin_idx: int = 0, allow_comment_lines: bool = True) Tuple[List[Match], List[Tuple[str, ...]], int, int]¶
Extracts a section from the
contentslist of file linesMany Maha Multics configuration files contain sections with certain types of data, where the section begins following a formatted section marker and ends at another marker (both with unique, identifiable regex patterns). This method extracts the data from such a section. If multiple sections are found, the data in all sections is merged, unless specified otherwise by setting
max_sections.- Parameters:
section_label (str) – A descriptive name identifying the section. This is not used in parsing the file; it is only used to customize error messages and make them more descriptive
begin_regex (str) – The regex pattern which marks the beginning of the section
end_regex (str) – The regex pattern which marks the end of the section
section_line_regex (str, optional) – If provided, this regex pattern must be matched by all lines inside the section (default is
'(.*)', which matches any text)max_sections (int, optional) – The maximum number of sections to extract; that is, only the first
max_sectionsencountered will be extracted and returned (default isNone, which extracts all sections)begin_idx (int, optional) – The index (in the
contentslist) at which to begin to search for and extract data from sections (default is0)allow_comment_lines (bool, optional) – If
True, any lines within the section that do not matchsection_line_regexbut begin with any of the characters incomment_charswill be outputted (part of the second output of the method); ifFalse, any lines within the section that do not matchsection_line_regexwill result in an error being thrown (default isTrue)
- Returns:
list – A list of
re.Matchobjects containing the matches for the regex patternsection_line_regexfor all lines in the section(s)list – A list (of the same length as the first argument returned) of tuples of strings. For each
re.Matchobject, the corresponding item in this list contains a tuple with any full-line comments preceding the matched lineint – The index of
contentsof the next line immediately following the line on whichend_regexwas foundint – The number of sections that were extracted from the
contentslist
- get_description(key: str) str | None¶
Returns the description (if assigned) of a variable in the simulation results file
- Parameters:
key (str) – The name of the variable whose description to retrieve
- Returns:
A string containing the description of the simulation results variable, or
Noneif no description is available- Return type:
str or None
- has_changed() bool¶
Returns whether the file specified by the
pathattribute has changed since the last time file hashes were computed- Returns:
Whether file has changed since the last time file hashes were computed
- Return type:
bool
- property hashes: Dict[str, str]¶
A copy of the dictionary containing any file hashes previously computed for the file specified by the
pathattribute
- property line_ending: str | Tuple[str, ...]¶
The character(s) used to denote the end of lines in the text file
This property only applies to files that were read using the
read()method. After reading a file, this property stores the line ending(s) used in the file. Lines in text files can be terminated with'\n'(LF),'\r\n'(CRLF),'\r', or a combination of these characters (potentially with different line endings on different lines).After reading a file, this property stores either a string containing the line endings on every line of the file, or a tuple containing all line endings encountered throughout the file.
- overwrite(prologue: str = '', epilogue: str | None = None, line_ending: str = '\n') None¶
Write data in
contentsto the file specified bypathWrites the lines of content in the
contentsattribute to the (previously-defined) file specified by thepathattribute, suppressing warnings before overwriting the file. This is useful for cases when the file contents are manually populated and it is desired to “dump” them to a file. This method is also useful if a file’s contents need to be updated periodically based on the results of another process.- Parameters:
prologue (str, optional) – Content written at beginning of file (default is
'')epilogue (str, optional) – Content written at end of file (default is to use the value of the
line_endingargument iftrailing_newlineisTrueand''otherwise)line_ending (str, optional) – String written at the end of each line when writing file content (default is
'\n')
- property path: Path | None¶
Path describing the location of the file on the disk
Assigning a value to this attribute (regardless whether it matches the current value or is a different path) will save the value as a
pathlib.Pathand will automatically clear any saved file hashes.
- property raw_contents: List[str] | None¶
A copy of the raw file content
If the file was read using the
read()method, this attribute stores the original, unaltered contents of each line of the input file, and it returns a copy of this list of lines. If the file was not read with theread()method, this attribute stores a value ofNone.
- read(path: str | Path | None = None, parse: bool = True) None¶
Read file from disk
Calling this method reads the file specified by the
pathattribute from the disk, populatingcontentsandraw_contents. Additionally, the file hashes stored in thehashesattribute are updated (to make it easier to check if the file has been modified later).- Parameters:
path (str or pathlib.Path, optional) – Location of the text file in the file system (default is
None)parse (bool, optional) – Whether to call the
parse()method after reading the file (default isTrue)
- set_contents(contents: List[str], trailing_newline: bool, pass_by_reference: bool = False) None¶
Add data to the
contentslistAllows users to manually fill the
contentslist with user-defined content. The input list must be a list of strings, and the user can optionally choose whether to pass the input by reference or value.- Parameters:
contents (list) – List of strings which are to be assigned to the
contentslisttrailing_newline (bool) – Whether the contents being added represent a file with a trailing newline (because the file wasn’t read, the object has no way to determine whether the file has a trailing newline, so users must provide this information)
pass_by_reference (bool, optional) – Whether to pass the
contentsargument by reference (default isFalse)
Notes
If passing
contentsby reference, this means that if subsequent changes are made to the originalcontentsobject, they will be reflected in thecontentsattribute. If passing by value, then a copy of thecontentsargument will be made, so changing the object outside the class instance will not affect thecontentsattribute.
- set_read_metadata(path: str | Path | None = None) None¶
Configures metadata related to file to be read from disk
This method performs several pre-processing steps to prepare to read a file from the disk:
Sets the
pathattribute. If thepathargument was provided, the attribute is set to this value; otherwise, the existing value stored in thepathattribute is used (or an error is thrown if not defined).Verifies that the file specified by the
pathattribute exists.Stores the hashes for the file.
It is advised that this method be called prior to reading any file.
- Parameters:
path (str or pathlib.Path, optional) – Location of the file in the file system (default is
None)- Raises:
- store_file_hashes(hash_functions: tuple | str = ('md5', 'sha256')) None¶
Computes and stores hashes of the file specified by the
pathattributeComputes given hashes of the file specified by the
pathattribute and populates thehashesdictionary with their values.- Parameters:
hash_functions (tuple or str, optional) – Tuple of strings (or individual string) specifying which hash(es) to compute. Any hash functions supported by
hashlibcan be used. Default is('md5', 'sha256')
See also
pyxx.files.compute_file_hashFunction used to compute file hashes
track_new_fileUse this method if you want to store file hashes but the
pathattribute isn’t yet defined
Notes
Prior to calling this method, the
pathattribute must be defined. To simultaneously set thepathattribute and store file hashes, usetrack_new_file().
- track_new_file(path: str | Path, hash_functions: tuple | str = ('md5', 'sha256')) None¶
Shortcut for simultaneously modifying the
pathattribute and storing file hashesThis method functions as a “shortcut,” both modifying the
pathattribute and storing an optionally user-specified list of file hashes in thehashesattribute. The intention of this method is that if aFileinstance is tracking a given file, and user wants to switch to tracking another file, this provides a convenient way to do so with a single line of code.- Parameters:
file (str or pathlib.Path) – File that the object is to represent
hash_functions (tuple or str, optional) – Tuple of strings (or individual string) specifying which hash(es) to compute. Any hash functions supported by
hashlibcan be used. Default is('md5', 'sha256')
See also
pyxx.files.compute_file_hashFunction used to compute file hashes
- property unit_converter: UnitConverter¶
The unit converter used to convert the units of quantities stored in the file
- write(output_file: str | Path, write_mode: str = 'w', warn_before_overwrite: bool = True, prologue: str = '', epilogue: str | None = None, line_ending: str = '\n', update_contents: bool = True) None¶
Write file to disk
Calling this method writes the file contents stored in
contentsto the disk.- Parameters:
output_file (str or pathlib.Path) – Output file to which to write content
write_mode (str, optional) – Any mode (such as
'w'or'a') for the built-inopen()function for writing files (default is'w')warn_before_overwrite (bool, optional) – Whether to throw an error if
output_filealready exists (default isTrue)prologue (str, optional) – Content written at beginning of file (default is
'')epilogue (str, optional) – Content written at end of file (default is to use the value of the
line_endingargument iftrailing_newlineisTrueand''otherwise)line_ending (str, optional) – String written at the end of each line when writing file content (default is
'\n')update_contents (bool, optional) – Whether to call the
update_contents()method before writing the file (default isTrue)
- get_group(key: str) str | None¶
Returns the name of the group (if assigned) of a variable in the simulation results file
- Parameters:
key (str) – The name of the variable whose group to retrieve
- Returns:
A string containing the name of the group of the simulation results variable, or
Noneif no group has been assigned- Return type:
str or None
- get_required(key: str) bool¶
Returns whether a variable in the simulation results file is specified as “required”
Variables specified as “required” indicates to the Maha Multics software that the simulation should exit with error if unable to output these values.
- Parameters:
key (str) – The name of the variable whose data to extract
- Returns:
Whether the variable specified by
keyis marked as “required” in the simulation results file- Return type:
bool
- get_units(key: str) str¶
Returns the “raw” units in which data in the simulation results file are stored
When extracting data with
get_data(), the units can be converted to any valid unit; however, the data inSimResultsobjects is internally stored with a particular set of units. This method returns these units of the internally stored data.- Parameters:
key (str) – The name of the variable whose units to return
- Returns:
The internally stored units of data in the simulation results file
- Return type:
str
- list_groups() Tuple[str, ...]¶
Returns a tuple containing all variable groups in the simulation results file
- Returns:
A tuple of strings, where each string is a variable group in the simulation results file
- Return type:
tuple
- parse() None¶
Parses the file content in the
contentslist and populates attributes (such astitle) with extracted dataThis method parses the data in
contents, extracting configuration and simulation results data and storing it in this object’s attributes for easier reading and editing.Notes
When parsing simulation results files, variables within the
printDictsection can contain any non-whitespace characters. One challenge is handling “special” simulation results variables that the Maha Multics software uses to match a series of numbered results. For instance, a variable namedpDC_**in theprintDictsection is interpreted by the Maha Multics software to match output simulation data such aspDC_1,pDC_2, etc. (i.e., displacement chamber pressures for multiple pistons). In other words, a single key in theprintDictsection may correspond to multiple simulation results variables that need to be added toSimResults.variables.The convention adopted by the
SimResultsclass to handle this case is as follows:If simulation results variables end with either
_**or_*(#,#), where#represents an integer, then these are assumed to be “special” variables which match numbered results variables.In the event, such a variable is defined in the
printDictsection, the line in the simulation results file beginning with$(which specifies names and descriptions for simulation results variables) is parsed, and the “special” variables in theprintDictsection are matched against this line.Any “special” variables for which the
**or*(#,#)portion matches some combination of numbers and/or asterisks are added toSimResults.variables.Otherwise, if no matches are found, the “special” variable is ignored (it is not added to
SimResults.variables).
Notice that, as discussed in the
SimResultsintroduction, there are some edge cases with unusual variable names that MahaUtils will not parse but may be accepted by the Maha Multics software.“Special” Variable Matching Example
Consider the following simulation results file:
printDict{ @pDC_** [bar] @qDC_** [L/min] } $pDC_1:bar:DC1 pressure$pDC_3:bar:DC3 pressureAfter parsing this file,
SimResults.variableswill containpDC_1andpDC_3because the “special” variablepDC_**matches these numbered simulation outputs (found on the line beginning with$). However, this line contains no entries that matchqDC_**, soqDC_**is ignored.
- remove(key: str) None¶
Removes a simulation results variable
Removes a variable and any associated data from the simulation results file.
- Parameters:
key (str) – The name of the variable to remove
- search(keyword: str, search_fields: str | Tuple[str, ...] | List[str] = ('keys', 'description', 'group', 'units'), case_sensitive: bool = False, show_data: bool = False, print_results: bool = True, return_results: bool = False) Tuple[str, ...] | None¶
Searches the simulation results file for a given search term
This method can be useful for finding data, particularly in a large simulation results file. It performs a relatively basic search, checking to see if a given term
keywordis in any of the specified search fields. The exactkeywordmust be found to register a match; similar terms are not considered a match. To match any string, setkeywordto''.- Parameters:
keyword (str) – The term to search for
search_fields (str or tuple or list, optional) – One or more simulation results variable attributes in which to search for
keyword(default is to search all possible attributes,('keys', 'description', 'group', 'units'))case_sensitive (bool, optional) – Whether to perform a case-sensitive search (default is
False)show_data (bool, optional) – Whether to print simulation results data, if available, for each variable (default is
False). Setting this toTruecan considerably increase output verbosityprint_results (bool, optional) – Whether to display results to the terminal (default is
True)return_results (bool, optional) – Whether to return a tuple of strings containing the simulation results variable keys for all search matches (default is
False)
- Returns:
A tuple of strings containing all simulation results variable keys (i.e., selected from
variables) for which search matches were registered. Only returned ifreturn_resultsisTrue- Return type:
tuple
- set_data(key: str, data: ndarray | List[float] | Tuple[float, ...] | None, units: str | None = None) None¶
Adds or replaces simulation results data by variable name
- Parameters:
key (str) – The name of the variable whose data to store
data (np.ndarray or list or tuple) – A 1D array containing the data (in units of
units) to storeunits (str) – The units in which the simulation results data should be stored
- set_description(key: str, description: str | None) None¶
Adds or modifies the description of a variable in the simulation results file
- Parameters:
key (str) – The name of the variable whose description to retrieve
description (str or None) – The description of the simulation results variable, or
Noneto remove the description
- set_group(key: str, group: str | None) None¶
Sets or modifies the name of the group of a variable in the simulation results file
- Parameters:
key (str) – The name of the variable whose group to retrieve
description (str or None) – The group name of the simulation results variable, or
Noneto remove the group name
- set_required(key: str, required: bool) None¶
Modifies whether a variable in the simulation results file is specified as “required”
Variables specified as “required” indicates to the Maha Multics software that the simulation should exit with error if unable to output these values.
- Parameters:
key (str) – The name of the variable whose data to extract
required (bool) – Whether the variable specified by
keyis marked as “required” in the simulation results file
- set_units(key: str, units: str, action_if_data_present: str = 'error') None¶
Modifies the units of a variable in the simulation results file
- Parameters:
key (str) – The name of the variable whose units to modify
units (str) – The units to assign to variable
keyaction_if_data_present (str, optional) – The action that should be taken if simulation results data for
keyare already present in the simulation results file (default is'error'). See “Notes” section for additional information
Notes
In the case that simulation results data for
keyalready exist, it is not obvious how this case should be handled: should the data also be converted to the new units, or should only the units be changed?MahaUtils provides three options to handle this case:
'error': If simulation results data are present, throw an error'convert_data': If simulation results data are present, convert it to the units given by theunitsargument (e.g., \(3\ m\) would become \(0.003\ mm\))'keep_data_values': If simulation results data are present, keep the same values of the data but change the units (e.g., \(3\ m\) would become \(3\ mm\))
- update_contents(add_sim_data: bool = True, indent: int = 4, padding: int = 4) None¶
Updates the
contentslist based on object attributesThis method synchronizes the
contentslist with the data stored in theSimResultsattributes (title, variables added byappend(), etc.). This step should generally be performed prior to callingwrite(), as writing a file directly saves the data incontentsto disk.- Parameters:
add_sim_data (bool, optional) – Whether to add simulation results data to the end of
contents(default isTrue)indent (int, optional) – The number of spaces to use for indentation in the file (default is
4)padding (int, optional) – The number of spaces to place between simulation results variable names and the units in the
printDictsection of the simulation results file (default is4)