Skip to content

Commit b92184a

Browse files
committed
examples: added parameter scan
1 parent 5e00416 commit b92184a

21 files changed

+135
-67
lines changed

examples/cli_check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
2-
Examples for converting INp files using ``Convert``.
2+
Example converting INp files using ``Convert``.
33
"""
44

55
import pathlib
66

77
import pymcnp
88

99
# Getting INP path.
10-
path = pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1.i'
10+
path = pathlib.Path(__file__).parent / 'files' / 'outp' / 'F1.o'
1111

12-
# Converting.
12+
# Checking.
1313
checker = pymcnp.cli.Check(path)
1414
checker.check()
1515

examples/cli_convert.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for converting OUTP files using ``Convert``.
2+
Example converting OUTP files using ``Convert``.
33
"""
44

55
import pathlib
@@ -9,7 +9,8 @@
99
TALLY = '1'
1010

1111
# Reading OUTP.
12-
outp = pymcnp.Outp.from_file(pathlib.Path(__file__).parent / 'files' / 'outp' / 'F1F8.o')
12+
path = pathlib.Path(__file__).parent / 'files' / 'outp' / 'F1F8.o'
13+
outp = pymcnp.Outp.from_file(path)
1314

1415
# Converting.
1516
converter = pymcnp.cli.Convert(outp)

examples/cli_plot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for plotting OUTP files using ``Plot``.
2+
Example plotting OUTP files using ``Plot``.
33
"""
44

55
import pathlib
@@ -11,9 +11,10 @@
1111
TALLY = '1'
1212

1313
# Reading OUTP.
14-
outp = pymcnp.Outp.from_file(pathlib.Path(__file__).parent / 'files' / 'outp' / 'F1F8.o')
14+
path = pathlib.Path(__file__).parent / 'files' / 'outp' / 'F1F8.o'
15+
outp = pymcnp.Outp.from_file(path)
1516

16-
# Converting.
17+
# Plotting.
1718
plotter = pymcnp.cli.Plot(outp)
1819
plotter.to_show(TALLY)
1920
matplotlib.pyplot.show()

examples/cli_run.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for running INP files using ``Run``.
2+
Example running INP files using ``Run``.
33
"""
44

55
import pathlib
@@ -9,11 +9,11 @@
99

1010
# Creating ``Run`` subclass.
1111
class MyRun(pymcnp.cli.Run):
12-
def prehook_file(self, path):
13-
print(f'Calling ``prehook_file`` {path}')
12+
def prehook_file(self, path, index):
13+
print(f'Calling ``prehook_file`` {path} {index}')
1414

15-
def posthook_file(self, path):
16-
print(f'Calling ``posthook_file`` {path}')
15+
def posthook_file(self, path, index):
16+
print(f'Calling ``posthook_file`` {path} {index}')
1717

1818
def prehook_batch(self, path):
1919
print(f'Calling ``prehook_batch`` {path}')
@@ -23,9 +23,12 @@ def posthook_batch(self, path):
2323

2424

2525
# Reading INP.
26-
inp0 = pymcnp.Inp.from_file(pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i')
27-
inp1 = pymcnp.Inp.from_file(pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i')
28-
inp2 = pymcnp.Inp.from_file(pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1.i')
26+
path0 = pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i'
27+
path1 = pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i'
28+
path2 = pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1.i'
29+
inp0 = pymcnp.Inp.from_file(path0)
30+
inp1 = pymcnp.Inp.from_file(path1)
31+
inp2 = pymcnp.Inp.from_file(path2)
2932

3033
# Running.
3134
runner = MyRun([inp0, inp1, inp2], command='echo')

examples/cli_visualize.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
"""
2-
Examples for visualizing INP files using ``Visualize``.
2+
Example visualizing INP files using ``Visualize``.
33
"""
44

55
import pathlib
66

77
import pymcnp
88

99
# Reading INP.
10-
inp = pymcnp.Inp.from_file(pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i')
10+
path = pathlib.Path(__file__).parent / 'files' / 'inp' / 'F1F8.i'
11+
inp = pymcnp.Inp.from_file(path)
1112

1213
# Visualizing surfaces using ``Visualize``.
1314
visualizer = pymcnp.cli.Visualize(inp)
14-
visualizer.to_show_surfaces().plot()
15+
visualizer.to_show_surfaces().show()
1516

1617
# Converting to PDF.
1718
visualizer.to_pdf_surfaces('F1F8-surfaces.pdf')

examples/create_cell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for creating INP cells.
2+
Examples creating INP cells.
33
"""
44

55
import pymcnp

examples/create_inp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for creating INP files using ``build``.
2+
Example creating INP files.
33
"""
44

55
import pymcnp
@@ -77,7 +77,7 @@
7777

7878
# Creating inp.
7979
inp = pymcnp.Inp(
80-
title='Create ``Inp`` Using ``build``\n',
80+
title='Create ``Inp``\n',
8181
cells=[cell_air, cell_shield, cell_lead, cell_world],
8282
surfaces=[surface_air, surface_shield, surface_lead, surface_world],
8383
data=[data_air, data_shield, data_lead],

examples/create_material.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for creating INP materials.
2+
Examples creating INP materials.
33
"""
44

55
import pymcnp

examples/create_surface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Examples for creating INP surfaces.
2+
Examples creating INP surfaces.
33
"""
44

55
import pymcnp

examples/files/inp/F1.i

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
isotropic neutron source over lunar regolith with two gamma detectors
2-
c ============================================================================
3-
c cells
4-
c ============================================================================
2+
3+
c none
4+
c cells
5+
c none
56
100 100 -1.54 -1 imp:p,n 1
67
200 300 -5.06 -2 imp:p,n 1
78
201 200 -5.1 -3 imp:p,n 1
89
777 900 -0.000001 1 2 3 -99 imp:p,n 1
910
999 0 99 imp:p,n 0
1011

11-
c ============================================================================
12-
c surfaces
13-
c ============================================================================
12+
c none
13+
c surfaces
14+
c none
1415
1 rpp -300 300 -300 300 -150 -50
1516
2 rcc 50 0 0 0 0 7.62 3.81
1617
3 rcc -50 0 0 0 0 5.08 2.54
1718
99 so 600
1819

19-
c ============================================================================
20-
c data
21-
c ============================================================================
20+
c none
21+
c data
22+
c none
2223
m100 013027 -0.1701 020040 -0.131742819 020042 -0.000879273 020044 &
2324
-0.002834874 026054 -0.00086506 026056 -0.013579592 026057 -0.000313612 &
2425
008016 -0.45489192 019039 -0.0001865162 019041 -0.0000134604 012024 &

0 commit comments

Comments
 (0)