scale.olm.internal

This scale.olm.internal module contains functions called from the click-based command line interface. This is so __main__ contains little logic. There should be no click dependence here–it should all be in __main__.


check(archive_file: str, output_file: str, text_sequence: list[str], nprocs: int)[source]

Run a sequence of checks on ORIGEN archives.

Parameters:
  • archive_file – Input archive file to check.

  • output_file – Output file to write test results.

  • text_sequence – List of strings, each one the JSON string of a test.

  • nprocs – Number of simultaneous processes to use.

copy_doc(copy_func: Callable[[...], Any]) Callable[[Callable[[P], T]], Callable[[P], T]][source]

Prepends the docstring from another function. This function is intended to be used as a decorator.

Parameters:

copy_func (Callable[..., Any]) – The function whose docstring should be copied.

Returns:

The decorator function.

Return type:

Callable[[Callable[P, T]], Callable[P, T]]

Examples

Define a function with a docstring.

>>> def some():
...    '''This is a some doc string'''
...    return None

Copy some docstring to pig function.

>>> @copy_doc(some)
... def pig():
...    return None
>>> pig.__doc__
'This is a some doc string'
create(config_file: str, generate: bool, run: bool, assemble: bool, check: bool, report: bool, nprocs: int)[source]

Create ORIGEN reactor libraries!

The create command manages an entire ORIGEN reactor library creation sequence which goes through these stages.

  1. generate the various inputs that cover the desired input space

  2. run the inputs with SCALE and generate individual libraries for each point in space

  3. assemble the individual libraries into an ORIGEN reactor library that can interpolate throughout the space

  4. check the quality of the ORIGEN reactor library

  5. report the entire creation process in HTML or PDF

The linchpin of the process is a configuration file which must always be passed to the command. This file defines the input for each stage in JSON format.

See config.olm.json for details.

Parameters:
  • config_dir – Directory where configuration files should be written.

  • generate – Whether to generate.

  • run – Whether to run.

  • assemble – Whether to assemble.

  • check – Whether to check.

  • report – Whether to report.

  • nprocs – Number of processess to use.

init(config_dir: str, variant: str, list_: bool)[source]

Initialize a new ORIGEN reactor library configuration. f :param config_dir: Directory where configuration files should be written. :param variant: Initialization variant to write. :param list_: Just list available variants.

install(work_dir: str, dest: str, overwrite: bool = False, dry_run: bool = False)[source]

Install ORIGEN reactor libraries!

After creating a new ORIGEN reactor library, this command installs it to a dest on the file system. After this, the work directory can be deleted.

Parameters:
  • work_dir – Directory where ORIGEN library files are.

  • dest – Destination directory to install the reactor libraries.

  • overwrite – Overwrite at the destination.

  • dry_run – Do not move any files.

Link custom ORIGEN reactor libraries to a SCALE calculation.

Parameters:
  • names – Names of libraries to link.

  • paths – List of paths to prepend to SCALE_OLM_PATH.

  • env – Whether to use the environment or not.

  • dest – Destination directory to link the reactor libraries.

  • show – Just show the available libraries.

  • overwrite – Overwrite at the destination.

  • dry_run – Do not move any files.

run_command(command_line: str, check_return_code: bool = True, echo: bool = True, error_match: str = 'Error')[source]

Run a command as a subprocess.

Throw on bad error code or finding the error_match string in the output.

Parameters:
  • command_line – Command line to run.

  • check_return_code – Whether to check the return code.

  • echo – Whether to echo STDOUT and STDERR.

  • error_match – String to match to decide if there are errors.

schema(_type: str, color: bool, description: bool = False, infer: bool = False, state: bool = False)[source]

Emit the JSON schema corresponding to a particular _type.