montepy.Library#

class montepy.Library(library: str)#

Bases: SingletonGroup

A class to represent an MCNP nuclear data library, e.g., 80c.

Examples

import montepy
library = montepy.Library("710nc")
assert library.library == "710nc"
assert str(library) == "710nc"
assert library.library_type == montepy.LibraryType.NEUTRON
assert library.number == 710
assert library.suffix == "c"

Note

This class is immutable, and hashable, meaning it is suitable as a dictionary key.

Added in version 1.0.0.

Parameters:

library (str) – The name of the library.

Raises:
  • TypeError – if a string is not provided.

  • ValueError – if a valid library is not provided.

Attributes:

library

The full name of the library.

library_type

The LibraryType of this library.

number

The base number in the library.

suffix

The suffix of the library, or the final character of its definition.

property library: str#

The full name of the library.

Return type:

str

property library_type: LibraryType#

The LibraryType of this library.

This corresponds to the type of library this would specified in a material definition e.g., NLIB, PLIB, etc.

Returns:

the type of library this library is.

Return type:

LibraryType

property number: int#

The base number in the library.

For example: this would be 80 for the library: Library('80c').

Returns:

the base number of the library.

Return type:

int

property suffix: str#

The suffix of the library, or the final character of its definition.

For example this would be "c" for the library: Library('80c').

Returns:

the suffix of the library.

Return type:

str