PALEOS-API live tabulation (producer)
Live producer side of the PALEOS-API:* registry family. Generates 10-column P-T .dat files bit-format-identical to the shipped EOS_PALEOS_* Zenodo tables, but sourced at runtime from the installed paleos Python package rather than from a flat-file checkout. This lets users opt into a different upstream PALEOS version (or a custom phase map) without re-publishing tables. The output is consumed unchanged by eos.interpolation.load_paleos_table (density + nabla_ad) and by eos_export.load_paleos_all_properties (SPIDER P-S export). Cache logic and on-disk layout live in paleos_api_cache; this module contains pure producers only.
The PALEOS-API path is tested with the PALEOS commit PALEOS_TESTED_SHA. At its first use in a process for each PALEOS SHA, in the cache resolvers and in the two generators, check_paleos_commit reads the commit of the installed PALEOS checkout: that commit runs, and a newer one that contains it runs with a warning. An older or unrelated commit, a clone that lacks the tested commit (a shallow clone is told to git fetch --unshallow), a paleos package that is not a tracked file of its checkout (a copy in a virtual environment, for example), a PALEOS installed without git, or package files that cannot be read stop with PaleosVersionError. So does package code that differs from its commit: an edit, a deleted module, older package files checked out at a newer commit, an untracked file Python imports (.py, .so, .pyd, or a .pyc outside __pycache__, ignored or not), or such a file added to the index but not committed. A link to a directory, a nested repository or a submodule under paleos/, committed or not, stops also with the opt-in below, because no key can describe the code in it; a plain untracked directory counts only through the files in it that Python imports. Setting ZALMOXIS_PALEOS_ALLOW_DIRTY=1 lets such code run with a warning, for a custom phase map; its key gets -dirty- and a hash of that code after the SHA, so each such state has its own cache. Tracked files are compared by content as git hashes them without filters, so a checkout with line-end conversion or a clean filter counts as changed, and a symlink by its target; a paleos package below the top of its repository (under src/, for example) is compared by its paths in the repository; a mode change, __pycache__ and files Python does not import do not count. git runs without the repository variables of the caller (GIT_DIR and the like). In one process the code in memory is the code of the first import, so a serial build stops when the key has moved since the first key; when paleos was imported before that first key, a warning says that a change on disk before it is not covered. The cache key also holds build_key: the RTpress install (version and commit), the md5 of the AQUA table for H2O, and the numpy, scipy and sympy versions. For an editable RTpress the key holds its HEAD only, so uncommitted edits to RTpress are not keyed; for RTpress installed from a directory without git it holds the version only. The scheduled workflow paleos-main.yml runs tools/check_paleos_main.py each day and fails when PALEOS main is at another commit or is not found, when GitHub refuses the request (401, or 403 with requests left and no Retry-After), or when the pin cannot be read or is no 40-character lowercase commit SHA; a used-up or secondary rate limit, a 5xx or a network fault only warns; a Zalmoxis change then moves PALEOS_TESTED_SHA once the PALEOS-API tests pass on it.
paleos_api
Live PALEOS tabulation — PALEOS-API:* producer side.
Generates 10-column P-T .dat files bit-format-identical to the shipped
EOS_PALEOS_* Zenodo tables, but sourced at runtime from import paleos
rather than from a flat-file checkout. Output is consumed unchanged by the
existing readers: zalmoxis.eos.interpolation.load_paleos_table (density +
nabla_ad path) and zalmoxis.eos_export.load_paleos_all_properties
(SPIDER P-S export path).
Two entry points:
generate_paleos_api_unified_table— one file per material, stable-phase dispatch (matchesEOS_PALEOS_{iron,MgSiO3_unified,H2O}).generate_paleos_api_2phase_mgsio3_tables— two files (solid + liquid) with metastable extensions, matchingEOS_PALEOS_MgSiO3/paleos_mgsio3_tables_pt_proteus_{solid,liquid}.dat. Aragog's P-S table build feeds these toeos_export.generate_spider_eos_tablesassolid_eos_fileandliquid_eos_fileso that mushy-zone mixing uses phase-specific endpoints rather than interpolating across the melting curve.
Cache / registry wiring is handled by paleos_api_cache.py and the
PALEOS-API:* registry entries. This module contains pure producers
only; no cache logic lives here.
Design notes
The 2-phase solid-side picker reaches into PALEOS internals
(_phase_eos_map, the phase-boundary functions, _P_HPCEN_BRG). These
are not a committed public API. The PALEOS SHA is recorded in the output
header so any upstream rename is caught by a cache-key miss. Once a public
get_mgsio3_solid_phase + generate_twophase_pt_tables helper is
contributed upstream, the internals access here collapses to one public
call.
PALEOS_TESTED_SHA = '654aca9ec6116d2ad319d984a3f68e11ddef2fb4'
module-attribute
ALLOW_DIRTY_ENV = 'ZALMOXIS_PALEOS_ALLOW_DIRTY'
module-attribute
GridSpec(p_lo, p_hi, n_p, t_lo, t_hi, n_t)
dataclass
Log-uniform (P, T) grid specification.
Pressure axis is log-uniform in [p_lo, p_hi] Pa with n_p points.
Temperature axis is log-uniform in [t_lo, t_hi] K with n_t
points, matching the Zenodo shipped tables (which are log-uniform in
both axes at 150 pts/decade).
Attributes:
| Name | Type | Description |
|---|---|---|
p_lo, p_hi |
float
|
Pressure bounds [Pa]. |
n_p |
int
|
Number of pressure nodes. |
t_lo, t_hi |
float
|
Temperature bounds [K]. |
n_t |
int
|
Number of temperature nodes. |
axes()
Return (P_axis [Pa], T_axis [K]) as 1D numpy arrays.
Source code in src/zalmoxis/eos/paleos_api.py
105 106 107 108 109 | |
hash_short()
SHA-1 short digest for cache keying.
Source code in src/zalmoxis/eos/paleos_api.py
100 101 102 103 | |
PaleosVersionError
Bases: Exception
The installed PALEOS code cannot be shown to contain PALEOS_TESTED_SHA: it is
older or unrelated, not installed, not a tracked package of a git checkout, or git
cannot read it.
Not a RuntimeError or ValueError, so a caller that turns those into a failed structure solve does not hide it.
make_grid_at_resolution(p_lo, p_hi, t_lo, t_hi, pts_per_decade=DEFAULT_PTS_PER_DECADE)
Build a GridSpec with a uniform log-log resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_lo
|
float
|
Pressure bounds [Pa], both > 0. |
required |
p_hi
|
float
|
Pressure bounds [Pa], both > 0. |
required |
t_lo
|
float
|
Temperature bounds [K], both > 0. |
required |
t_hi
|
float
|
Temperature bounds [K], both > 0. |
required |
pts_per_decade
|
int
|
Nodes per decade on each axis. Default
|
DEFAULT_PTS_PER_DECADE
|
Source code in src/zalmoxis/eos/paleos_api.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
make_default_grid_iron()
Default Fe grid: 1e5 to 1e14 Pa, 300 to 20000 K at 600 pts/decade.
Source code in src/zalmoxis/eos/paleos_api.py
167 168 169 | |
make_default_grid_mgsio3()
Default MgSiO3 grid: 1e5 to 1e14 Pa, 300 to 11500 K at 600 pts/decade.
Source code in src/zalmoxis/eos/paleos_api.py
172 173 174 | |
make_default_grid_h2o()
Default H2O grid: 0.1 Pa to 1e14 Pa, 150 to 1e5 K at 600 pts/decade.
Wider P range than Fe/MgSiO3 to match AQUA table coverage (extends to
1 micro-bar). H2O is table-backed in PALEOS (Haldemann20) so per-point
cost is low.
Source code in src/zalmoxis/eos/paleos_api.py
177 178 179 180 181 182 183 184 | |
check_paleos_commit(repo_dir=None, tested=None)
Return 'tested', 'newer' or 'dirty' for the PALEOS checkout in repo_dir.
A checkout at tested (default PALEOS_TESTED_SHA) runs; one that descends
from it runs with a warning. Package code that differs from its commit stops, unless
ZALMOXIS_PALEOS_ALLOW_DIRTY=1 lets it run with a warning.
Returns:
| Type | Description |
|---|---|
str
|
|
Raises:
| Type | Description |
|---|---|
PaleosVersionError
|
If PALEOS is not installed, its package is not a tracked file of a git checkout,
the checkout does not contain |
Source code in src/zalmoxis/eos/paleos_api.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
paleos_installed_sha()
Return the git SHA of the installed PALEOS checkout, or a fallback string.
A checkout whose package code differs from its commit gets -dirty-<8 hex> after
the SHA, a hash of that code, so each set of changes has its own cache. Without git
the result is version-<paleos.__version__>, and without PALEOS
paleos-not-installed. The first result is kept for :func:_same_code_as_import;
when paleos was imported before it, a warning says that changes before this call are
not covered.
Source code in src/zalmoxis/eos/paleos_api.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
build_inputs(material, h2o_table_path=None)
Return what a PALEOS-API table depends on besides the PALEOS code and the grid: the RTpress install (the Wolf18 liquid), the md5 of the AQUA table of H2O, and the numpy, scipy and sympy versions.
Source code in src/zalmoxis/eos/paleos_api.py
397 398 399 400 401 402 403 404 405 | |
build_key(material, h2o_table_path=None)
Return an 8-character hash of :func:build_inputs, part of the cache key.
Source code in src/zalmoxis/eos/paleos_api.py
408 409 410 411 | |
generate_paleos_api_unified_table(material, out_path, grid, *, h2o_table_path=None, log_every=50, n_workers=1)
Generate a unified PALEOS .dat for one material.
Stable-phase dispatch: for each (P, T) the PALEOS top-level class
(IronEoS / MgSiO3EoS / WaterEoS) chooses the thermodynamically
stable phase and evaluates that phase's EoS. Phase label is PALEOS's
intrinsic string ('solid-hpcen', 'liquid', 'hcp-Fe', etc).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
('iron', 'mgsio3', 'h2o')
|
Material selector. |
'iron'
|
out_path
|
path - like
|
Destination |
required |
grid
|
GridSpec
|
(P, T) grid. |
required |
h2o_table_path
|
str or None
|
AQUA table path. Passed to |
None
|
log_every
|
int
|
Emit a progress line every |
50
|
n_workers
|
int
|
Parallelism. |
1
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Source code in src/zalmoxis/eos/paleos_api.py
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | |
generate_paleos_api_2phase_mgsio3_tables(out_solid, out_liquid, grid, *, log_every=50, n_workers=1)
Generate solid and liquid MgSiO3 P-T tables with metastable extensions.
Replaces the shipped paleos_mgsio3_tables_pt_proteus_solid.dat and
paleos_mgsio3_tables_pt_proteus_liquid.dat — bit-format-compatible,
consumed unchanged by eos_export.generate_spider_eos_tables via
solid_eos_file / liquid_eos_file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_solid
|
path - like
|
Destinations for the two files. Parent directories are created. |
required |
out_liquid
|
path - like
|
Destinations for the two files. Parent directories are created. |
required |
grid
|
GridSpec
|
(P, T) grid; |
required |
log_every
|
int
|
Progress log cadence in pressure rows. |
50
|
n_workers
|
int
|
Parallelism. |
1
|
Returns:
| Type | Description |
|---|---|
dict
|
Summary with per-side |
Notes
The liquid-side file evaluates paleos.mgsio3_eos.Wolf18 on every
grid node, including below the solidus (metastable liquid). The
solid-side file dispatches through MgSiO3EoS()._phase_eos_map using
_get_mgsio3_solid_phase (melting-curve test removed) so every node
gets a solid-polymorph EoS evaluated metastably above the liquidus if
needed.
Source code in src/zalmoxis/eos/paleos_api.py
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | |