Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c72e0aa
Enforced unique surface types.
MicahGale Jan 14, 2024
a502033
Added tallies object.
MicahGale Jan 14, 2024
8fbe84e
Listed tally types allowed.
MicahGale Jan 14, 2024
7d26ebd
Started parsing tally objects.
MicahGale Jan 14, 2024
2bb0cce
Flattened tally specification data structure for parsing.
MicahGale Jan 14, 2024
8a38f16
keep parens as valueNode not PaddingNode.
MicahGale Jan 14, 2024
94d0217
Started group parsing mechanism
MicahGale Jan 14, 2024
d98e63e
Implemented append for tally groups.
MicahGale Jan 15, 2024
8c652ca
Made tally appendable.
MicahGale Jan 15, 2024
42cca61
Added particle type to test to be accurate.
MicahGale Jan 16, 2024
751dac4
Merge branch 'develop' into tallies
MicahGale Jan 17, 2024
38e97c4
Moved to dev version.
MicahGale Jan 17, 2024
0c15319
Merge branch 'develop' into tallies
MicahGale Jun 12, 2024
ba7db74
Merge branch 'develop' into tallies
MicahGale Jul 1, 2024
c94c7f4
Merge branch 'develop' into tallies
MicahGale Jul 23, 2024
c03132a
fixed circular import error.
MicahGale Jul 23, 2024
bcaedef
Merge branch 'develop' into tallies
MicahGale Aug 17, 2024
fed2127
Merge branch 'develop' into tallies
MicahGale Sep 10, 2024
4b95c78
Merge branch 'develop' into tallies
MicahGale Nov 2, 2024
0c761d3
Merge branch 'develop' into tallies
MicahGale Jul 5, 2025
fd223f5
Merge branch 'develop' into tallies
MicahGale Apr 3, 2026
5efa86e
Claude: added tally test input file.
MicahGale Apr 3, 2026
3761507
Claude: tried to cover all syntax edge cases.
MicahGale Jun 12, 2026
8f72685
Merge branch 'jit_parse' into tallies
MicahGale Jun 12, 2026
1a2b626
Add TallyLexer with bracket literals for lattice index syntax
MicahGale Jun 12, 2026
48fb9fa
Extend TallyParser to handle universe path and lattice syntax
MicahGale Jun 12, 2026
4707349
Fix jit_parse integration so TallyParser is actually invoked
MicahGale Jun 12, 2026
6f3a1f1
Add tests for TallyParser path and lattice syntax
MicahGale Jun 12, 2026
513aee9
Implement Tally object hierarchy for MCNP F-card tallies
MicahGale Jun 13, 2026
b47ed45
Merge branch 'beta-test' into tallies
MicahGale Jul 31, 2026
cec9730
Claude: add more complicated FM tally syntax.
MicahGale Jul 31, 2026
4182b82
Claude: add Tally.clone_as, and shallow scores/filters attributes.
MicahGale Jul 31, 2026
b5b5fe2
Claude: align Tally with jit_parsing and type_enforcement devguides.
MicahGale Jul 31, 2026
f11afe1
Claude: fix tally grammar gaps for FM reaction operators and cumulati…
MicahGale Aug 1, 2026
9fc4895
Claude: implement TallyMultiplier (FM card) object model.
MicahGale Aug 1, 2026
889ced7
Add support for beta test.
MicahGale Aug 5, 2026
b77de62
Escaped strings to make yaml valid.
MicahGale Aug 7, 2026
ba928ab
Claude: remove unreachable code in Tally.from_input/clone_as and Tall…
MicahGale Aug 14, 2026
deb4c33
Claude: fix Tally.__contains__ to force a full parse instead of silen…
MicahGale Aug 14, 2026
97d0cef
Claude: add tests closing coverage gaps in the Tally/TallyMultiplier …
MicahGale Aug 14, 2026
c19ed45
Apply black formatting to tally_multiplier.py and mcnp_problem.py.
MicahGale Aug 14, 2026
1c13683
Claude: merge ReactionNumber into Reaction as class attributes.
MicahGale Aug 15, 2026
d7e1c22
Claude: export Tally/TallyMultiplier object model at top level and ad…
MicahGale Aug 15, 2026
c046015
Claude: add versionadded directives to all new tally classes.
MicahGale Aug 15, 2026
213151c
Claude: add changelog entry and versionadded tags to Cell.tallies/MCN…
MicahGale Aug 15, 2026
3d50943
Claude: fix CI doc-build failure and declutter Tallies API TOC.
MicahGale Aug 15, 2026
3888db1
Claude: purge "card" terminology and rewrite the tallies guide intro.
MicahGale Aug 20, 2026
03e74db
Claude: polish the tallies user guide and hide internal privates from…
MicahGale Aug 20, 2026
6504417
Claude: fix broken manual cross-reference in tallies guide
MicahGale Aug 20, 2026
6f6962c
Claude: add named Reaction constants for ENDF-6 and NJOY MT numbers
MicahGale Aug 20, 2026
aaf4b14
Claude: polish the tallies user guide and drop redundant changelog en…
MicahGale Aug 21, 2026
c0ec2fc
Claude: make ParticleFilter a thin wrapper around ParticleNode.
MicahGale Aug 21, 2026
2c261d3
Claude: disable the unreachable FILE_PATH token in TallyLexer and fix…
MicahGale Aug 21, 2026
6a37375
Claude: make Tally groups actually mutable and round-trip to the tree.
MicahGale Aug 22, 2026
ccf2bf4
Claude: make TallyMultiplier bins actually mutable and round-trip to …
MicahGale Aug 22, 2026
5126c2a
Claude: register TallyMultiplier cards in problem.data_inputs on appe…
MicahGale Aug 22, 2026
1a1bcad
Claude: cascade-delete orphaned FM cards and sync tally renumbers to …
MicahGale Aug 22, 2026
570c8c7
Claude: add include_total/cumulative setters, remove_cell/group/surfa…
MicahGale Aug 22, 2026
7645094
Claude: add verify_export/verify_prob_export test helpers and fix fro…
MicahGale Aug 22, 2026
620efd7
Claude: update tallies guide for real mutability and reorganize React…
MicahGale Aug 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI testing

on:
pull_request:
branches: ["*dev*", alpha-test*]
branches: ["*dev*", "*-test*"]
push:
branches: ["*dev*", main, alpha-test*]
branches: ["*dev*", "main", "*-test*"]

jobs:
build:
Expand Down
10 changes: 10 additions & 0 deletions doc/source/_templates/mytallyclass.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ objname }}
{{ underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
74 changes: 73 additions & 1 deletion doc/source/api/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Collections
montepy.CommentCollection
montepy.Materials
montepy.Surfaces
montepy.Tallies
montepy.Transforms
montepy.Universes

Expand Down Expand Up @@ -185,7 +186,78 @@ Materials
montepy.Nucleus
montepy.Nuclide
montepy.ThermalScatteringLaw




Tallies
^^^^^^^

Tally Objects
~~~~~~~~~~~~~

.. autosummary::
:toctree: generated
:nosignatures:
:template: mytallyclass.rst

montepy.Tally
montepy.SurfaceTally
montepy.CellTally
montepy.DetectorTally
montepy.SurfaceCurrentTally
montepy.SurfaceFluxTally
montepy.CellFluxTally
montepy.EnergyDepositionTally
montepy.FissionEnergyDepositionTally
montepy.EnergyDetectorPulseTally
montepy.TallyType
montepy.Score

Scoring Groups and Filters
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. note::

You will rarely create these directly, rather get them from
:attr:`montepy.Tally.groups` and :attr:`montepy.Tally.filters`.

.. autosummary::
:toctree: generated
:nosignatures:
:template: mytallyclass.rst

montepy.data_inputs.tally.TallyGroup
montepy.data_inputs.tally.FlatGroup
montepy.data_inputs.tally.PathGroup
montepy.data_inputs.tally.LatticeIndex
montepy.data_inputs.tally.Filter
montepy.data_inputs.tally.ParticleFilter
montepy.data_inputs.tally.SpatialFilter

Tally Multipliers
~~~~~~~~~~~~~~~~~

.. note::

You will rarely create the ``Multiplier*`` classes directly, rather get
them from :attr:`montepy.TallyMultiplier.bins`.

.. autosummary::
:toctree: generated
:nosignatures:
:template: mytallyclass.rst

montepy.TallyMultiplier
montepy.Reaction
montepy.data_inputs.tally_multiplier.ReactionExpression
montepy.data_inputs.tally_multiplier_type.ReactionOperator
montepy.MultiplierSet
montepy.SpecialMultiplierSet
montepy.SpecialMultiplier
montepy.AttenuatorLayer
montepy.AttenuatorSet
montepy.data_inputs.tally_multiplier.MultiplierScore
montepy.data_inputs.tally_multiplier.MultiplierBin


Cell Modifiers
Expand Down
8 changes: 8 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ MontePy Changelog
=============


#Next Version#
--------------

**Features Added**

* Added a :class:`~montepy.Tally`/:class:`~montepy.TallyMultiplier` object model for reading, creating, and editing MCNP tally (``F``) and tally multiplier (``FM``) inputs (:issue:`11`).


1.6.0b1
--------------

Expand Down
4 changes: 2 additions & 2 deletions doc/source/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Developer's Reference
=====================

MontePy can be thought of as having two layers: the syntax, and the semantic layers.
The syntax layers handle the boring syntax things: like multi-line cards, and comments, etc.
The semantic layer takes this information and makes sense of it, like what the material number in a cell card is.
The syntax layers handle the boring syntax things: like multi-line inputs, and comments, etc.
The semantic layer takes this information and makes sense of it, like what the material number in a cell input is.

.. note::

Expand Down
2 changes: 1 addition & 1 deletion doc/source/devguide/cell_modifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:description lang=en:
How to implement CellModifierInput subclasses in MontePy for data inputs that modify cells.

Data Cards that Modify Cells: :class:`~montepy.data_inputs.cell_modifier.CellModifierInput`
Data Inputs that Modify Cells: :class:`~montepy.data_inputs.cell_modifier.CellModifierInput`
============================================================================================
This is a subclass of :class:`~montepy.data_inputs.data_input.DataInputAbstract` that is meant to handle data inputs that specify information about,
and modify cells.
Expand Down
4 changes: 2 additions & 2 deletions doc/source/devguide/collections_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ During init the inputs' "name word" (e.g., ``M3``, ``kcode``, ``f7:n``) is valid
Conceptually these names can contain up to four sections.
This information is stored in an instance of :class:`~montepy.input_parser.syntax_node.ClassifierNode`.

#. A ``prefix_modifier`` this modifies the whole card with a special character such as ``*tr5``
#. A ``prefix_modifier`` this modifies the whole input with a special character such as ``*tr5``
#. A ``Prefix``, which is a series of letters that identifies the type such as ``m``
#. A ``number``, which numbers it. These must be an unsigned integer.
#. A particle classifier such as ``:n,p``.
Expand Down Expand Up @@ -117,7 +117,7 @@ How to Add an Object to :class:`~montepy.MCNP_Problem`

The :class:`~montepy.MCNP_Problem` automatically consumes problem level data inputs,
and adds them to itself.
Cards this would be appropriate for would be things like ``mode`` and ``kcode``.
Inputs this would be appropriate for would be things like ``mode`` and ``kcode``.
To do this it uses the dictionary ``inputs_to_property`` in the ``__load_data_inputs_to_object`` method.
To add a problem level data Object you need to

Expand Down
2 changes: 1 addition & 1 deletion doc/source/devguide/mcnp_object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Input: :class:`~montepy.mcnp_object.MCNP_Object`
=================================================

All classes that represent a single input card *must* subclass this.
All classes that represent a single input *must* subclass this.
For example: some children are: :class:`~montepy.Cell`, :class:`~montepy.Surface`.

How to ``__init__``
Expand Down
4 changes: 2 additions & 2 deletions doc/source/devguide/pointers_generators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ if the surfaces did know, this would be bidirectional.

So how do we decide which direction to point?
In general we should default to MCNP.
So a cell borrows a surface because a cell card in MCNP
So a cell borrows a surface because a cell input in MCNP
references surface numbers,
and not vice versa.
The exception to this is the case of inputs that modify another object.
For example the ``MT`` card modifies its parent ``M`` card.
For example the ``MT`` input modifies its parent ``M`` input.
In general the parent object should own its children modifiers.
This is an area of new development, and this may change.

Expand Down
4 changes: 2 additions & 2 deletions doc/source/guide/cells.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ Their importances will all be set to 0.
Setting How Cell Data Gets Displayed in the Input File
------------------------------------------------------

Much of the cell data can show up in the cell block or the data block, like the importance card.
Much of the cell data can show up in the cell block or the data block, like the importance input.
These are referred to MontePy as "cell modifiers".
You can change how these cell modifiers are printed with :attr:`~montepy.MCNP_Problem.print_in_data_block`.
This acts like a dictionary where the key is the MCNP card name.
This acts like a dictionary where the key is the MCNP input name.
So to make cell importance data show up in the cell block just run:
``problem.print_in_data_block["imp"] = False``.

Expand Down
10 changes: 5 additions & 5 deletions doc/source/guide/reading_writing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Information Kept
#. The optional message block at the beginning of the problem (it's a niche feature; check out section :manual63:`4.4.1` of the user manual)
#. The problem title
#. ``C`` style comments (e.g., ``C this is a banana``)
#. (Almost) all MCNP inputs (cards). Only the read input is discarded.
#. (Almost) all MCNP inputs. Only the read input is discarded.
#. Dollar sign comments (e.g., ``1 0 $ this is a banana``)
#. Other user formatting and spaces. If extra spaces between values are given the space will be expanded or shortened to try to keep
the position of the next value in the same spot as the length of the first value changes.
Expand All @@ -195,11 +195,11 @@ Information Kept

Information Lost
^^^^^^^^^^^^^^^^
#. Read cards. These are handled properly, but when written out these cards themselves will disappear.
When MontePy encounters a read card it notes the file in the card, and then discard the card.
#. Read inputs. These are handled properly, but when written out these inputs themselves will disappear.
When MontePy encounters a read input it notes the file in the input, and then discards the input.
It will then read these extra files and append their contents to the appropriate block.
So If you were to write out a problem that used the read card in the surface block the surface
cards in that file from the read card will appear at the end of the new surface block in the newly written file.
So If you were to write out a problem that used the read input in the surface block the surface
inputs in that file from the read input will appear at the end of the new surface block in the newly written file.

.. note::

Expand Down
Loading
Loading