Skip to content

Commit

Permalink
Merge pull request #40 from lanl/39-v20-examples
Browse files Browse the repository at this point in the history
Modified radius.py, isotope.py, and parFile.py for better functionality in terms of reading in parFile cards. 

NOTE: the isotope extended format is currently not implemented successfully. This is not a format that if not used often, so I am not worried about this bug at this moment. 

With better reading of parFiles, I added two examples in the notebook folder.
  • Loading branch information
along4 authored Feb 22, 2025
2 parents 47b7258 + b48eed1 commit 607a4b4
Show file tree
Hide file tree
Showing 16 changed files with 1,327 additions and 332 deletions.
77 changes: 77 additions & 0 deletions docs/repo.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
PLEIADES
├── .readthedocs.yaml
├── .gitignore
├── .pre-commit-config.yaml
├── pyproject.toml
├── poetry.lock
├── LICENSE
├── environment.yaml
├── pleiades.egg-info
├── README.rst
├── src/
│ └── pleiades
| ├── __init__.py
| ├── __main__.py
| ├── utils/
| ├── data/
| | ├── cross-sections/
| | ├── isotopes/
| | └── resonances/
| ├── core/
| │ ├── transmission.py
| │ ├── constants.py
| │ ├── __init__.py
| │ ├── models.py
| │ └── data_manager.py
| └── sammy/
| ├── interface.py
| ├── config.py
| ├── __init__.py
| ├── factory.py
| ├── parfile.py
| ├── backends/
| │ ├── nova_ornl.py
| │ ├── __init__.py
| │ ├── local.py
| │ └── docker.py
| └── parameters/
| ├── unused_var.py
| ├── paramagnetic.py
| ├── orres.py
| ├── normalization.py
| ├── misc.py
| ├── helper.py
| ├── external_r.py
| ├── data_reduction.py
| ├── user_resolution.py
| ├── resonance.py
| ├── resolution.py
| ├── radius.py
| ├── last.py
| ├── det_efficiency.py
| ├── broadening.py
| ├── background.py
| ├── __init__.py
| └── isotope.py
├── examples/
├── scripts/
├── docs/
│ └── repo.map
├── legacy/
├── paper/
├── tests/
│ ├── unit/
│ │ ├── pleiades
│ │ └── conftest.py
│ └── data/
│ ├── config
│ └── ex012
└── notebook/
├── sammy.param/
│ └── example.ipynb
└── samexm/
├── ex012/
│ ├── ex012.ipynb
│ └── ex012a.par
└── ex027/
└── ex027a.endf
75 changes: 75 additions & 0 deletions notebook/samexm/ex012/ex012a.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook is based on example 12 from the SAMMY repo. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Importing specific classes from the pleiades.sammy module\n",
"from pleiades.sammy.parfile import SammyParameterFile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we want to load SAMMY parameters based on a given parameter file. "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# reading in SAMMY parameters from a parameter file \"./ex012a.par\"\n",
"sammy_params = SammyParameterFile.from_file(\"./ex012a.par\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Write the parameters to an output file \"ex012b.par\". "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"sammy_params.to_file(\"./ex012b.par\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "pleiades",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
177 changes: 177 additions & 0 deletions notebook/samexm/ex012/ex012a.par
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
-3.6616E+06 1.5877E+05 3.6985E+09 0 0 1 1
-8.7373E+05 1.0253E+03 1.0151E+02 0 0 1 1
-3.6529E+05 1.0000E+03 3.0406E+01 0 0 0 1
-6.3159E+04 1.0000E+03 4.6894E+01 0 0 0 1
-4.8801E+04 1.0000E+03 9.2496E+00 0 0 0 1
31739.99805 1.0000E+03 1.5667E+01 0 0 0 5
55676.96094 1.5803E+03 6.5331E+05 0 0 0 1
67732.84375 2.5000E+03 2.6589E+03 0 0 0 3
70800.00781 1.0000E+03 2.9617E+01 0 0 0 5
86797.35938 2.5000E+03 7.2618E+02 0 0 0 3
181617.5000 5.6000E+03 3.4894E+07 0 0 0 1
298700.0000 1.0000E+03 9.8860E+03 0 0 0 5
301310.8125 3.6000E+03 2.3548E+03 0 0 0 1
354588.6875 1.0000E+03 1.4460E+04 0 0 0 5
399675.9375 6.6000E+02 8.1361E+02 0 0 0 3
532659.8750 2.5000E+03 5.3281E+05 0 0 0 3
565576.8750 2.9000E+03 1.0953E+07 0 0 0 3
587165.7500 8.8000E+03 1.9916E+05 0 0 0 2
590290.1250 3.6000E+03 5.2366E+05 0 0 0 1
602467.3125 3.4000E+03 5.0491E+04 0 0 0 4
714043.4375 2.5000E+03 1.2165E+03 0 0 0 3
771711.9375 1.0000E+03 5.3139E+04 0 0 0 5
812491.6250 9.7000E+03 3.0100E+07 0 0 0 3
845233.8750 2.0000E+03 3.9791E+05 0 0 0 4
872305.8125 1.3000E+03 3.2140E+04 0 0 0 5
910043.5625 1.1300E+03 3.6733E+06 0 0 0 3
962233.0000 1.6000E+04 7.6614E+07 0 0 0 2
1017777.188 1.0000E+03 7.6192E+04 0 0 0 5
1042856.812 1.0000E+03 9.3370E+05 0 0 0 5
1085169.250 3.6000E+03 7.2794E+04 0 0 0 1
1148103.625 1.0000E+03 3.1469E+03 0 0 0 5
1162663.625 3.8000E+03 3.0136E+06 0 0 0 1
1199501.375 7.6000E+03 1.4914E+07 0 0 0 2
1201238.750 3.6000E+03 4.6012E+06 0 0 0 1
1256447.250 3.6000E+03 1.7383E+07 0 0 0 1
1264441.750 1.0000E+03 8.4364E+05 0 0 0 5
1379920.250 2.4000E+03 6.5299E+04 0 0 0 4
1408269.750 2.7000E+03 5.1983E+06 0 0 0 3
1479927.250 1.6500E+03 3.5025E+06 0 0 0 4
1482395.375 8.8000E+03 8.8694E+02 0 0 0 2
1512343.875 1.0000E+03 9.1493E+04 0 0 0 5
1528742.375 2.4000E+03 2.9225E+06 0 0 0 4
1580564.875 2.4000E+03 1.4955E+06 0 0 0 4
1592844.250 8.8000E+03 1.1199E+07 0 0 0 2
1597168.625 2.4000E+03 4.0172E+06 0 0 0 4
1639561.500 1.0000E+03 1.5293E+07 0 0 0 5
1651146.000 1.0000E+03 2.1555E+07 0 0 0 5
1658595.000 8.8000E+03 1.5553E+06 0 0 0 2
1664961.125 2.4000E+03 2.1590E+05 0 0 0 4
1784952.750 2.4000E+03 1.9294E+05 0 0 0 4
1805652.625 2.5000E+03 1.2991E+06 0 0 0 3
1850667.250 1.0000E+03 3.5515E+07 0 0 0 5
1852435.250 2.5000E+03 7.0707E+07 0 0 0 3
1923655.250 1.0000E+03 1.0171E+06 0 0 0 5
2248678.250 3.6000E+03 4.4476E+08 0 0 0 1
1968869.750 1.0000E+03 5.7341E+06 0 0 0 5
3007280.500 3.6000E+03 2.8996E+05 0 0 0 1
3067775.250 3.6000E+03 4.2229E+05 0 0 0 1
-2.1796E+06 4.0908E+05 1.7222E+09 0 0 0 8
-8.6024E+05 9.9997E+02 3.4170E+07 0 0 0 8
-4.3128E+05 1.0059E+03 2.2851E+08 0 0 0 8
15282.00000 1.6460E+03 1.0000E+04 0 0 0 10
38819.00000 2.4000E+03 7.5926E+04 0 0 0 13
159682.9688 1.9000E+03 1.2003E+06 0 0 0 10
184456.4844 1.5000E+03 1.3674E+05 0 0 0 10
336790.2812 8.0000E+02 2.5128E+06 0 0 0 10
385764.1875 4.6700E+03 2.4133E+07 0 0 0 9
552241.8125 5.7000E+03 1.2989E+06 0 0 0 13
566558.4375 3.0000E+03 7.0820E+07 0 0 0 10
619664.6250 3.0000E+03 7.2596E+05 0 0 0 13
649726.0000 3.0000E+03 1.0959E+06 0 0 0 13
653064.6250 6.3000E+03 1.9386E+07 0 0 0 12
715064.6250 3.0000E+02 9.7857E+05 0 0 0 10
716771.3125 3.0000E+03 2.1930E+08 0 0 0 8
802258.9375 3.0000E+03 9.9349E+06 0 0 0 15
862003.6875 3.0000E+03 4.3293E+08 0 0 0 8
872483.5000 3.0000E+02 1.7335E+07 0 0 0 10
955891.2500 3.0000E+02 9.8289E+05 0 0 0 13
1098425.500 3.0000E+03 5.7787E+04 0 0 0 15
1113807.625 3.0000E+02 7.6533E+07 0 0 0 10
1122279.500 3.0000E+02 4.8816E+06 0 0 0 13
1178601.750 3.0000E+03 8.2959E+06 0 0 0 9
1192267.500 3.0000E+02 3.7506E+05 0 0 0 12
1207629.500 3.0000E+02 1.9795E+07 0 0 0 13
1388859.125 3.0000E+03 4.2714E+06 0 0 0 15
1769072.750 3.0000E+03 3.2136E+04 0 0 0 8
2248487.000 3.0000E+03 1.6932E+05 0 0 0 8
-1.1851E+06 1.1848E+05 2.6057E+08 0 0 0 18
-1.6155E+05 6.5000E+02 4.2640E+05 0 0 0 18
2235.000000 3.7000E+02 9.3266E+02 0 0 0 20
4977.000000 6.0000E+02 1.1220E+03 0 0 0 19
183488.8281 6.0000E+03 9.9976E+06 0 0 0 18
235225.3906 8.0000E+02 1.1541E+05 0 0 0 21
302839.2188 3.7000E+02 2.7443E+05 0 0 0 20
413136.1875 6.0000E+02 1.5801E+06 0 0 0 19
645239.8125 8.0000E+02 4.0143E+05 0 0 0 21
704912.0000 8.0000E+02 4.2319E+05 0 0 0 21
745454.0000 3.7000E+02 1.4735E+07 0 0 0 20
796946.1250 6.0000E+02 4.6932E+05 0 0 0 19
807379.8125 6.0000E+02 2.7433E+05 0 0 0 19
810796.9375 6.0000E+02 4.1931E+05 0 0 0 19
844674.6250 3.7000E+02 3.3153E+06 0 0 0 20
878822.8125 8.0000E+02 1.1063E+05 0 0 0 21
979821.3125 6.0000E+02 5.9182E+05 0 0 0 19
1182175.750 6.0000E+03 5.9124E+06 0 0 0 18
1217821.125 8.0000E+02 1.8889E+06 0 0 0 21
1274871.500 6.0000E+02 2.2255E+06 0 0 0 19
1302032.875 8.0000E+02 3.0479E+05 0 0 0 21
1310774.875 3.7000E+02 3.3971E+05 0 0 0 20
1337984.375 6.0000E+02 4.6240E+06 0 0 0 19
1356024.750 3.7000E+02 1.2271E+07 0 0 0 20
1383597.625 6.0000E+02 2.5336E+07 0 0 0 19
1400981.375 8.0000E+02 1.8976E+06 0 0 0 21
1412107.750 3.7000E+02 6.6862E+05 0 0 0 20
1586007.000 6.0000E+03 2.3644E+07 0 0 0 18
2583249.500 6.0000E+03 9.2076E+07 0 0 0 18
-1.1592E+07 1.2000E+03 7.5174E+09 0 0 0 23
-9.1926E+06 1.2000E+03 1.4356E+10 0 0 0 23
433901.3750 1.2000E+03 4.3760E+07 0 0 0 25
999736.9375 1.2000E+03 9.6583E+07 0 0 0 26
1307683.875 1.2000E+03 4.2027E+07 0 0 0 25
1630813.125 1.2000E+03 7.1367E+04 0 0 0 25
1650581.000 1.2000E+03 3.9013E+06 0 0 0 29
1833142.125 1.2000E+03 7.8352E+06 0 0 0 26
1898468.875 1.2000E+03 2.8678E+07 0 0 0 24
2372699.000 1.2000E+03 1.5533E+08 0 0 0 23
2888249.750 1.2000E+03 1.8859E+06 0 0 0 24
3004838.500 1.2000E+03 2.3338E+03 0 0 0 24
3181814.500 1.2000E+03 5.1769E+08 0 0 0 24
3203037.750 1.2000E+03 1.7923E+08 0 0 0 23
3204505.000 1.2000E+03 3.1091E+05 0 0 0 28
3239197.250 1.2000E+03 2.5141E+08 0 0 0 26
3431828.250 1.2000E+03 6.1570E+05 0 0 0 27
3438834.250 1.2000E+03 1.8039E+06 0 0 0 28
3636796.000 1.2000E+03 7.0184E+08 0 0 0 25
3763624.250 1.2000E+03 1.6031E+07 0 0 0 29
3853751.500 1.2000E+03 5.6245E+08 0 0 0 23
4175216.750 1.2000E+03 7.0220E+07 0 0 0 26
4288830.500 1.2000E+03 5.6268E+07 0 0 0 25
4303685.000 1.2000E+03 1.6078E+07 0 0 0 24
4461693.000 1.2000E+03 7.7996E+07 0 0 0 23
4525253.000 1.2000E+03 4.1733E+06 0 0 0 27
4591673.500 1.2000E+03 9.1070E+04 0 0 0 29
4592562.000 1.2000E+03 1.7527E+05 0 0 0 28
4816678.000 1.2000E+03 4.7145E+07 0 0 0 25
5055537.000 1.2000E+03 5.2134E+07 0 0 0 26
5118596.000 1.2000E+03 1.7864E+07 0 0 0 29
5365329.500 1.2000E+03 9.8062E+05 0 0 0 27
5617318.000 1.2000E+03 3.3197E+07 0 0 0 28
5666636.000 1.2000E+03 1.2687E+07 0 0 0 27
5912201.500 1.2000E+03 1.2942E+07 0 0 0 29
5986110.000 1.2000E+03 7.1061E+06 0 0 0 26
6076846.000 1.2000E+03 5.1667E+06 0 0 0 28
6116665.000 1.2000E+03 5.5499E+06 0 0 0 24
6389893.000 1.2000E+03 4.9356E+06 0 0 0 29
6813680.500 1.2000E+03 3.2629E+06 0 0 0 28
6833136.500 1.2000E+03 5.1405E+06 0 0 0 27
7373000.000 1.2000E+03 2.4000E+06 0 0 0 24
8820920.000 1.2000E+03 1.1234E+10 0 0 0 25
10934820.00 1.2000E+03 2.7611E+05 0 0 0 23
15050371.00 1.2000E+03 6.3499E+05 0 0 0 23
25004488.00 1.2000E+03 6.9186E+03 0 0 0 23

0.1

RADIUS PARAMETERS FOLLOW
4.13642 4.13642 0-1 1 4 5
4.94372 4.94372 0-1 2 3 6 7
4.40000 4.40000 0-1 8 91011121314151617
4.20000 4.20000 0-11819202122
4.20000 4.20000 0-123242526272829

ISOTOPIC MASSES AND ABUNDANCES FOLLOW
27.976929 1.0000000 .9200 1 1 2 3 4 5 6 7
28.976496 .0467000 .0500 1 8 91011121314151617
29.973772 .0310000 .0200 11819202122
16.000000 1.0000000 .0100000 023242526272829
Empty file.
2 changes: 1 addition & 1 deletion src/pleiades/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Isotope(BaseModel):
atomic_mass: Mass
thickness: NonNegativeFloat
thickness_unit: str = Field(pattern=r"^(cm|mm|atoms/cm2)$")
abundance: float = Field(ge=0.0, le=1.0)
abundance: float = Field(ge=0.0)
density: NonNegativeFloat
density_unit: str = Field(default="g/cm3", pattern=r"^g/cm3$")

Expand Down
Loading

0 comments on commit 607a4b4

Please sign in to comment.