"Python workflow framework for FISPACT."
Project description
Description
The module loads FISPACT JSON output files and converts to Polars dataframes with minor data normalization. This allows efficient data extraction and aggregation. Multiple JSON files can be combined using simple additional identification for different FISPACT runs. So far we use just two-dimensional identification by material and case. The case usually identifies certain neutron flux.
Implemented functionality
export to DuckDB
export to parquet files
Installation
From PyPI
pip install xpypact
As dependency
poetry add xpypact
From source
pip install htpps://github.com/MC-kit/xpypact.git
Examples
from xpypact import FullDataCollector, Inventory
def get_material_id(p: Path) -> int:
...
def get_case_id(p: Path) -> int:
...
jsons = [path1, path2, ...]
material_ids = {p: get_material_id(p) for p in jsons }
case_ids = {c:: get_case_id(p) for p in jsons
collector = FullDataCollector()
for json in jsons:
inventory = Inventory.from_json(json)
collector.append(inventory, material_id=material_ids[json], case_id=case_ids[json])
collected = collector.get_result()
# save to parquet files
collected.save_to_parquets(Path.cwd() / "parquets")
# or use DuckDB database
import from xpypact.dao save
import duckdb as db
con = db.connect()
save(con, collected)
gamma_from_db = con.sql(
"""
select
g, rate
from timestep_gamma
where material_id = 1 and case_id = 54 and time_step_number = 7
order by g
""",
).fetchall()
Contributing
Just follow ordinary practice:
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xpypact-0.11.0.tar.gz
(24.5 kB
view hashes)
Built Distribution
xpypact-0.11.0-py3-none-any.whl
(21.3 kB
view hashes)