Python bindings for GRHayL (EOS-first preview)
Project description
pyghl
This directory contains Python bindings for GRHayL, including enough tabulated-EOS
and con2prim functionality to reproduce the neural-network dataset/testing
generators in Unit_Tests/data_gen.
What is included
pyghl.initialize_params(...)pyghl.initialize_metric(...)pyghl.compute_ADM_auxiliaries(...)pyghl.initialize_primitives(...)pyghl.initialize_diagnostics(...)pyghl.compute_conservs(...)pyghl.undensitize_conservatives(...)pyghl.compute_SU_Bsq_Ssq_BdotS(...)pyghl.limit_v_and_compute_u0(...)pyghl.limit_utilde_and_compute_v(...)pyghl.guess_primitives(...)pyghl.tabulated_Palenzuela1D_energy(...)pyghl.nn_c2p_guess(eos, ...)pyghl.nn_c2p_guess_x(eos, ...)- Struct wrappers:
pyghl.Primitivepyghl.Conservativepyghl.Metricpyghl.ADMAuxpyghl.Diagnostics
pyghl.eos.initialize_tabulated_eos_functions_and_params(...)pyghl.nnhelpers:flat_metric()guess(eos, ...)guess_x(eos, ...)nn_initial_guess(...)iter_dataset_points(...)read_training_dataset(...)train_regressor(...)train_on_dataset(...)save_inference_bundle(...)load_inference_bundle(...)export_to_c_header(...)
TabulatedEOSmethods:tabulated_enforce_bounds_rho_Ye_Ttabulated_enforce_bounds_rho_Ye_epstabulated_compute_P_from_Ttabulated_compute_eps_from_Ttabulated_compute_cs2_from_Ttabulated_compute_P_eps_from_Ttabulated_compute_P_eps_S_from_Ttabulated_compute_T_from_epstabulated_compute_P_T_from_eps
Build requirements
- The pinned GRHayL submodule initialized at
extern/GRHayL, orGRHAYL_DIRset to a configured GRHayL checkout. - HDF5 enabled in GRHayL build.
- Python build tooling (
pip,setuptools, compiler toolchain).
Install (from repo root)
Initialize the pinned GRHayL source:
git submodule update --init --recursive
Install:
python3 -m pip install -e .
Offline or restricted-network environments:
python3 -m pip install --no-build-isolation -e .
The build step runs:
make -C extern/GRHayL grhayl
and then compiles the Python extension against extern/GRHayL/build/lib/libghl.so.
Set GRHAYL_DIR=/path/to/GRHayL to build against a different local checkout.
If editable install is not available in your environment, you can work from the repository root with:
PYTHONPATH=src python3 ...
Example
import pyghl as ghl
params = ghl.initialize_params()
eos = ghl.eos.initialize_tabulated_eos_functions_and_params(
params,
"Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5",
)
rho = 1e-12
Y_e = 0.05
T = 1e2
rho, Y_e, T = eos.tabulated_enforce_bounds_rho_Ye_T(rho, Y_e, T)
P = eos.tabulated_compute_P_from_T(rho, Y_e, T)
You can also pass a short table name and set GRHAYL_EOS_TABLE_DIR.
Neural-network data generators
The following example scripts mirror the C generators in
Unit_Tests/data_gen:
examples/nn_c2p_generate_dataset.pyexamples/nn_c2p_test.pyexamples/nn_c2p_train.py
The same tools are also importable/runnable as package modules:
-
pyghl train <eos-file> [dataset] ... -
pyghl append-eos <eos-file> [nn-hdf5] ... -
python -m pyghl.nn_c2p.nn_c2p_generate_dataset ... -
python -m pyghl.nn_c2p.nn_c2p_train ... -
python -m pyghl.nn_c2p.nn_c2p_test ... -
python -m pyghl.nn_c2p.append_eos_file ... -
python -m pyghl.nn_c2p.check_eos ... -
python -m pyghl.nn_c2p.list_installed_models -
python -m pyghl.nn_c2p.remove_eos_nn ...
Example:
PYTHONPATH=src python3 examples/nn_c2p_generate_dataset.py \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5 \
train --n-pts 2 --output /tmp/nn_training_dataset.bin
PYTHONPATH=src python3 examples/nn_c2p_test.py \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5 \
/tmp/nn_training_dataset.bin --limit 8
python3 -m pyghl.nn_c2p.nn_c2p_generate_dataset \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5 \
train
pyghl train \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5
pyghl train \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5 \
/tmp/nn_training_dataset.bin
pyghl append-eos \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5 \
/tmp/tiny_mlp_model.h5
pyghl append-eos \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5
python3 -m pyghl.nn_c2p.list_installed_models
python3 -m pyghl.nn_c2p.check_eos \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5
python3 -m pyghl.nn_c2p.remove_eos_nn \
Unit_Tests/sample_table/Hempel_SFHoEOS_rho222_temp180_ye60_version_1.1_20120817_simple.h5
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyghl-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
263f5b89eb724b0339c9501ca409d0c4ee6da0b4fd94ea96cbb3d54a8ba12162
|
|
| MD5 |
67c25433edfe0302e76c7feb5880c96f
|
|
| BLAKE2b-256 |
e011e7872ad696f5c846c38a7e47453190c4ea1dfc4cedff24296d27733c6e06
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl -
Subject digest:
263f5b89eb724b0339c9501ca409d0c4ee6da0b4fd94ea96cbb3d54a8ba12162 - Sigstore transparency entry: 2013336607
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp313-cp313-macosx_14_0_arm64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp313-cp313-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.13, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447487d71b960d1cad1aab924cb9acb1329e37b32b2bf0998b3e92f609e3804c
|
|
| MD5 |
8e2ab7c3a15866fd88094340722ce934
|
|
| BLAKE2b-256 |
895d4f6cf31ca895cee136bebdf787cd1f1d2c8ca679f08b299f6489548b54b1
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp313-cp313-macosx_14_0_arm64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp313-cp313-macosx_14_0_arm64.whl -
Subject digest:
447487d71b960d1cad1aab924cb9acb1329e37b32b2bf0998b3e92f609e3804c - Sigstore transparency entry: 2013337071
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41df1d29979155f4582c70f75873d0afb8f8a307b10187e3e138e480b838e0dc
|
|
| MD5 |
1162459037d1d3905265c4a5d6ee22f7
|
|
| BLAKE2b-256 |
e24fef7879b302de85cab8689641a486cb72cd7d5b101169e000cc94fd03a638
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
41df1d29979155f4582c70f75873d0afb8f8a307b10187e3e138e480b838e0dc - Sigstore transparency entry: 2013336910
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp312-cp312-macosx_14_0_arm64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp312-cp312-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.12, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ea4d273ca4a4c7534ba261aa326ca737cc175781a056b94a41411bb7bc7e72
|
|
| MD5 |
7bd06683d0002af9e6eb8feda683c00e
|
|
| BLAKE2b-256 |
0777b51097ae9c976e5c5cfa455c4b770083d694ad1c79765b3738699c850dba
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp312-cp312-macosx_14_0_arm64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp312-cp312-macosx_14_0_arm64.whl -
Subject digest:
02ea4d273ca4a4c7534ba261aa326ca737cc175781a056b94a41411bb7bc7e72 - Sigstore transparency entry: 2013336450
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0370eabfc6ec2393dfc50fab6e0d447eef8ab2510aca13c121475f288a2ed9f2
|
|
| MD5 |
783356c687e5679976b2dc00decc857f
|
|
| BLAKE2b-256 |
d6a1492b20852f31d71d15813313dc167b5c993cbf561ab5e1095c568c4311f4
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
0370eabfc6ec2393dfc50fab6e0d447eef8ab2510aca13c121475f288a2ed9f2 - Sigstore transparency entry: 2013336982
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp311-cp311-macosx_14_0_arm64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp311-cp311-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.11, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb18473e1fed844c5cbbce502a258943e9ae67e9ba2e3fd585787765b7b84468
|
|
| MD5 |
7d881d77632d85c915da3c37d1a43809
|
|
| BLAKE2b-256 |
b938a0b26aa2a227e2ae9a3173a4b1f4d7cf0b0c98176c8c95a6e4d970eb20cf
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp311-cp311-macosx_14_0_arm64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp311-cp311-macosx_14_0_arm64.whl -
Subject digest:
cb18473e1fed844c5cbbce502a258943e9ae67e9ba2e3fd585787765b7b84468 - Sigstore transparency entry: 2013336713
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa0ce5d661770c8509f4a91493cf4ef03c8af00e113b125801673e572c652889
|
|
| MD5 |
2c7e3b8d915d1a01da61b1f0097a58f5
|
|
| BLAKE2b-256 |
86edd4b6d67812d3eb94776b3b697a385fa66141c034772c12dbac34a93867a7
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl -
Subject digest:
aa0ce5d661770c8509f4a91493cf4ef03c8af00e113b125801673e572c652889 - Sigstore transparency entry: 2013336803
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyghl-0.1.0-cp310-cp310-macosx_14_0_arm64.whl.
File metadata
- Download URL: pyghl-0.1.0-cp310-cp310-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c012970c85c6fd844a713374467b2dc608889aeddde7c23948d1c5d483a57562
|
|
| MD5 |
c943f9989cb880bd95055f9b6407f5fa
|
|
| BLAKE2b-256 |
670284263eef82919eb948a8d634ad89452e4b3afef9379a0631a21ab4c2a158
|
Provenance
The following attestation bundles were made for pyghl-0.1.0-cp310-cp310-macosx_14_0_arm64.whl:
Publisher:
publish.yml on GRHayL/pyghl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyghl-0.1.0-cp310-cp310-macosx_14_0_arm64.whl -
Subject digest:
c012970c85c6fd844a713374467b2dc608889aeddde7c23948d1c5d483a57562 - Sigstore transparency entry: 2013336540
- Sigstore integration time:
-
Permalink:
GRHayL/pyghl@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GRHayL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c1529fee0506e59c9ce3ec1abfc532b9f0c905 -
Trigger Event:
release
-
Statement type: