### Install from Release Source Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install serpentTools using the setup script after downloading and extracting the source code. ```bash $ python setup.py install ``` -------------------------------- ### Test Installation from Release Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Run the test suite to verify a successful installation from a release. ```bash $ python setup.py test ``` -------------------------------- ### Read Example Data Files Source: https://serpent-tools.readthedocs.io/en/latest/_sources/changelog.rst.txt Import test and example files using `serpentTools.data.readDataFile`. ```python from serpentTools.data import readDataFile ``` -------------------------------- ### Install NumPy on Ubuntu Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install the NumPy package on Ubuntu using apt-get. ```bash # ubuntu $ sudo apt-get install python-numpy ``` -------------------------------- ### Read Detector File Example Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.data.readDataFile.html Obtain a detector file from the examples directory using readDataFile. This function is useful for accessing example or test data files within the serpentTools library. ```python >>> import serpentTools >>> d = serpentTools.readDataFile('bwr_det0.m') >>> d.detectors.keys() dict_keys(['spectrum', 'xymesh']) ``` -------------------------------- ### Install serpentTools with Pip Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install the latest stable version of serpentTools and upgrade pip. ```bash $ python -m pip install --user --upgrade pip serpentTools ``` -------------------------------- ### Install NumPy with Pip Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install or upgrade NumPy using pip. ```bash # pip $ sudo pip install --upgrade numpy ``` -------------------------------- ### Reusable Reader Example Source: https://serpent-tools.readthedocs.io/en/latest/develop/datamodel.html Demonstrates how a reusable reader can parse multiple files sequentially. ```python >>> r = DemoReader() >>> f0 = r.read(examplefile0) >>> f1 = r.read(examplefile1) ``` -------------------------------- ### Start Python Interpreter Source: https://serpent-tools.readthedocs.io/en/latest/install.html Launch an interactive Python interpreter session in the terminal. ```bash $ python ``` -------------------------------- ### Install Development Branch with Pip Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install the development version of serpentTools directly from its Git repository. ```bash $ python -m pip install -e git+https://www.github.com/CORE-GATECH-GROUP/serpent-tools.git@develop#egg=serpentTools ``` -------------------------------- ### x Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets the X grid. ```APIDOC ## x Property ### Description X grid. ### Type numpy.ndarray or None ``` -------------------------------- ### Basic YAML Configuration Source: https://serpent-tools.readthedocs.io/en/latest/examples/Settings.html Settings can be updated from a YAML file. Keys are setting names and values are the desired settings. This example shows basic key-value pairs. ```yaml verbosity: warning xs.getInfXS: False ``` -------------------------------- ### Reusable Reader Example Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/datamodel.rst.txt Illustrates how a reader can be instantiated and used to read multiple files, potentially saving time if filtering is applied consistently. ```python r = DemoReader() f0 = r.read(examplefile0) f1 = r.read(examplefile1) ``` -------------------------------- ### Install Dependencies with Conda Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Use this command to install setuptools, numpy, matplotlib, and pyyaml using the Conda package manager. This is a common method for managing scientific Python packages. ```bash conda install setuptools numpy matplotlib pyyaml ``` -------------------------------- ### Install packages with Conda Source: https://serpent-tools.readthedocs.io/en/latest/install.html Install essential packages like setuptools, numpy, matplotlib, and pyyaml using the conda package manager within an Anaconda Prompt. ```bash $ conda install setuptools numpy matplotlib pyyaml ``` -------------------------------- ### Python Docstring Example (Numpydoc Style) Source: https://serpent-tools.readthedocs.io/en/latest/develop/documentation.html Illustrates the structure of a numpydoc-style docstring for Python functions, including parameters, returns, and descriptions. ```python def foo(a, b=None): """Simple one line docstring Parameters ---------- a : float Some value b : bool, optional A flag Returns ------- returnType Description of the return type """ ``` -------------------------------- ### Access Flux Ratio Universes Source: https://serpent-tools.readthedocs.io/en/latest/examples/MicroXSReader.html Retrieve the keys representing universes for which flux ratios are available. This example shows how to print the universe keys. ```python # obtain the universes >>> print(mdx.fluxRatio.keys()) dict_keys(['0']) ``` -------------------------------- ### Configure Basic Logging Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/logging.rst.txt Configure the Python logging system with a basic format to display messages. This setup allows for immediate viewing of log output. ```python >>> import logging >>> logging.basicConfig(format="%(levelname)-s: %(message)-s") # Display a basic warning >>> logging.warning("This is a warning") WARNING: This is a warning ``` -------------------------------- ### serpentTools.data.getFile Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.data.getFile.html Retrieves the path to a reference or example data file. This function relies on the SERPENT_TOOLS_DATA environment variable to locate the data files. ```APIDOC ## serpentTools.data.getFile ### Description Retrieve the path to one of the reference or example files. Relies on the environment variable `SERPENT_TOOLS_DATA` to find the data files. ### Parameters #### Path Parameters - **path** (str) - Required - The name of the file without any additional directory information. ### Returns Path to a data file that can be read with one of the readers or with `serpentTools.read()`. ### Return Type str ### Raises - **IOError** - If no match for `path` exists. ``` -------------------------------- ### Data Structure Example for DepletionReader Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/old-data-model.rst.txt Illustrates the hierarchical data structure typically stored by the DepletionReader, focusing on material objects and their properties. ```text Reader | - filePath | - fileMetadata | - isotope names | - isotope ZAIs | - depletion schedule in days and burnup | - materials # for each material: | - DepletedMaterial-n | - name | - atomic density | - mass density | - volume | etc ``` -------------------------------- ### Define File Class with Class Method Source: https://serpent-tools.readthedocs.io/en/latest/develop/datamodel.html Example of a file class emulating previous reader behavior using a class method to parse files. ```python class DemoFile: @classmethod def fromSerpent(cls, fp, *args, **kwargs): # process # return an instance of DemoFile or cls() ``` -------------------------------- ### Configure and Expand Variables Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/Settings.rst.txt Set specific variables for group constants and extras, then use expandVariables() to get the full list of variables based on the SERPENT version. ```python rc['serpentVersion'] >>> rc['xs.variableGroups'] = ['kinetics', 'xs', 'diffusion'] >>> rc['xs.variableExtras'] = ['XS_DATA_FILE_PATH'] >>> varSet = rc.expandVariables() >>> print(sorted(varSet)) ``` -------------------------------- ### Python Code Block with IPython Lexer Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/documentation.rst.txt Example of a Python code block using the 'ipython3' lexer, typically generated by nbconvert. This may require specific lexer installation for rendering. ```rst .. code:: ipython3 print('hello world!') .. parsed-literal:: hello world! ``` -------------------------------- ### Load and Access Simulation Results Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.ResultsReader.html Load simulation results from a .mat file and access specific data arrays using their original variable names. This example demonstrates accessing 'ABS_KEFF', 'INF_KINF', and 'INF_TOT'. Requires SciPy to be installed. ```python >>> r.toMatlab('pwr_res.mat', True) >>> loaded = loadmat('pwr_res.mat') >>> loaded['ABS_KEFF'] array([[0.991938, 0.00145 ], [0.181729, 0.0024 ]]) >>> kinf = loaded['INF_KINF'] >>> kinf.shape (2, 1, 1, 2) >>> kinf[:, 0, 0, 0] array([0.993385, 0.181451]) >>> tot = loaded['INF_TOT'] >>> tot.shape (2, 1, 2, 2) >>> tot[:, 0, :, 0] array([[0.496553, 1.21388 ], [0.481875, 1.30993 ]]) >>> loaded['UNIVERSES'] array([0]) ``` -------------------------------- ### Instantiate and Document Nodal Writer Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/BranchToNodalDiffusion.rst.txt Demonstrates how to import the `Writer` class and print its docstring to understand its parameters for initialization. ```python from nodal_writer import Writer print(Writer.__doc__.strip()) ``` -------------------------------- ### Check NumPy Installation Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Verify if NumPy is installed in your Python environment. ```bash $ python -c "import numpy" ``` -------------------------------- ### Initialize Detector Reader with Data Files Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/Detector.rst.txt Sets up paths to SERPENT detector data files. Ensure the SERPENT_TOOLS_DATA environment variable is set. ```python import os pinFile = os.path.join( os.environ["SERPENT_TOOLS_DATA"], "fuelPin_det0.m") bwrFile = os.path.join( os.environ["SERPENT_TOOLS_DATA"], "bwr_det0.m") ``` -------------------------------- ### MicroXSReader Class Initialization Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.MicroXSReader.html Initializes the MicroXSReader with the path to the mdx file. ```APIDOC ## MicroXSReader(filePath) ### Description Parser responsible for reading and working with micro-xs (mdx) files. ### Parameters * **filePath** (_str_) – path to the `*mdx[n].m` file ``` -------------------------------- ### Creating and Accessing UnivTuple Properties Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.objects.UnivTuple.html Demonstrates how to create a UnivTuple instance and access its properties using attribute names and positional indexing. Attribute access is recommended for stability. ```python >>> x = UnivTuple("0", 0.1, 1, 10.0) >>> x.universe "0" >>> x[0] == x.universe True ``` -------------------------------- ### Initialize MicroXSReader Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/MicroXSReader.rst.txt Instantiate the MicroXSReader by passing the path to the micro depletion file to the serpentTools.read() function. ```python import serpentTools mdx = serpentTools.read(mdxFile) ``` -------------------------------- ### Local Documentation Build Command Source: https://serpent-tools.readthedocs.io/en/latest/develop/documentation.html Command to clean and build HTML documentation locally. ```bash $ make clean html ``` -------------------------------- ### Install Packages with Conda Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Install desired Python packages using conda within the Anaconda Prompt. ```bash conda install numpy ``` -------------------------------- ### Initialize DepletionReader Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/DepletionReader.rst.txt Import the serpentTools library and read a depletion file. Ensure the SERPENT_TOOLS_DATA environment variable is set to the directory containing the demo data. ```python >>> import os >>> depFile = os.path.join( ... os.environ["SERPENT_TOOLS_DATA"], ... "demo_dep.m") ``` ```python >>> import serpentTools >>> dep = serpentTools.read(depFile) ``` -------------------------------- ### BranchContainer Methods Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.objects.BranchContainer.html Provides access to various dictionary-like methods for managing branch data, including checking for items, getting items by key, iterating, and getting the length. ```APIDOC ## BranchContainer Dictionary-like Methods ### `__contains__(self)` True if D has a key k, else False. ### `__getitem__(self, key)` x.__getitem__(y) <==> x[y] ### `__iter__(self)` Implement iter(self). ### `__len__(self)` Return len(self). ### `__setitem__(self, key, value)` Set self[key] to value. ``` -------------------------------- ### serpentTools to-matlab subcommand help Source: https://serpent-tools.readthedocs.io/en/latest/command-line.html Display help for the 'to-matlab' subcommand, used to convert text SERPENT output files to binary .mat files. This functionality relies on scipy. ```bash $ serpentTools to-matlab -h usage: serpentTools to-matlab [-h] [-o OUTPUT] [-a] [--format {4,5}] [-l] [--large] [--oned {col,row}] file positional arguments: file output file to read and convert optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT Name of output file to write. If not given, replace extension with .mat -a, --append Append to existing file if found. Otherwise overwrite. Default: False --format {4,5} Format of file to write. 4 for MATLAB 4, 5 for MATLAB 5+. Default: 5 -l, --longNames Allow variable names up to 63 characters. Otherwise, enforce 31 character names. Default: False --large Don't compress arrays when writing. --oned {col,row} Write 1D arrays are row or column vectors ``` -------------------------------- ### y Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets the Y grid. ```APIDOC ## y Property ### Description Y grid. ### Type numpy.ndarray or None ``` -------------------------------- ### Accessing Group Constant Data with get() Source: https://serpent-tools.readthedocs.io/en/latest/examples/Branching.html Retrieve specific group constant data, such as 'infFiss', using the get() method of a HomogUniv object. Demonstrates handling potential KeyErrors when uncertainties are not present for a given variable. ```python >>> univ0.get('infFiss') array([ 0.00271604, 0.059773 ]) >>> try: ... univ0.get('infS0', uncertainty=True) >>> except KeyError as ke: # no uncertainties here ... print(str(ke)) 'Variable infS0 absent from uncertainty dictionary' ``` -------------------------------- ### z Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets the Z grid. ```APIDOC ## z Property ### Description Z grid. ### Type numpy.ndarray or None ``` -------------------------------- ### Import necessary libraries and set data path Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/MicroXSReader.rst.txt Before using the MicroXSReader, ensure the SERPENT_TOOLS_DATA environment variable is set and import the os module to construct the file path. ```python import os mdxFile = os.path.join( os.environ["SERPENT_TOOLS_DATA"], "ref_mdx0.m") ``` -------------------------------- ### name Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets the name of this detector. ```APIDOC ## name Property ### Description Name of this detector. ### Type str ``` -------------------------------- ### Accessing Depletion Matrix Files Source: https://serpent-tools.readthedocs.io/en/latest/examples/DepletionMatrix.html Demonstrates how to construct the file path for a depletion matrix file using environment variables and the os.path.join function. Ensure the SERPENT_TOOLS_DATA environment variable is set. ```python import os >>> mtxFile = os.path.join( ... os.environ["SERPENT_TOOLS_DATA"], ... "depmtx_ref.m") ``` -------------------------------- ### Class Method for File Creation Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/datamodel.rst.txt Demonstrates how a class method can be used to parse a file and return an instance of the file class. This pattern helps reduce partially instantiated readers. ```python class DemoFile: @classmethod def fromSerpent(cls, fp, *args, **kwargs): # process # return an instance of DemoFile or cls() ``` -------------------------------- ### get Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.ResultsReader.html Retrieve an item from the results data or a default value if the item is not found. ```APIDOC ## get ### Description Retrieve an item from `resdata` or `default`. ### Parameters * **key** (str) - `mixedCase` variable name that may or may not exist in `resdata` * **default** (optional) - Object to be returned in `key` is not found ### Returns `numpy.ndarray` if `key` is found. Otherwise `default` is returned ### Return type object ``` -------------------------------- ### Import and Use New Module Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/datamodel.rst.txt Demonstrates how to import and use the new 'serpentTools.next' module for reading files. This approach is intended for the new module which will remain detached from the main API. ```python >>> import serpentTools.next >>> r0 = serpentTools.next.read(filep) ``` -------------------------------- ### Loading YAML Configuration and Accessing Settings Source: https://serpent-tools.readthedocs.io/en/latest/examples/Settings.html Demonstrates loading a YAML configuration file into serpentTools settings and accessing a specific setting. Ensure the YAML file exists and is correctly formatted. ```yaml %cat myConfig.yaml xs.getInfXS: False xs.getB1XS: True xs.variableGroups: [gc-meta, kinetics, xs] branching: floatVariables: [Fhi, Blo] depletion: materials: [fuel*] metadataKeys: [NAMES, BU] materialVariables: [ADENS, MDENS, VOLUME] serpentVersion: 2.1.29 ``` ```python myConf = 'myConfig.yaml' rc.loadYaml(myConf) ``` ```python rc['xs.getInfXS'] ``` -------------------------------- ### get Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.objects.DepletedMaterial.html Retrieves a value from the data dictionary, returning a default value if the key is not found. ```APIDOC ## get Method ### Description Retrieve a value from the dictionary, or default if not found. ### Parameters * **key** (_str_) – Name of a quantity that may or may not exist in `data` * **default** (_object_ _,__optional_) – Item to return if `key` is not found ### Returns `numpy.ndarray` if `key` was found, otherwise `default`. ``` -------------------------------- ### Import and Load Results File Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/ResultsReader.rst.txt Import necessary libraries and load a Serpent results file. Ensure the SERPENT_TOOLS_DATA environment variable is set. ```python import os resFile = os.path.join( os.environ["SERPENT_TOOLS_DATA"], "InnerAssembly_res.m") ``` ```python import numpy as np import serpentTools res = serpentTools.read(resFile) ``` -------------------------------- ### get Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.objects.HomogUniv.html Retrieves the value of a specified variable from the homogenized data, optionally including its uncertainty. ```APIDOC ## get(variableName, uncertainty=False) ### Description Gets the value of the variable `variableName` from the dictionaries. ### Parameters #### Path Parameters - **variableName** (str) - Variable Name - **uncertainty** (bool, optional) - Boolean Variable; set to True in order to retrieve the uncertainty associated to the expected values ### Returns - **x** - Variable Value - **dx** - Associated uncertainty if `uncertainty` is True ### Raises - **TypeError** - If the uncertainty flag is not boolean - **KeyError** - If the variable requested is not stored on the object ``` -------------------------------- ### Accessing Universe Data with BranchingReader Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/Branching.rst.txt Demonstrates retrieving universe data and accessing its expansion information. Ensure the BranchingReader is initialized and the universe is accessible. ```python >>> univ4 = b1.getUniv("0", 0) >>> univ4.infExp {'infTot': array([ 0.313338, 0.54515 ])} >>> univ4.b1Exp {} ``` -------------------------------- ### MatlabConverter.checkImports Method Source: https://serpent-tools.readthedocs.io/en/latest/develop/converter.html Ensures that scipy version 1.0 or greater is installed, which is a requirement for MATLAB conversion. ```python def checkImports(self): try: import scipy if scipy.__version__ < '1.0': return False except ImportError: return False return True ``` -------------------------------- ### Navigate to Release Directory Source: https://serpent-tools.readthedocs.io/en/latest/_sources/install.rst.txt Change the current directory to the extracted release folder. ```bash $ cd path/to/release ``` -------------------------------- ### RST Code Block Example (Default) Source: https://serpent-tools.readthedocs.io/en/latest/develop/documentation.html Shows the standard reStructuredText code block directive. ```rst .. code:: print('hello world!') .. parsed-literal:: hello world! ``` -------------------------------- ### Get Group Cross-Sections Source: https://serpent-tools.readthedocs.io/en/latest/examples/MicroXSReader.html Obtain group-wise cross-sections and their uncertainties for a specified universe, isotope, and reaction. ```python >>> # Obtain the group cross-sections >>> vals, unc = mdx.getXS(universe='0', isotope=10010, reaction=102) >>> # Print group flux values >>> print(vals) [ 3.09753000e-05 3.33901000e-05 3.57054000e-05 3.70926000e-05 3.61049000e-05 3.39464000e-05 3.39767000e-05 3.98315000e-05 5.38962000e-05 7.96923000e-05 1.18509000e-04 1.73915000e-04 2.54571000e-04 3.38540000e-04 4.52415000e-04 5.98190000e-04 7.69483000e-04 1.04855000e-03 1.31149000e-03 1.67790000e-03 2.15195000e-03 2.70125000e-03 3.44635000e-03 5.04611000e-03] >>> # Print group flux uncertainties values >>> print(unc) [ 1.10000000e-04 2.00000000e-05 1.00000000e-05 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00000000e-05 1.00000000e-05 2.00000000e-05 2.00000000e-05 2.00000000e-05 2.00000000e-05 1.00000000e-05 1.00000000e-05 2.00000000e-05 2.00000000e-05 3.00000000e-05 2.00000000e-05 3.00000000e-05 4.00000000e-05 5.00000000e-05 1.70000000e-04 6.90000000e-04] ``` -------------------------------- ### Initialize and Reshape Detector Bins Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CylindricalDetector.html Demonstrates creating a Detector with custom bins and reshaping them. This is useful for organizing tally data into a more manageable format for analysis. ```python import numpy from serpentTools import Detector bins = numpy.ones((2, 12)) bins[1, 0] = 2 bins[1, 4] = 2 bins[:, -2:] = [ [5.0, 0.1], [10.0, 0.2]] det = Detector("reshape", bins=bins) tallies, errors, indexes = det.reshapedBins() tallies errors indexes ``` -------------------------------- ### Get SerpentTools Logger Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/logging.rst.txt Obtain the primary internal logger for serpentTools. This logger is named 'serpentTools'. ```python >>> import logging >>> logging.getLogger("serpentTools") ``` -------------------------------- ### serpentTools.data.readDataFile Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.data.readDataFile.html Reads a data file from the serpentTools examples or test directory. All keyword arguments are passed to serpentTools.read(). ```APIDOC ## serpentTools.data.readDataFile ### Description Returns a reader for the data file (test or example) file. All additional keyword arguments will be passed to `serpentTools.read()`. ### Parameters #### Path Parameters - **path** (str) - Required - The name of the file without any additional directory information #### Keyword Arguments All additional keyword arguments will be passed to `serpentTools.read()`. ### Returns - **object** - The reader that has processed this file and stored all the data ### Raises - **IOError:** - If the file for `path` does not exist ### Example ```python >>> import serpentTools >>> d = serpentTools.readDataFile('bwr_det0.m') >>> d.detectors.keys() dict_keys(['spectrum', 'xymesh']) ``` ### See Also - `serpentTools.read()` ``` -------------------------------- ### Compute Detector Data Difference Source: https://serpent-tools.readthedocs.io/en/latest/develop/datamodel.html Example of computing the difference between two detector objects using subtraction. ```python >>> diff = det0 - det1 ``` -------------------------------- ### Initialize DepletionReader with Data Path Source: https://serpent-tools.readthedocs.io/en/latest/examples/DepletionReader.html Sets the environment variable for Serpent data files and constructs the path to the demo depletion file. ```python import os >>> depFile = os.path.join( ... os.environ["SERPENT_TOOLS_DATA"], ... "demo_dep.m") ``` -------------------------------- ### indexes Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets a dictionary mapping bin names to their corresponding axes in `tallies` and `errors`. ```APIDOC ## indexes Property ### Description Dictionary mapping the bin name to its corresponding axis in `tallies` and `errors`, e.g. `{"energy": 0}`. ### Type dict ``` -------------------------------- ### get(key, default=None) Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.XSPlotReader.html Retrieves a value from xsections by key, returning a default value if the key is not found. ```APIDOC ## get(key, default=None) ### Description Return the value of `key` from `xsections` or `default` ### Parameters * **key** (str) - Name of isotope or material that may or may not exist in `xsections` * **default** (object) - Item to return if `key` not found ### Returns `XSData` that corresponds to `key` if `key` is found. Otherwise return `default` ``` -------------------------------- ### Instantiate MicroXSReader Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.MicroXSReader.html Create an instance of MicroXSReader by providing the path to the mdx file. This reader is used for accessing and processing microscopic cross-section data. ```python reader = MicroXSReader("path/to/your/file.mdx") ``` -------------------------------- ### Direct __init__ Call for Parent Class Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/codestyle.rst.txt Shows how to directly call the __init__ method of a parent class when initializing a subclass. ```python class MyQueue(list): def __init__(self, items): list.__init__(self) self.extend(items) ``` -------------------------------- ### Scale Detector Data Source: https://serpent-tools.readthedocs.io/en/latest/develop/datamodel.html Example of scaling detector data by dividing by a factor, e.g., converting Watts to Megawatts. ```python >>> det /= 1E6 ``` -------------------------------- ### Get Dictionary Overlaps Source: https://serpent-tools.readthedocs.io/en/latest/_sources/develop/comparisons.rst.txt Calculates the overlaps between dictionaries, likely referring to common keys or values. Part of `serpentTools.utils.compare`. ```python from serpentTools.utils.compare import getOverlaps ``` -------------------------------- ### Import serpentTools Settings Source: https://serpent-tools.readthedocs.io/en/latest/_sources/examples/Settings.rst.txt Import the necessary serpentTools package and the rc object for accessing settings. ```python import serpentTools from serpentTools.settings import rc ``` -------------------------------- ### RST Code Block Example (IPython) Source: https://serpent-tools.readthedocs.io/en/latest/develop/documentation.html Demonstrates the reStructuredText code block directive for IPython, which may not render on ReadTheDocs. ```rst .. code:: ipython3 print('hello world!') .. parsed-literal:: hello world! ``` -------------------------------- ### Import SerpentTools Readers and Samplers Source: https://serpent-tools.readthedocs.io/en/latest/_sources/changelog.rst.txt Import core readers and samplers directly from the main `serpentTools` package. ```python from serpentTools import ResultsReader from serpentTools import DetectorSampler ``` -------------------------------- ### errors Property Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.CartesianDetector.html Gets or sets the reshaped error data, representing relative errors as they would appear in the output file. ```APIDOC ## errors Property ### Description Reshaped error data such that each dimension corresponds to a unique bin, such as energy or spatial bin. Note: this is a relative error as it would appear in the output file. ### Type numpy.ndarray or None ``` -------------------------------- ### SensitivityReader Initialization Source: https://serpent-tools.readthedocs.io/en/latest/generated/serpentTools.SensitivityReader.html Initialize a SensitivityReader object by providing the path to the sensitivity file. ```APIDOC ## SensitivityReader(filePath) ### Description Initializes a SensitivityReader object to read sensitivity data from a specified file. ### Parameters * **filePath** (str) - Required - Path to the sensitivity file. ```