<commit_before>.. |getUniv| replace:: :meth:`~serpentTools.ResultsReader.getUniv`
.. |resdata| replace:: :attr:`~serpentTools.ResultsReader.resdata`
.. |metadata| replace:: :attr:`~serpentTools.ResultsReader.metadata`
.. |universes| replace:: :attr:`~serpentTools.ResultsReader.universes`

.. _ex-results:

==============
Results Reader
==============

Basic operations
----------------

This notebook demonstrates the capabilities of the serpentTools to read
Serpent results files. SERPENT [serpent]_ produces a result file (i.e.
``_res.m``), containing general results (e.g. ``k-eff``), metadata (e.g.
``title``) and homogenized cross-sections. The homogenized cross-section
sets are printed in the results file for all the requested universes.
The |ResultsReader| is capable of reading this file, and storing the data
inside |HomogUniv| objects. Each such object has methods and attributes that
should ease the analyses.

.. note::

   The preferred way to read your own output files is with the
   |read-full| function. The |readData| function is used here
   to make it easier to reproduce the examples


.. code:: 
    
    >>> import numpy as np
    >>> import serpentTools
    >>> from serpentTools.settings import rc
    >>> rc['serpentVersion'] = '2.1.30'

    >>> resFile = 'InnerAssembly_res.m'
    >>> res = serpentTools.readDataFile(resFile)

Metadata
========

|metadata| is a collective data that describes the problem. The
following data is included: titles, data paths, and other descriptive
data exist on the reader

.. code:: 

    >>> print(res.metadata['version'])  # Serpent version used for the execution
    Serpent 2.1.30
    >>> print(res.metadata['decayDataFilePath'])  # Directory path for data libraries
    /nv/hp22/dkotlyar6/data/Codes/DATA/endfb7/sss_endfb7.dec
    >>> print(res.metadata['inputFileName'])  # Directory path for data libraries
    InnerAssembly
    
Obtain all the variables in the metadata via ``.keys()``

.. code:: 

    >>> res.metadata.keys()
    dict_keys(['version', 'compileDate', 'debug', 'title', 'confidentialData',
    'inputFileName', 'workingDirectory', 'hostname', 'cpuType', 'cpuMhz',<commit_msg>DOC Update ResultsReader example w/ new serpent version<commit_after>.. |getUniv| replace:: :meth:`~serpentTools.ResultsReader.getUniv`
.. |resdata| replace:: :attr:`~serpentTools.ResultsReader.resdata`
.. |metadata| replace:: :attr:`~serpentTools.ResultsReader.metadata`
.. |universes| replace:: :attr:`~serpentTools.ResultsReader.universes`

.. _ex-results:

==============
Results Reader
==============

Basic operations
----------------

This notebook demonstrates the capabilities of the serpentTools to read
Serpent results files. SERPENT [serpent]_ produces a result file (i.e.
``_res.m``), containing general results (e.g. ``k-eff``), metadata (e.g.
``title``) and homogenized cross-sections. The homogenized cross-section
sets are printed in the results file for all the requested universes.
The |ResultsReader| is capable of reading this file, and storing the data
inside |HomogUniv| objects. Each such object has methods and attributes that
should ease the analyses.

.. note::

   The preferred way to read your own output files is with the
   |read-full| function. The |readData| function is used here
   to make it easier to reproduce the examples


.. code:: 
    
    >>> import numpy as np
    >>> import serpentTools
    >>> from serpentTools.settings import rc

    >>> resFile = 'InnerAssembly_res.m'
    >>> res = serpentTools.readDataFile(resFile)

Metadata
========

|metadata| is a collective data that describes the problem. The
following data is included: titles, data paths, and other descriptive
data exist on the reader

.. code:: 

    >>> print(res.metadata['version'])  # Serpent version used for the execution
    Serpent 2.1.30
    >>> print(res.metadata['decayDataFilePath'])  # Directory path for data libraries
    /nv/hp22/dkotlyar6/data/Codes/DATA/endfb7/sss_endfb7.dec
    >>> print(res.metadata['inputFileName'])  # Directory path for data libraries
    InnerAssembly
    
Obtain all the variables in the metadata via ``.keys()``

.. code:: 

    >>> res.metadata.keys()
    dict_keys(['version', 'compileDate', 'debug', 'title', 'confidentialData',
    'inputFileName', 'workingDirectory', 'hostname', 'cpuType', 'cpuMhz',
{'fraction_non_alphanumeric': 0.1393897364771151, 'fraction_numerical': 0.005085529357374018, 'mean_word_length': 4.169653524492234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5262928', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1210, 'n_words': 422}