Skip to content

Commit 895002f

Browse files
authored
Merge pull request #647 from idaholab/646-address-review-coments-from-munkm
Address review comments from PyOpenSci
2 parents d415f00 + 1f9dfc6 commit 895002f

File tree

3 files changed

+115
-20
lines changed

3 files changed

+115
-20
lines changed

README.md

+26-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
[![license](https://img.shields.io/github/license/idaholab/MontePy.svg)](https://github.com/idaholab/MontePy/blob/develop/LICENSE)
66
[![JOSS article status](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199/status.svg)](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199)
7-
[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop)
87
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
98

109

10+
[![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop)
11+
[![Testing status](https://github.com/idaholab/MontePy/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/idaholab/MontePy/actions/workflows/main.yml?query=branch%3Adevelop)
12+
[![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/)
13+
1114
[![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy)
1215
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/montepy.svg)](https://anaconda.org/conda-forge/montepy)
13-
[![Docs Deployment](https://github.com/idaholab/MontePy/actions/workflows/deploy.yml/badge.svg?branch=main)](https://www.montepy.org/)
1416
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/montepy.svg)](https://pypi.org/project/montepy/)
1517

1618

@@ -83,6 +85,8 @@ for surface in problem.surfaces:
8385
problem.write_problem("foo_update.imcnp")
8486
```
8587

88+
For more examples see the [getting started guide](https://www.montepy.org/en/stable/starting.html).
89+
8690
## Limitations
8791

8892
Here a few of the known bugs and limitations:
@@ -96,13 +100,23 @@ Here a few of the known bugs and limitations:
96100
* `M1 1001.80c 1.0 plib=80p` can be parsed.
97101
* `M1 plib=80p 1001.80c 1.0` cannot be parsed; despite it being a valid input.
98102

103+
## Current Development Priorities
104+
105+
Here are the rough development priorities for adding new features to MontePy:
106+
107+
#. Redesign the `Material` interface to be more user friendly.
108+
#. Implement support for tallies.
109+
#. Implement support for source definitions.
110+
111+
If you have a specific feature priority that you would be willing to collaborate on you can open an issue or email us at [mgale@montepy.org](mailto:mgale@montepy.org).
112+
99113
## Alternatives
100114

101115
There are some python packages that offer some of the same features as MontePy,
102116
but don't offer the same level of robustness, ease of installation, and user friendliness.
103117

104118

105-
Many of the competitors do not offer the robustness that MontePy does becuase,
119+
Many of the competitors do not offer the robustness that MontePy does because,
106120
they do not utilize context-free parsing (as of 2024).
107121
These packages are:
108122

@@ -112,12 +126,19 @@ These packages are:
112126

113127
* [numjuggler](https://github.com/inr-kit/numjuggler)
114128

115-
The only other library that does utilize context-free parsing that we are aware is
116-
[MCNP™y](https://github.rpi.edu/NuCoMP/mcnpy). MontePy differs by being:
129+
The only other libraries that do utilize context-free parsing that we are aware of are:
130+
* [MCNPy](https://github.rpi.edu/NuCoMP/mcnpy)
131+
* [mckit](https://github.com/MC-kit/mckit)
132+
133+
MontePy differs from MCNPy by being:
117134
* On PyPI, and can be installed via pip.
118135
* Only requires a python interpreter, and not a Java virtual machine.
119136
* Allowing contributions from anyone with a public GitHub account
120137

138+
MontePy differs from mckit by being:
139+
* thoroughly documented
140+
* Object-Oriented
141+
121142

122143
For only writing, or templating an input file there are also some great tools out there.
123144
These packages don't provide the same functionality as MontePy inherently,

doc/source/starting.rst

+88-14
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,31 @@ System Wide (for the current user)
4646
#. Install it from `PyPI <https://pypi.org/project/montepy>`_ by running ``pip install montepy``.
4747
You may need to run ``pip install --user montepy`` if you are not allowed to install the package.
4848

49+
Installing Optional Dependencies
50+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
51+
52+
MontePy offers multiple optional dependencies which some users may desire,
53+
though this is mostly intended for developers.
54+
Pip can install these through the following command:
55+
56+
``pip install montepy[<extras>]``
57+
58+
Where ``<extras>`` is one of the following options:
59+
60+
#. ``demos``: installs the dependencies for running the demo problems in `jupyter <https://jupyter.org/>`_.
61+
62+
#. ``doc``: installs the dependencies for building the website using `sphinx <https://www.sphinx-doc.org/en/master/>`_.
63+
64+
#. ``build``: installs the dependencies for building the source distribution packages.
65+
66+
#. ``format``: install the dependencies for formatting the code with `black <https://black.readthedocs.io/en/stable/index.html>`_.
67+
68+
#. ``test``: installs the dependencies for testing the software.
69+
70+
#. ``demo-test``: installs the dependencies for testing the demos.
71+
72+
#. ``develop``: installs everything a developer may need, specifically: ``montepy[test,doc,format,demo-test]``.
73+
4974
Install specific version for a project
5075
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5176
The best way maybe to setup a project-specific `conda <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`_,
@@ -401,18 +426,6 @@ So there is a convenient way to update a surface, but how do you easily get the
401426
For instance what if you want to shift a cell up in Z by 10 cm?
402427
It would be horrible to have to get each surface by their number, and hoping you don't change the numbers along the way.
403428

404-
One way you might think of is: oh let's just filter the surfaces by their type?:
405-
406-
.. testcode::
407-
408-
for surface in cell.surfaces:
409-
if surface.surface_type == montepy.surfaces.surface_type.SurfaceType.PZ:
410-
surface.location += 10
411-
412-
Wow that's rather verbose.
413-
This was the only way to do this with the API for awhile.
414-
But MontePy 0.0.5 fixed this with: you guessed it: generators.
415-
416429
The :class:`~montepy.surface_collection.Surfaces` collection has a generator for every type of surface in MCNP.
417430
These are very easy to find: they are just the lower case version of the
418431
MCNP surface mnemonic.
@@ -423,6 +436,53 @@ This previous code is much simpler now:
423436
for surface in cell.surfaces.pz:
424437
surface.location += 10
425438

439+
Setting Boundary Conditions
440+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
441+
442+
As discussed in :manual63:`5.3.1` surfaces can have three boundary conditions:
443+
444+
* Reflective boundary
445+
* White boundary
446+
* periodic boundary
447+
448+
.. note::
449+
450+
Vacuum boundary conditions are the fourth type.
451+
They are defined by cells with 0 importance though.
452+
453+
The reflective and white boundary conditions are easiest to set as they are Boolean conditions.
454+
These are controlled by :func:`~montepy.surfaces.surface.Surface.is_reflecting` and
455+
:func:`~montepy.surfaces.surface.Surface.is_white_boundary` respectively.
456+
For Example:
457+
458+
.. testcode::
459+
460+
from montepy.surfaces.surface_type import SurfaceType
461+
462+
bottom = montepy.surfaces.axis_plane.AxisPlane()
463+
bottom.surface_type = SurfaceType.PZ
464+
bottom.is_reflecting = True
465+
466+
cyl = montepy.surfaces.cylinder_on_axis.CylinderOnAxis()
467+
cyl.surface_type = SurfaceType.CZ
468+
cyl.is_white_boundary = True
469+
470+
471+
Setting a periodic boundary is slightly more difficult.
472+
In this case the boundary condition must be set to the other periodic surface with :func:`~montepy.surfaces.surface.Surface.periodic_surface`.
473+
So to continue with the previous example:
474+
475+
.. testcode::
476+
477+
bottom.location = 0.0
478+
bottom.is_reflecting = False
479+
480+
top = montepy.surfaces.axis_plane.AxisPlane()
481+
top.surface_type = SurfaceType.PZ
482+
top.location = 1.26
483+
484+
bottom.periodic_surface = top
485+
426486
Cells
427487
-----
428488

@@ -592,19 +652,33 @@ Order of precedence and grouping is automatically handled by Python so you can e
592652

593653
.. testcode::
594654

655+
import montepy.surfaces as surfs
656+
from montepy.surfaces.surface_type import SurfaceType
657+
595658
# build blank surfaces
596659
bottom_plane = montepy.surfaces.axis_plane.AxisPlane()
660+
bottom_plane.surface_type = SurfaceType.PZ
597661
bottom_plane.location = 0.0
662+
598663
top_plane = montepy.surfaces.axis_plane.AxisPlane()
664+
top_plane.surface_type = SurfaceType.PZ
599665
top_plane.location = 10.0
666+
600667
fuel_cylinder = montepy.surfaces.cylinder_on_axis.CylinderOnAxis()
668+
fuel_cylinder.surface_type = SurfaceType.CZ
601669
fuel_cylinder.radius = 1.26 / 2
670+
602671
clad_cylinder = montepy.surfaces.cylinder_on_axis.CylinderOnAxis()
603672
clad_cylinder.radius = (1.26 / 2) + 1e-3 # fuel, gap, cladding
673+
clad_cylinder.surface_type = SurfaceType.CZ
674+
604675
clad_od = montepy.surfaces.cylinder_on_axis.CylinderOnAxis()
605676
clad_od.radius = clad_cylinder.radius + 0.1 # add thickness
677+
clad_od.surface_type = SurfaceType.CZ
606678
other_fuel = montepy.surfaces.cylinder_on_axis.CylinderOnAxis()
607679
other_fuel.radius = 3.0
680+
other_fuel.surface_type = SurfaceType.CZ
681+
608682
bottom_plane.number = 1
609683
top_plane.number = 2
610684
fuel_cylinder.number = 3
@@ -850,13 +924,13 @@ If you want to try to troubleshoot errors in python you can do this with the fol
850924
This following guide may return an incomplete problem object that may break in very wierd ways.
851925
Never use this for actual file editing; only use it for troubleshooting.
852926

853-
1. Setup a new Problem object:
927+
#. Setup a new Problem object:
854928

855929
.. testcode::
856930

857931
problem = montepy.MCNP_Problem("foo.imcnp")
858932

859-
1. Next load the input file with the ``check_input`` set to ``True``.
933+
#. Next load the input file with the ``check_input`` set to ``True``.
860934

861935
.. testcode::
862936

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ build = [
6464
"setuptools-scm>=8",
6565
]
6666
develop = [
67-
"montepy[test,doc,format]",
67+
"montepy[test,doc,format,demo-test]",
6868
]
6969
demos = ["jupyter"]
7070
demo-test = ["montepy[demos]", "papermill"]

0 commit comments

Comments
 (0)