Skip to content

Commit 4660ba3

Browse files
committed
add new changes, refactoring, and missing MT_MF
1 parent 92db500 commit 4660ba3

44 files changed

Lines changed: 941 additions & 558 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,29 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install numpy h5py endf sphinx sphinx-rtd-theme myst-parser
2828
29-
- name: Build docs
29+
- name: Build docs (strict — fail on warnings)
3030
run: |
3131
cd docs
32-
make html
32+
make html SPHINXOPTS="-W --keep-going"
33+
34+
- name: Verify autodoc coverage
35+
run: |
36+
cd docs
37+
python -c "
38+
import importlib, inspect, sys
39+
sys.path.insert(0, '..')
40+
import pyepics
41+
public = [name for name in pyepics.__all__ if not name.startswith('_')]
42+
missing = []
43+
for name in public:
44+
obj = getattr(pyepics, name)
45+
if callable(obj) and not inspect.getdoc(obj):
46+
missing.append(name)
47+
if missing:
48+
print(f'Missing docstrings: {missing}')
49+
sys.exit(1)
50+
print(f'All {len(public)} public symbols have docstrings.')
51+
"
3352
3453
- name: Deploy to GitHub Pages
3554
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ __pycache__/
33
*.py[codz]
44
*$py.class
55

6+
# Data directory (downloaded ENDF, generated HDF5)
7+
data/
8+
69
# Generated reports
7-
reports/
10+
tests/reports/
811

912
# C extensions
1013
*.so

README.md

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
> Python library for reading and converting EPICS (Electron Photon Interaction Cross Sections) nuclear data.
99
10-
PyEPICS parses EEDL, EPDL, and EADL files from the [IAEA EPICS 2023](https://www-nds.iaea.org/epics/) database (in ENDF-6 format) and converts them into structured HDF5 files suitable for Monte Carlo transport codes such as [MC/DC](https://github.com/CEMeNT-PSAAP/MCDC).
10+
PyEPICS parses EEDL, EPDL, and EADL files from the [LLNL EPICS 2025](https://nuclear.llnl.gov/EPICS/) database (in ENDF-6 format) and converts them into structured HDF5 files suitable for Monte Carlo transport codes such as [MC/DC](https://github.com/CEMeNT-PSAAP/MCDC).
1111

1212
---
1313

1414
## Package Structure
1515

1616
```
1717
PyEPICS/
18-
├── pyepics/
18+
├── pyepics/ # Source code
1919
│ ├── __init__.py # Public API
2020
│ ├── cli.py # Batch processing CLI
2121
│ ├── exceptions.py # Custom exception hierarchy
@@ -36,15 +36,30 @@ PyEPICS/
3636
│ │ ├── parsing.py # ENDF format parsing helpers
3737
│ │ └── validation.py # Post-parse validation routines
3838
│ └── io/
39-
│ └── download.py # Dataset downloader from IAEA
39+
│ └── download.py # Dataset downloader from LLNL
40+
├── data/ # All data (gitignored)
41+
│ ├── endf/ # Downloaded ENDF source files
42+
│ │ ├── eedl/ # EEDL electron data
43+
│ │ ├── epdl/ # EPDL photon data
44+
│ │ └── eadl/ # EADL atomic relaxation data
45+
│ ├── raw/ # Generated raw HDF5 files
46+
│ │ ├── electron/
47+
│ │ ├── photon/
48+
│ │ └── atomic/
49+
│ └── mcdc/ # Generated MCDC HDF5 files
50+
│ ├── electron/
51+
│ ├── photon/
52+
│ └── atomic/
4053
└── tests/
4154
├── conftest.py # Shared pytest fixtures
4255
├── test_eedl.py # EEDL reader + parsing + validation tests
4356
├── test_epdl.py # EPDL reader tests
4457
├── test_eadl.py # EADL reader tests
4558
├── test_hdf5.py # Legacy HDF5 converter tests
4659
├── test_pipeline.py # Raw + MCDC pipeline tests
47-
└── generate_report.py # PDF regression-test report generator
60+
├── generate_report.py # PDF regression-test report generator
61+
├── fixtures/ # Reference validation data
62+
└── reports/ # Generated regression reports
4863
```
4964

5065
## Architecture
@@ -61,41 +76,41 @@ utils ← models ← readers ← converters (raw_hdf5 / mcdc_hdf5)
6176
| **models** | Typed `dataclass` records (`EEDLDataset`, `EPDLDataset`, `EADLDataset`) — the sole output of readers and sole input to converters |
6277
| **readers** | `EEDLReader`, `EPDLReader`, `EADLReader` — parse ENDF files via the `endf` library and return model instances |
6378
| **converters** | Two-step conversion: `raw_hdf5` (full-fidelity) and `mcdc_hdf5` (transport-optimised) |
64-
| **io** | Dataset download from IAEA |
79+
| **io** | Dataset download from LLNL |
6580
| **cli** | Batch processing for the full pipeline |
6681

6782
## Installation
6883

6984
```bash
7085
pip install numpy h5py endf
71-
# For downloading data from IAEA:
86+
# For downloading data from LLNL:
7287
pip install requests beautifulsoup4
7388
```
7489

7590
---
7691

7792
## Data Pipeline
7893

79-
PyEPICS follows a three-step pipeline, mirroring the PyEEDL workflow:
94+
PyEPICS follows a three-step pipeline:
8095

8196
```
82-
IAEA website download
97+
LLNL website download
8398
│ ─────────────────────►
8499
85-
eedl/ epdl/ eadl/ raw ENDF files (.endf)
100+
data/endf/{eedl,epdl,eadl}/ raw ENDF files (.endf)
86101
│ ─────────────────────►
87102
88-
raw_data/ raw_data_photon/ raw HDF5 (original grids, breakpoints)
89-
raw_data_atomic/ for external users
103+
data/raw/{electron,photon, raw HDF5 (original grids, breakpoints)
104+
atomic}/ for external users
90105
│ ─────────────────────►
91106
92-
mcdc_data/ mcdc_data_photon/ MCDC HDF5 (common grid, PDFs)
93-
mcdc_data_atomic/ for transport codes
107+
data/mcdc/{electron,photon, MCDC HDF5 (common grid, PDFs)
108+
atomic}/ for transport codes
94109
```
95110

96-
### Step 1: Download ENDF Data from IAEA
111+
### Step 1: Download ENDF Data from LLNL
97112

98-
Download all three EPICS libraries (EEDL, EPDL, EADL) from the IAEA Nuclear Data Services:
113+
Download all three EPICS libraries (EEDL, EPDL, EADL) from LLNL Nuclear Data:
99114

100115
```bash
101116
# Download all libraries
@@ -111,9 +126,9 @@ python -m pyepics.cli download --data-dir /path/to/data
111126
This creates three directories with `.endf` files:
112127

113128
```
114-
eedl/ ← EEDL.ZA001000.endf, EEDL.ZA002000.endf, ... (Z=1–100)
115-
epdl/ ← EPDL.ZA001000.endf, ...
116-
eadl/ ← EADL.ZA001000.endf, ...
129+
data/endf/eedl/ ← EEDL.ZA001000.endf, EEDL.ZA002000.endf, ... (Z=1–100)
130+
data/endf/epdl/ ← EPDL.ZA001000.endf, ...
131+
data/endf/eadl/ ← EADL.ZA001000.endf, ...
117132
```
118133

119134
### Step 2: Create Raw HDF5 Files
@@ -137,9 +152,9 @@ python -m pyepics.cli raw --overwrite
137152
Output directories:
138153

139154
```
140-
raw_data/ ← H.h5, He.h5, ..., Fe.h5, ... (electron)
141-
raw_data_photon/ ← H.h5, He.h5, ... (photon)
142-
raw_data_atomic/ ← H.h5, He.h5, ... (atomic relaxation)
155+
data/raw/electron/ ← H.h5, He.h5, ..., Fe.h5, ... (electron)
156+
data/raw/photon/ ← H.h5, He.h5, ... (photon)
157+
data/raw/atomic/ ← H.h5, He.h5, ... (atomic relaxation)
143158
```
144159

145160
### Step 3: Create MCDC HDF5 Files
@@ -160,9 +175,9 @@ python -m pyepics.cli mcdc --z-min 26 --z-max 26 # Fe only
160175
Output directories:
161176

162177
```
163-
mcdc_data/ ← H.h5, He.h5, ..., Fe.h5, ... (electron)
164-
mcdc_data_photon/ ← H.h5, He.h5, ... (photon)
165-
mcdc_data_atomic/ ← H.h5, He.h5, ... (atomic relaxation)
178+
data/mcdc/electron/ ← H.h5, He.h5, ..., Fe.h5, ... (electron)
179+
data/mcdc/photon/ ← H.h5, He.h5, ... (photon)
180+
data/mcdc/atomic/ ← H.h5, He.h5, ... (atomic relaxation)
166181
```
167182

168183
### Full Pipeline (Raw + MCDC in One Step)
@@ -186,14 +201,14 @@ You can also use the pipeline functions directly from Python:
186201
from pyepics import create_raw_hdf5, create_mcdc_hdf5
187202

188203
# Step 2: Raw HDF5
189-
create_raw_hdf5("EEDL", "eedl/EEDL.ZA026000.endf", "raw_data/Fe.h5", overwrite=True)
204+
create_raw_hdf5("EEDL", "data/endf/eedl/EEDL.ZA026000.endf", "data/raw/electron/Fe.h5", overwrite=True)
190205

191206
# Step 3: MCDC HDF5
192-
create_mcdc_hdf5("EEDL", "eedl/EEDL.ZA026000.endf", "mcdc_data/Fe.h5", overwrite=True)
207+
create_mcdc_hdf5("EEDL", "data/endf/eedl/EEDL.ZA026000.endf", "data/mcdc/electron/Fe.h5", overwrite=True)
193208

194209
# Download programmatically
195210
from pyepics.io.download import download_library, download_all
196-
download_library("eedl") # downloads to ./eedl/
211+
download_library("eedl") # downloads to ./data/endf/eedl/
197212
download_all() # downloads all three
198213
```
199214

@@ -206,7 +221,7 @@ from pyepics import EEDLReader
206221

207222
# Parse an EEDL file
208223
reader = EEDLReader()
209-
dataset = reader.read("eedl/EEDL.ZA026000.endf")
224+
dataset = reader.read("data/endf/eedl/EEDL.ZA026000.endf")
210225
print(dataset.Z, dataset.symbol) # 26, "Fe"
211226
print(list(dataset.cross_sections.keys())) # ['xs_tot', 'xs_el', 'xs_lge', ...]
212227
```
@@ -233,12 +248,33 @@ python -m pytest tests/ -v
233248

234249
## Backward Compatibility
235250

236-
A `pyeedl_compat` shim re-exports all legacy `pyeedl` symbols:
251+
A `pyeedl_compat` shim re-exports legacy API symbols for backward compatibility:
237252

238253
```python
239254
from pyepics.pyeedl_compat import PERIODIC_TABLE, float_endf, SUBSHELL_LABELS
240255
```
241256

257+
## Data Sources
258+
259+
PyEPICS uses the following authoritative data sources:
260+
261+
| Data Type | Source | Reference |
262+
|---|---|---|
263+
| **Electron cross sections** | EEDL (Evaluated Electron Data Library) | [LLNL EPICS 2025](https://nuclear.llnl.gov/EPICS/) |
264+
| **Photon cross sections** | EPDL (Evaluated Photon Data Library) | [LLNL EPICS 2025](https://nuclear.llnl.gov/EPICS/) |
265+
| **Atomic relaxation** | EADL (Evaluated Atomic Data Library) | [LLNL EPICS 2025](https://nuclear.llnl.gov/EPICS/) |
266+
| **Binding energies** | EADL via ENDF-6 format (not NIST) | Parsed from EADL `.endf` files |
267+
| **Physical constants** | NIST CODATA 2018 | [NIST CODATA](https://physics.nist.gov/cuu/pdf/wallet_2018.pdf) |
268+
269+
> **Note:** Binding energies are sourced from EADL (parsed from ENDF files), not from
270+
> the NIST X-Ray Transition Energies database. The reference validation data in
271+
> `tests/fixtures/reference_binding_energies.csv` is extracted from EEDL ENDF files
272+
> and compared against the PyEPICS-parsed values to ensure round-trip consistency.
273+
274+
## Acknowledgements
275+
276+
This work was supported by the Center for Advancing the Radiation Resilience of Electronics (CARRE), a PSAAP-IV project funded by the Department of Energy, grant number: DE-NA0004268.
277+
242278
## License
243279

244280
Please see [LICENSE](LICENSE) for details.

docs/_static/.gitkeep

Whitespace-only changes.

docs/conf.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Configuration file for the Sphinx documentation builder.
22

3+
import os
4+
import sys
5+
6+
# Add parent directory to path so autodoc can import pyepics
7+
sys.path.insert(0, os.path.abspath(".."))
8+
39
project = "PyEPICS"
410
copyright = "2026, Melek Derman"
511
author = "Melek Derman"
@@ -13,6 +19,15 @@
1319
"myst_parser",
1420
]
1521

22+
# Autodoc settings
23+
autodoc_member_order = "bysource"
24+
autodoc_typehints = "description"
25+
26+
# Napoleon settings (Google/NumPy-style docstrings)
27+
napoleon_google_docstring = True
28+
napoleon_numpy_docstring = True
29+
napoleon_include_init_with_doc = True
30+
1631
templates_path = ["_templates"]
1732
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
1833

0 commit comments

Comments
 (0)