montepy.input_parser.input_reader module#

Functions:

read_input(destination[, mcnp_version, ...])

Reads the specified MCNP Input file.

montepy.input_parser.input_reader.read_input(destination, mcnp_version: tuple[int] = (6, 3, 0), replace: bool = True, multi_proc: bool = False, num_processes: int = None)#

Reads the specified MCNP Input file.

The MCNP version must be a three component tuple e.g., (6, 2, 0) and (5, 1, 60).

Notes

if a stream is provided. It will not be closed by this function.

Warning

If multi_proc=True is used on Windows extra care is needed. The entry point of the script needs to be import safe. See How to use multi-processing with Windows for more details.

Parameters:
  • destination (io.TextIOBase, str, os.PathLike) – the path to the input file to read, or a readable stream.

  • mcnp_version (tuple) – The version of MCNP that the input is intended for.

  • replace (bool) – replace all non-ASCII characters with a space (0x20)

  • multi_proc (bool) – If true multiprocessing will be used to speed up the parsing process, otherwise serial parsing is used.

  • num_processes (int) – The number of python processes to start for parsing. If None the number of CPU cores will be used.

Returns:

The MCNP_Problem instance representing this file.

Return type:

MCNP_Problem

Raises: