Skip to content

Commit 731ec91

Browse files
committed
updates to MCDC dataset generator
1 parent 17286c7 commit 731ec91

15 files changed

Lines changed: 381 additions & 73 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
# id-token: write
9696
# environment:
9797
# name: pypi
98-
# url: https://pypi.org/p/pyepics-data
98+
# url: https://pypi.org/p/epics
9999
# steps:
100100
# - uses: actions/download-artifact@v4
101101
# with:

.github/workflows/workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
build-n-publish:
99
name: Build and publish to PyPI
1010
runs-on: ubuntu-latest
11+
environment: pypi
1112
permissions:
1213
id-token: write
1314
contents: read

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Changelog
2+
3+
All notable changes to PyEPICS are documented in this file.
4+
5+
## [1.0.0] — 2026-02-15
6+
7+
### Added
8+
9+
- **Combined MCDC HDF5 output**: Each element now produces a single HDF5
10+
file (e.g. `Fe.h5`) containing `electron_reactions`, `photon_reactions`,
11+
and `atomic_relaxation` groups together.
12+
- `create_combined_mcdc_hdf5()` — new public API for writing combined files.
13+
- `write_mcdc_combined()` — low-level writer accepting EEDL/EPDL/EADL datasets.
14+
- Full **EPDL** (photon) support: reader, raw HDF5, MCDC HDF5 — cross sections,
15+
form factors, photoelectric subshells, pair production.
16+
- Full **EADL** (atomic relaxation) support: reader, raw HDF5, MCDC HDF5 —
17+
subshell binding energies, radiative/non-radiative transitions,
18+
fluorescence and Auger yields.
19+
- `EPICSClient` — high-level API for querying element properties across
20+
all three libraries (EEDL, EPDL, EADL).
21+
- `ElementProperties` — container with binding energies, cross sections,
22+
fluorescence data, and transition energies.
23+
- CLI tool (`epics`) for download, raw, mcdc, and full pipeline execution.
24+
- Sphinx documentation with API reference, data-sources guide, and pipeline docs.
25+
- 164 unit tests covering readers, converters, mapping completeness, and pipeline.
26+
- PDF regression-test report generator.
27+
28+
### Changed
29+
30+
- **PyPI package name** changed from `pyepics-data` to `epics`.
31+
Import name remains `pyepics` (`import pyepics`).
32+
- Electron-specific constants renamed for clarity:
33+
`MF_MT``ELECTRON_MF_MT`,
34+
`SECTIONS_ABBREVS``ELECTRON_SECTIONS_ABBREVS`,
35+
`SUBSHELL_LABELS``ELECTRON_SUBSHELL_LABELS`.
36+
Old names kept as backward-compatible aliases.
37+
- MCDC CLI now produces one combined file per element in `data/mcdc/`
38+
(previously separated into `data/mcdc/electron/`, `photon/`, `atomic/`).
39+
40+
## [0.1.0] — 2026-12-18
41+
42+
### Added
43+
44+
- Initial release with EEDL (electron) reader and HDF5 converter.
45+
- Basic constant dictionaries and utility functions.
46+
- PyEEDL backward-compatibility layer (`pyepics.pyeedl_compat`).

INSTALL.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PyEPICS requires **Python 3.11 or later** (3.11, 3.12, 3.13).
77
## Quick Install from PyPI
88

99
```bash
10-
pip install pyepics-data
10+
pip install epics
1111
```
1212

1313
This installs the core package with the minimum required dependencies
@@ -19,23 +19,23 @@ PyEPICS defines optional dependency groups you can install as needed:
1919

2020
| Extra | What it adds | Install command |
2121
|------------|-------------------------------------|------------------------------------------|
22-
| `download` | `requests`, `beautifulsoup4` | `pip install "pyepics-data[download]"` |
23-
| `pandas` | `pandas` | `pip install "pyepics-data[pandas]"` |
24-
| `plot` | `matplotlib` | `pip install "pyepics-data[plot]"` |
25-
| `all` | All optional dependencies | `pip install "pyepics-data[all]"` |
26-
| `dev` | Testing + linting + docs tooling | `pip install "pyepics-data[dev]"` |
22+
| `download` | `requests`, `beautifulsoup4` | `pip install "epics[download]"` |
23+
| `pandas` | `pandas` | `pip install "epics[pandas]"` |
24+
| `plot` | `matplotlib` | `pip install "epics[plot]"` |
25+
| `all` | All optional dependencies | `pip install "epics[all]"` |
26+
| `dev` | Testing + linting + docs tooling | `pip install "epics[dev]"` |
2727

2828
### Examples
2929

3030
```bash
3131
# Core only (reading ENDF files and converting to HDF5)
32-
pip install pyepics-data
32+
pip install epics
3333

3434
# With plotting and pandas for interactive exploration
35-
pip install "pyepics-data[plot,pandas]"
35+
pip install "epics[plot,pandas]"
3636

3737
# Everything (including download support)
38-
pip install "pyepics-data[all]"
38+
pip install "epics[all]"
3939
```
4040

4141
## Developer Install
@@ -99,8 +99,8 @@ This produces:
9999

100100
```
101101
dist/
102-
├── pyepics_data-0.1.0.tar.gz # sdist
103-
└── pyepics_data-0.1.0-py3-none-any.whl # wheel
102+
├── epics-0.1.0.tar.gz # sdist
103+
└── epics-0.1.0-py3-none-any.whl # wheel
104104
```
105105

106106
## Verifying the Install
@@ -125,5 +125,5 @@ print("EPICSClient loaded successfully")
125125

126126
```bash
127127
conda install numpy h5py
128-
pip install pyepics-data
128+
pip install epics
129129
```

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License: BSD-3](https://img.shields.io/badge/license-BSD--3--Clause-green.svg)](LICENSE)
66
[![ReadTheDocs](https://readthedocs.org/projects/pyepics/badge/?version=latest)](https://pyepics.readthedocs.io/en/latest/)
77

8-
> Python library for reading and converting EPICS (Electron Photon Interaction Cross Sections) nuclear data.
8+
> Python library for reading and converting EPICS (Electron Photon Interaction Cross Sections) nuclear data by LLNL.
99
1010
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

@@ -87,10 +87,10 @@ utils ← models ← readers ← converters (raw_hdf5 / mcdc_hdf5)
8787

8888
```bash
8989
# From PyPI (when published)
90-
pip install pyepics-data
90+
pip install epics
9191

9292
# With all optional dependencies
93-
pip install "pyepics-data[all]"
93+
pip install "epics[all]"
9494

9595
# From source (editable, for development)
9696
git clone https://github.com/melekderman/PyEPICS.git

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = "PyEPICS"
1010
copyright = "2026, Melek Derman"
1111
author = "Melek Derman"
12-
release = "0.1.0"
12+
release = "1.0.0"
1313

1414
extensions = [
1515
"sphinx.ext.autodoc",

docs/getting_started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Getting Started
44
Installation
55
------------
66

7-
From PyPI (when published):
7+
From PyPI:
88

99
.. code-block:: bash
1010
11-
pip install pyepics-data
11+
pip install epics
1212
1313
With optional extras:
1414

1515
.. code-block:: bash
1616
1717
# Plotting and pandas support
18-
pip install "pyepics-data[plot,pandas]"
18+
pip install "epics[plot,pandas]"
1919
2020
# All optional dependencies
21-
pip install "pyepics-data[all]"
21+
pip install "epics[all]"
2222
2323
From source (development):
2424

pyepics/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@
4848

4949
from __future__ import annotations
5050

51-
__version__ = "0.1.0"
51+
__version__ = "1.0.0"
5252
__author__ = "Melek Derman"
5353

5454
from pyepics.client import ElementProperties, EPICSClient
5555
from pyepics.converters.hdf5 import (
5656
convert_dataset_to_hdf5,
57+
create_combined_mcdc_hdf5,
5758
create_mcdc_hdf5,
5859
create_raw_hdf5,
5960
)
@@ -83,6 +84,7 @@
8384
"convert_dataset_to_hdf5",
8485
"create_raw_hdf5",
8586
"create_mcdc_hdf5",
87+
"create_combined_mcdc_hdf5",
8688
# Exceptions
8789
"PyEPICSError",
8890
"ParseError",

pyepics/cli.py

Lines changed: 62 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
photon/ ← raw HDF5 (photon)
4444
atomic/ ← raw HDF5 (atomic)
4545
mcdc/
46-
electron/ MCDC HDF5 (electron)
47-
photon/ ← MCDC HDF5 (photon)
48-
atomic/ ← MCDC HDF5 (atomic)
46+
H.h5 ← combined MCDC (electron + photon + atomic)
47+
He.h5
48+
...
4949
"""
5050

5151
from __future__ import annotations
@@ -189,52 +189,74 @@ def cmd_raw(args):
189189

190190

191191
def cmd_mcdc(args):
192-
"""Create MCDC-format HDF5 files from ENDF sources."""
193-
from pyepics.converters.hdf5 import create_mcdc_hdf5
192+
"""Create combined MCDC-format HDF5 files (one per element).
193+
194+
Each output file contains ``electron_reactions``,
195+
``photon_reactions``, and ``atomic_relaxation`` groups — whichever
196+
ENDF sources are available for that element.
197+
"""
198+
from pyepics.converters.hdf5 import create_combined_mcdc_hdf5
194199

195200
base = Path(args.data_dir)
196-
libraries = args.libraries or list(LIBRARY_CONFIG.keys())
197201
z_min, z_max = args.z_min, args.z_max
198202

199-
total_ok = 0
200-
total_fail = 0
203+
mcdc_dir = base / "data/mcdc"
204+
mcdc_dir.mkdir(parents=True, exist_ok=True)
201205

202-
for lib_name in libraries:
203-
cfg = LIBRARY_CONFIG[lib_name]
204-
endf_dir = base / cfg["endf_dir"]
205-
mcdc_dir = base / cfg["mcdc_dir"]
206-
mcdc_dir.mkdir(parents=True, exist_ok=True)
206+
# ENDF directories
207+
eedl_dir = base / LIBRARY_CONFIG["electron"]["endf_dir"]
208+
epdl_dir = base / LIBRARY_CONFIG["photon"]["endf_dir"]
209+
eadl_dir = base / LIBRARY_CONFIG["atomic"]["endf_dir"]
207210

208-
print(f"\n{'=' * 60}")
209-
print(f" Creating MCDC HDF5: {lib_name} ({cfg['dataset_type']})")
210-
print(f" ENDF source: {endf_dir}")
211-
print(f" Output: {mcdc_dir}")
212-
print(f" Z range: {z_min}{z_max}")
213-
print(f"{'=' * 60}")
211+
print(f"\n{'=' * 60}")
212+
print(f" Creating combined MCDC HDF5 files")
213+
print(f" Output: {mcdc_dir}")
214+
print(f" Z range: {z_min}{z_max}")
215+
print(f"{'=' * 60}")
214216

215-
for Z in range(z_min, z_max + 1):
216-
sym = _element_symbol(Z)
217-
endf_file = _find_endf_file(endf_dir, cfg["endf_prefix"], Z)
218-
if endf_file is None:
219-
continue
217+
total_ok = 0
218+
total_fail = 0
220219

221-
out_path = mcdc_dir / f"{sym}.h5"
222-
print(f" Z={Z:3d} ({sym:>2s}): {endf_file.name} -> {out_path.name}", end=" ... ", flush=True)
220+
for Z in range(z_min, z_max + 1):
221+
sym = _element_symbol(Z)
222+
eedl_file = _find_endf_file(eedl_dir, "EEDL", Z)
223+
epdl_file = _find_endf_file(epdl_dir, "EPDL", Z)
224+
eadl_file = _find_endf_file(eadl_dir, "EADL", Z)
225+
226+
if not any([eedl_file, epdl_file, eadl_file]):
227+
continue
228+
229+
libs = []
230+
if eedl_file:
231+
libs.append("EEDL")
232+
if epdl_file:
233+
libs.append("EPDL")
234+
if eadl_file:
235+
libs.append("EADL")
236+
237+
out_path = mcdc_dir / f"{sym}.h5"
238+
print(
239+
f" Z={Z:3d} ({sym:>2s}): {'+'.join(libs)} -> {out_path.name}",
240+
end=" ... ",
241+
flush=True,
242+
)
223243

224-
try:
225-
create_mcdc_hdf5(
226-
cfg["dataset_type"],
227-
endf_file,
228-
out_path,
229-
overwrite=args.overwrite,
230-
)
231-
print("OK")
232-
total_ok += 1
233-
except Exception as exc:
234-
print(f"FAIL: {exc}")
235-
total_fail += 1
236-
if not args.continue_on_error:
237-
return 1
244+
try:
245+
create_combined_mcdc_hdf5(
246+
Z,
247+
out_path,
248+
eedl_path=eedl_file,
249+
epdl_path=epdl_file,
250+
eadl_path=eadl_file,
251+
overwrite=args.overwrite,
252+
)
253+
print("OK")
254+
total_ok += 1
255+
except Exception as exc:
256+
print(f"FAIL: {exc}")
257+
total_fail += 1
258+
if not args.continue_on_error:
259+
return 1
238260

239261
print(f"\nMCDC HDF5: {total_ok} OK, {total_fail} failed")
240262
return 0 if total_fail == 0 else 1

pyepics/converters/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,23 @@
1616
Writes a "raw" HDF5 preserving original grids and breakpoints.
1717
* :func:`~pyepics.converters.hdf5.create_mcdc_hdf5`
1818
Writes an MCDC-optimised HDF5 with common energy grid and PDFs.
19+
* :func:`~pyepics.converters.hdf5.create_combined_mcdc_hdf5`
20+
Creates a single MCDC HDF5 per element with electron, photon,
21+
and atomic data combined.
1922
"""
2023

2124
from __future__ import annotations
2225

2326
from pyepics.converters.hdf5 import (
2427
convert_dataset_to_hdf5,
28+
create_combined_mcdc_hdf5,
2529
create_mcdc_hdf5,
2630
create_raw_hdf5,
2731
)
2832

29-
__all__ = ["convert_dataset_to_hdf5", "create_raw_hdf5", "create_mcdc_hdf5"]
33+
__all__ = [
34+
"convert_dataset_to_hdf5",
35+
"create_raw_hdf5",
36+
"create_mcdc_hdf5",
37+
"create_combined_mcdc_hdf5",
38+
]

0 commit comments

Comments
 (0)