From 786066f5e4f5a83fd4e630569a43ea008c4c65b7 Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 16 Jul 2026 17:17:01 +0200 Subject: [PATCH 1/8] Added OCS aliases --- chemcat/data/white_pages.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/chemcat/data/white_pages.txt b/chemcat/data/white_pages.txt index 4199304..b2bd76c 100644 --- a/chemcat/data/white_pages.txt +++ b/chemcat/data/white_pages.txt @@ -21,4 +21,5 @@ OAlH HAlO OAlOH HAlO2 ONO- NO2- SSO S2O +COS COS OCS None C4H2,butadiyne C4H2 From e088f8e1791482592bcdf8ea04beb03047cde4be Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 16 Jul 2026 17:17:44 +0200 Subject: [PATCH 2/8] Added CaH thermo data to thermo_build_cea.dat --- chemcat/data/thermo_build_cea.dat | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chemcat/data/thermo_build_cea.dat b/chemcat/data/thermo_build_cea.dat index a8a3abd..373d24c 100644 --- a/chemcat/data/thermo_build_cea.dat +++ b/chemcat/data/thermo_build_cea.dat @@ -42,6 +42,14 @@ C- Hotop,1985. Gordon,1999. 6000.000 20000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 6218.836 1.223289007D+01-5.196185830D-03 2.500001344D+00-1.743497251D-10 1.206609009D-14 -4.252419790D-19 5.992333270D-24 7.001221630D+04 4.879608421D+00 +CaH Gurvich,1996a pt1 p447 pt2 p353. + 2 tpis96 CA 1.00H 1.00 0.00 0.00 0.00 0 41.0859400 229409.105 + 200.000 1000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 8705.105 +-4.513782230D+04 7.629429210D+02-1.280874223D+00 1.318774659D-02-1.481595334D-05 + 8.536573220D-09-1.989958945D-12 0.000000000D+00 2.300378814D+04 3.053421525D+01 + 1000.000 6000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 8705.105 +-2.696952529D+06 8.607059750D+03-7.027454820D+00 7.467916310D-03-2.318610699D-06 + 3.423072420D-10-1.892679792D-14 0.000000000D+00-2.773819107D+04 7.845822010D+01 CH Gurvich,1979 pt1 p37 pt2 p39. 3 tpis79 C 1.00H 1.00 0.00 0.00 0.00 0 13.0186400 597370.604 200.000 1000.0007 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 0.0 8625.104 From d1d10cd58f19da801d2914d50eb622a07f211e82 Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 11:17:58 +0200 Subject: [PATCH 3/8] Replaced cea heat_func() and gibbs_func() functions with Heat() and Gibbs() classes. Avoids in-function definitions. --- chemcat/cea/cea.py | 132 ++++++++++++++++++++++++++++++--------------- tests/test_cea.py | 13 +++-- 2 files changed, 98 insertions(+), 47 deletions(-) diff --git a/chemcat/cea/cea.py b/chemcat/cea/cea.py index 1531bc5..95b5c02 100644 --- a/chemcat/cea/cea.py +++ b/chemcat/cea/cea.py @@ -4,9 +4,8 @@ __all__ = [ 'is_in', 'read_thermo_build', - #'write_thermo_build', - 'heat_func', - 'gibbs_func', + 'Heat', + 'Gibbs', 'setup_network', 'find_species', ] @@ -170,53 +169,72 @@ def read_thermo_build(species, thermo_file=None): return thermo_data -def heat_func(a_coeffs, t_coeffs): +class Heat(): """ - Generate a callable that evaluates the molar heat capacity + A class to evaluate the molar heat capacity at a given temperature array. Parameters ---------- - a_coeffs: 2D float ndarray + species: string + Species name. If provided, ignore coefficient inputs. + a_coeffs: 1D float ndarray Polynomial coefficients to reproduce the heat capacity data. t_coeffs: 1D float ndarray Temperature intervals of validity for each set of coefficients. - Returns - ------- - heat: Callable - A function heat(temperature) that evaluates the molar heat - capacity at constant pressure (divided by the universal gas - constant), cp(T)/R, for a given temperature input - (which can be a single value or a 1D iterable). - Examples -------- >>> import chemcat.cea as cea - >>> data = cea.read_thermo_build(['H2O'])[0] - >>> heat = cea.heat_func( - >>> data['a_coeffs'], data['t_coeffs']) - + >>> heat = cea.Heat('H2O') >>> print(heat(300.0)) [4.04063805] >>> print(heat([300.0, 1000.0, 3000.0])) [4.04063805 4.96614188 6.8342561 ] """ - def heat(temperature): + def __init__(self, species=None, a_coeffs=None, t_coeffs=None): + if species is not None: + data = read_thermo_build([species])[0] + a_coeffs = data['a_coeffs'] + t_coeffs = data['t_coeffs'] + self.a_coeffs = a_coeffs + self.t_coeffs = t_coeffs + + def __call__(self, temperature): + """ + Parameters + ---------- + temperature: scalar of 1D float + Polynomial coefficients to reproduce the heat capacity data. + + Returns + ------- + heat_capacity: 1D array + Evaluate the molar heat capacity at constant pressure + (divided by the universal gas constant), cp(T)/R + + Examples + -------- + >>> import chemcat.cea as cea + + >>> heat = cea.Heat('H2O') + >>> print(heat(300.0)) + [4.04063805] + >>> print(heat([300.0, 1000.0, 3000.0])) + [4.04063805 4.96614188 6.8342561 ] + """ if not isinstance(temperature, Iterable): temperature = [temperature] temperature = np.array(temperature, np.double) - heat_capacity = u.heat(temperature, a_coeffs, t_coeffs) + heat_capacity = u.heat(temperature, self.a_coeffs, self.t_coeffs) return heat_capacity - return heat -def gibbs_func(a_coeffs, b_coeffs, t_coeffs): +class Gibbs(): """ - Generate a callable that evaluates the Gibbs free energy - for a given temperature array. + A class to evaluate the Gibbs free energy for a given temperature array. Parameters ---------- @@ -227,35 +245,59 @@ def gibbs_func(a_coeffs, b_coeffs, t_coeffs): t_coeffs: 1D float ndarray Temperature intervals of validity for each set of coefficients. - Returns - ------- - gibbs: Callable - A function gibbs(temperature) that evaluates the Gibbs free - energy, G(T)/RT, for a given temperature input (which can be - a single value or a 1D iterable). - Examples -------- >>> import chemcat.cea as cea - >>> data = cea.read_thermo_build(['H2O'])[0] - >>> gibbs = cea.gibbs_func( - >>> data['a_coeffs'], data['b_coeffs'], data['t_coeffs']) - + >>> gibbs = cea.Gibbs('H2O') >>> print(gibbs(300.0)) [-119.66025955] >>> print(gibbs([300.0, 1000.0, 3000.0])) [-119.66025955 -53.94898416 -39.09425268] """ - def gibbs(temperature): + def __init__(self, species=None, a_coeffs=None, b_coeffs=None, t_coeffs=None): + if species is not None: + data = read_thermo_build([species])[0] + a_coeffs = data['a_coeffs'] + b_coeffs = data['b_coeffs'] + t_coeffs = data['t_coeffs'] + + self.a_coeffs = a_coeffs + self.b_coeffs = b_coeffs + self.t_coeffs = t_coeffs + + def __call__(self, temperature): + """ + Parameters + ---------- + temperature: scalar of 1D float + Polynomial coefficients to reproduce the heat capacity data. + + Returns + ------- + gibbs_free_energy: 1D array + The Gibbs free energy, G(T)/RT, at temperature input + + Examples + -------- + >>> import chemcat.cea as cea + + >>> data = cea.read_thermo_build(['H2O'])[0] + >>> gibbs = cea.gibbs_func( + >>> data['a_coeffs'], data['b_coeffs'], data['t_coeffs']) + + >>> print(gibbs(300.0)) + [-119.66025955] + >>> print(gibbs([300.0, 1000.0, 3000.0])) + [-119.66025955 -53.94898416 -39.09425268] + """ if not isinstance(temperature, Iterable): temperature = [temperature] temperature = np.array(temperature, np.double) - free_energy = u.gibbs( - temperature, a_coeffs, b_coeffs, t_coeffs) + free_energy = u.gibbs(temperature, self.a_coeffs, self.b_coeffs, self.t_coeffs) return free_energy - return gibbs + def setup_network(input_species): @@ -325,10 +367,14 @@ def setup_network(input_species): gibbs_free_energy = [] stoich_data = [] for data in thermo_data: - heat_capacity.append( - heat_func(data['a_coeffs'], data['t_coeffs'])) - gibbs_free_energy.append( - gibbs_func(data['a_coeffs'], data['b_coeffs'], data['t_coeffs'])) + a_coeffs = data['a_coeffs'] + b_coeffs = data['b_coeffs'] + t_coeffs = data['t_coeffs'] + heat = Heat(a_coeffs=a_coeffs, t_coeffs=t_coeffs) + gibbs = Gibbs(a_coeffs=a_coeffs, b_coeffs=b_coeffs, t_coeffs=t_coeffs) + + heat_capacity.append(heat) + gibbs_free_energy.append(gibbs) stoich_data.append(data['stoich']) return ( diff --git a/tests/test_cea.py b/tests/test_cea.py index 465b5b1..635ad0f 100644 --- a/tests/test_cea.py +++ b/tests/test_cea.py @@ -96,19 +96,24 @@ def test_read_thermo_cea_stoich_ions(): 'temp', [300, 300.0], ) -def test_heat_func_cea_single_value(temp): +def test_heat_cea_coeffs_single_value(temp): data = cea.read_thermo_build(['H2O'])[0] - heat = cea.heat_func(data['a_coeffs'], data['t_coeffs']) + heat = cea.Heat(a_coeffs=data['a_coeffs'], t_coeffs=data['t_coeffs']) np.testing.assert_allclose(heat(temp), np.array([4.04063805])) +def test_heat_cea_species_single_value(): + heat = cea.Heat('H2O') + np.testing.assert_allclose(heat(300.0), np.array([4.04063805])) + + @pytest.mark.parametrize( 'temp', ([300, 1000.0, 3000.0], np.array([300, 1000.0, 3000.0])) ) -def test_heat_func_cea_array(temp): +def test_heat_cea_array(temp): data = cea.read_thermo_build(['H2O'])[0] - heat = cea.heat_func(data['a_coeffs'], data['t_coeffs']) + heat = cea.Heat('H2O') expected_heat = np.array([4.04063805, 4.96614188, 6.8342561]) np.testing.assert_allclose(heat(temp), expected_heat) From ca698966cc8634dfec6aa95e239a78b7b89b6770 Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 11:26:01 +0200 Subject: [PATCH 4/8] Updated copyright years. --- chemcat/__init__.py | 2 +- chemcat/cea/__init__.py | 2 +- chemcat/cea/cea.py | 2 +- chemcat/janaf/__init__.py | 2 +- chemcat/janaf/janaf.py | 3 +-- chemcat/network.py | 2 +- chemcat/utils/__init__.py | 2 +- chemcat/utils/utils.py | 2 +- chemcat/version.py | 2 +- docs/index.rst | 2 +- docs/license.rst | 2 +- setup.py | 2 +- src_c/_thermo.c | 2 +- src_c/_utils.c | 2 +- src_c/include/ind.h | 2 +- src_c/include/newton_raphson.h | 2 +- tests/conftest.py | 2 +- tests/test_cea.py | 2 +- tests/test_janaf.py | 2 +- tests/test_network.py | 2 +- tests/test_utils.py | 2 +- 21 files changed, 21 insertions(+), 22 deletions(-) diff --git a/chemcat/__init__.py b/chemcat/__init__.py index b6b1102..49e9bd2 100644 --- a/chemcat/__init__.py +++ b/chemcat/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) from .network import * diff --git a/chemcat/cea/__init__.py b/chemcat/cea/__init__.py index aaca75e..fb4c444 100644 --- a/chemcat/cea/__init__.py +++ b/chemcat/cea/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) from .cea import * diff --git a/chemcat/cea/cea.py b/chemcat/cea/cea.py index 95b5c02..391ea72 100644 --- a/chemcat/cea/cea.py +++ b/chemcat/cea/cea.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) __all__ = [ diff --git a/chemcat/janaf/__init__.py b/chemcat/janaf/__init__.py index 1a53e06..6146c0c 100644 --- a/chemcat/janaf/__init__.py +++ b/chemcat/janaf/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) from .janaf import * diff --git a/chemcat/janaf/janaf.py b/chemcat/janaf/janaf.py index 55ea034..1c2cbae 100644 --- a/chemcat/janaf/janaf.py +++ b/chemcat/janaf/janaf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) __all__ = [ @@ -417,4 +417,3 @@ def find_species(elements, charge='neutral', num_atoms=None, state='gas'): return np.array(species) - diff --git a/chemcat/network.py b/chemcat/network.py index db6f8f7..663a3cf 100644 --- a/chemcat/network.py +++ b/chemcat/network.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) __all__ = [ diff --git a/chemcat/utils/__init__.py b/chemcat/utils/__init__.py index e8ef678..b057007 100644 --- a/chemcat/utils/__init__.py +++ b/chemcat/utils/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) from .utils import * diff --git a/chemcat/utils/utils.py b/chemcat/utils/utils.py index 3c92faf..b5433b5 100644 --- a/chemcat/utils/utils.py +++ b/chemcat/utils/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) __all__ = [ diff --git a/chemcat/version.py b/chemcat/version.py index 592285f..5d09e49 100644 --- a/chemcat/version.py +++ b/chemcat/version.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) # chemcat version: diff --git a/docs/index.rst b/docs/index.rst index 557c80f..09f334c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -71,7 +71,7 @@ Be Kind ======= Please cite this paper if you found ``chemcat`` useful for your research: - `Cubillos, Blecic, et al. (2024): Radiative and Thermochemical Equilibrium Calculations and Application for Warm-Jupiter Exoplanets. `_ + `Cubillos, Blecic, et al. (2026): Pyrat Bay 2.0: an Upgraded Framework for Exoplanet Atmosphere Modeling in the JWST Era. `_ We welcome your feedback or inquiries, please refer them to: diff --git a/docs/license.rst b/docs/license.rst index f299853..062848d 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -8,7 +8,7 @@ License ======= **chemcat**: Chemistry Calculator for Atmospheres, |br| -Copyright (C) 2022-2024 Jasmina Blecic and Patricio Cubillos +Copyright (C) 2022-2026 Jasmina Blecic and Patricio Cubillos This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/setup.py b/setup.py index 88311eb..340bee5 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import os diff --git a/src_c/_thermo.c b/src_c/_thermo.c index f42ea08..0393ccb 100644 --- a/src_c/_thermo.c +++ b/src_c/_thermo.c @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2025 Blecic and Cubillos +// Copyright (c) 2022-2026 Blecic and Cubillos // chemcat is open-source software under the GPL-2.0 license (see LICENSE) #include diff --git a/src_c/_utils.c b/src_c/_utils.c index 88e59cb..3bb242a 100644 --- a/src_c/_utils.c +++ b/src_c/_utils.c @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2025 Blecic and Cubillos +// Copyright (c) 2022-2026 Blecic and Cubillos // chemcat is open-source software under the GPL-2.0 license (see LICENSE) #include diff --git a/src_c/include/ind.h b/src_c/include/ind.h index fb4badb..152769d 100644 --- a/src_c/include/ind.h +++ b/src_c/include/ind.h @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2025 Blecic and Cubillos +// Copyright (c) 2022-2026 Blecic and Cubillos // chemcat is open-source software under the GPL-2.0 license (see LICENSE) // Definitions for indexing Numpy arrays: diff --git a/src_c/include/newton_raphson.h b/src_c/include/newton_raphson.h index cc5b80b..6a16796 100644 --- a/src_c/include/newton_raphson.h +++ b/src_c/include/newton_raphson.h @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2025 Blecic and Cubillos +// Copyright (c) 2022-2026 Blecic and Cubillos // chemcat is open-source software under the GPL-2.0 license (see LICENSE) void usrfun( diff --git a/tests/conftest.py b/tests/conftest.py index b179f97..d7fcaac 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import numpy as np diff --git a/tests/test_cea.py b/tests/test_cea.py index 635ad0f..029bfc9 100644 --- a/tests/test_cea.py +++ b/tests/test_cea.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import numpy as np diff --git a/tests/test_janaf.py b/tests/test_janaf.py index 1f6dad1..57f9f41 100644 --- a/tests/test_janaf.py +++ b/tests/test_janaf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import numpy as np diff --git a/tests/test_network.py b/tests/test_network.py index a70f5d6..af7e561 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import os diff --git a/tests/test_utils.py b/tests/test_utils.py index f214653..70ba5d2 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2025 Blecic and Cubillos +# Copyright (c) 2022-2026 Blecic and Cubillos # chemcat is open-source software under the GPL-2.0 license (see LICENSE) import os From c0b85a47817b6a52d8f1455657f5fc77420559ae Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 13:41:31 +0200 Subject: [PATCH 5/8] updated version to 1.0.0 --- chemcat/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chemcat/version.py b/chemcat/version.py index 5d09e49..ade5c66 100644 --- a/chemcat/version.py +++ b/chemcat/version.py @@ -2,5 +2,5 @@ # chemcat is open-source software under the GPL-2.0 license (see LICENSE) # chemcat version: -__version__ = '0.3.12' +__version__ = '1.0.0' From 6592fa7e6a419a01d9297d17e60fc9fd09480689 Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 13:43:28 +0200 Subject: [PATCH 6/8] Updated github actions --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a026716..4581902 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -18,13 +18,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] os: [ubuntu-latest] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From 37cb8ac04c1cf2b5cd33b15a87faa725c8ad2072 Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 13:46:58 +0200 Subject: [PATCH 7/8] Updated README.md file. --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b067231..8a8f3ba 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,11 @@ conda install -c conda-forge chemcat ### Cite as: ```bibtex -@ARTICLE{CubillosBlecicEtal2024journalRadiativeChemicalEquilibrium, - author = {{Cubillos}, Patricio and {Blecic}, Jasmina and {Fossati}, Luca}, - title = "{Radiative and Chemical Equilibrium Calculations with Application to Exoplanets}", - journal = {journal}, - year = 2024, - adsurl = {https://ui.adsabs.harvard.edu/abs/2024journ.000....0C}, - adsnote = {Provided by the SAO/NASA Astrophysics Data System} +@ARTICLE{CubillosBlecicEtal2026mnrasPyratbay2, + author = {{Cubillos}, Patricio and {Blecic}, Jasmina and {Shulyak}, Denis and {Fossati}, Luca}, + title = "{Pyrat Bay 2.0: an Upgraded Framework for Exoplanet Atmosphere Modeling in the JWST Era}", + journal = {MNRAS}, + year = 2026, + adsurl = {https://ui.adsabs.harvard.edu/abs/2026mnras.000....0C}, } ``` From aa5d88fcac05ec4618a34319e5264967e7b2c93d Mon Sep 17 00:00:00 2001 From: pcubillos Date: Thu, 30 Jul 2026 15:11:40 +0200 Subject: [PATCH 8/8] Updated API docs. --- docs/api.rst | 109 ++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 84 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index a72b6f2..43c75e1 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -14,21 +14,12 @@ _______ .. code-block:: pycon - Descriptor objects that automate setting the elemental abundances. - - To understand this sorcery see: - https://docs.python.org/3/howto/descriptor.html - - Initialize self. See help(type(self)) for accurate signature. .. py:class:: Network(pressure, temperature, input_species, metallicity=0.0, e_abundances={}, e_scale={}, e_ratio={}, e_source='asplund_2021', sources=['janaf', 'cea']) .. code-block:: pycon - A chemcat chemical network object. - - Parameters ---------- pressure: 1D float iterable @@ -109,8 +100,9 @@ _______ .. py:method:: heat_capacity(temperature=None) .. code-block:: pycon - Evaluate the heat capacity of each species in the network - at the given temperature (default to self.temperature if needed). + Compute Cp/R(temperature) for each species in the network, + where Cp is the molar heat capacity at constant pressure and + R is the universal gas constant (8.31 J mol-1 K-1). .. py:method:: thermochemical_equilibrium(temperature=None, metallicity=None, e_abundances=None, e_scale=None, e_ratio=None, savefile=None) .. code-block:: pycon @@ -165,6 +157,7 @@ ___________ .. code-block:: pycon Element-wise check whether species name exist in CEA database. + Parameters ---------- species: 1D iterable of strings @@ -192,6 +185,7 @@ ___________ Read data from NASA's CEA thermoBuild file. https://cearun.grc.nasa.gov/ThermoBuild/index_ds.html + https://ntrs.nasa.gov/citations/20020085330 Parameters ---------- @@ -227,73 +221,17 @@ ___________ >>> # Network will all species from the database: >>> all_thermo_data = cea.read_thermo_build(species=None) -.. py:function:: heat_func(a_coeffs, t_coeffs) -.. code-block:: pycon - - Generate a callable that evaluates the molar heat capacity - at a given temperature array. +.. py:class:: Heat(species=None, a_coeffs=None, t_coeffs=None) - Parameters - ---------- - a_coeffs: 2D float ndarray - Polynomial coefficients to reproduce the heat capacity data. - t_coeffs: 1D float ndarray - Temperature intervals of validity for each set of coefficients. - - Returns - ------- - heat: Callable - A function heat(temperature) that evaluates the molar heat - capacity, cp(T)/R, for a given temperature input - (which can be a single value or a 1D iterable). - - Examples - -------- - >>> import chemcat.cea as cea - - >>> data = cea.read_thermo_build(['H2O'])[0] - >>> heat = cea.heat_func( - >>> data['a_coeffs'], data['t_coeffs']) - - >>> print(heat(300.0)) - [4.04063805] - >>> print(heat([300.0, 1000.0, 3000.0])) - [4.04063805 4.96614188 6.8342561 ] - -.. py:function:: gibbs_func(a_coeffs, b_coeffs, t_coeffs) -.. code-block:: pycon - - Generate a callable that evaluates the Gibbs free energy - for a given temperature array. - - Parameters - ---------- - a_coeffs: 2D float ndarray - Polynomial coefficients to reproduce the heat capacity data. - b_coeffs: 2D float ndarray - Integration constants to obtain the enthalpy and entropy. - t_coeffs: 1D float ndarray - Temperature intervals of validity for each set of coefficients. + .. code-block:: pycon - Returns - ------- - gibbs: Callable - A function gibbs(temperature) that evaluates the Gibbs free - energy, G(T)/RT, for a given temperature input (which can be - a single value or a 1D iterable). + Initialize self. See help(type(self)) for accurate signature. - Examples - -------- - >>> import chemcat.cea as cea +.. py:class:: Gibbs(species=None, a_coeffs=None, b_coeffs=None, t_coeffs=None) - >>> data = cea.read_thermo_build(['H2O'])[0] - >>> gibbs = cea.gibbs_func( - >>> data['a_coeffs'], data['b_coeffs'], data['t_coeffs']) + .. code-block:: pycon - >>> print(gibbs(300.0)) - [-119.66025955] - >>> print(gibbs([300.0, 1000.0, 3000.0])) - [-119.66025955 -53.94898416 -39.09425268] + Initialize self. See help(type(self)) for accurate signature. .. py:function:: setup_network(input_species) .. code-block:: pycon @@ -675,7 +613,7 @@ _____________ .. py:data:: ROOT .. code-block:: pycon - '/Users/username/envs/proj/lib/python3.9/site-packages/chemcat/' + '/home/pcubillos/Dropbox/IWF/projects/2022_chemcat/chemcat/' .. py:data:: COLORS .. code-block:: pycon @@ -685,7 +623,7 @@ _____________ .. py:data:: COLOR_DICT .. code-block:: pycon - {'H': 'blue', 'H2': 'deepskyblue', 'He': 'olive', 'C': 'coral', 'CH4': 'darkorange', 'CO': 'limegreen', 'CO2': 'red', 'HCN': 'dimgray', 'C2H2': 'pink', 'C2H4': 'deeppink', 'N': 'darkviolet', 'NH3': 'magenta', 'N2': 'gold', 'O': 'greenyellow', 'H2O': 'navy', 'OH': 'darkkhaki', 'Si': 'lightslategray', 'SiO': 'darkturquoise', 'SiH4': 'mediumvioletred', 'Na': 'silver', '(NaCl)2': 'maroon', '(NaOH)2': 'hotpink', 'NaCl': 'rosybrown', 'K': 'black', '(KCl)2': 'chocolate', '(KOH)2': 'darkslateblue', 'KOH': 'lightgreen', 'KCl': 'darksalmon', 'S': 'cornflowerblue', 'H2S': 'darkgoldenrod', 'HS': 'yellowgreen', 'SO': 'mediumseagreen', 'SO2': 'skyblue', 'Al': 'khaki', 'AlOH': 'steelblue', 'Al2O': 'seagreen', 'OAlOH': 'tomato', 'Ca': 'orange', 'Ca(OH)2': 'indigo', 'e': 'darkgreen', 'Ti': 'crimson', 'TiO': 'brown', 'TiO2': 'indianred', 'VO': 'aquamarine', 'VO2': 'mediumaquamarine', 'V': 'darkcyan', 'Mg': 'sandybrown', 'MgH': 'lawngreen', 'Mg(OH)2': 'orangered', 'Fe': 'royalblue', 'FeH': 'wheat', 'Fe(OH)2': 'tan', 'F': 'yellow', 'OAlF2': 'sienna', 'TiF3': 'saddlebrown', 'AlF': 'orange', 'HF': 'lightblue', 'MnH': 'lime', 'Mn': 'rebeccapurple', 'PN': 'palegoldenrod', 'P': 'peachpuff', '(P2O3)2': 'cadetblue'} + {'H': 'blue', 'H2': 'deepskyblue', 'He': 'olive', 'C': 'coral', 'CH4': 'darkorange', 'CO': 'limegreen', 'CO2': 'red', 'HCN': 'dimgray', 'C2H2': 'pink', 'C2H4': 'deeppink', 'N': 'darkviolet', 'NH3': 'magenta', 'N2': 'gold', 'O': 'greenyellow', 'H2O': 'navy', 'OH': 'darkkhaki', 'Si': 'lightslategray', 'SiO': 'darkturquoise', 'SiH4': 'mediumvioletred', 'Na': 'silver', '(NaCl)2': 'maroon', '(NaOH)2': 'hotpink', 'NaCl': 'rosybrown', 'K': 'black', '(KCl)2': 'chocolate', '(KOH)2': 'darkslateblue', 'KOH': 'lightgreen', 'KCl': 'darksalmon', 'S': 'cornflowerblue', 'H2S': 'darkgoldenrod', 'SH': 'yellowgreen', 'SO': 'xkcd:green', 'SO2': 'skyblue', 'SiS': 'xkcd:wheat', 'Al': 'khaki', 'AlOH': 'steelblue', 'Al2O': 'seagreen', 'OAlOH': 'tomato', 'Ca': 'orange', 'Ca(OH)2': 'xkcd:blue', 'e': 'darkgreen', 'Ti': 'crimson', 'TiO': 'brown', 'TiO2': 'indianred', 'VO': 'aquamarine', 'VO2': 'mediumaquamarine', 'V': 'darkcyan', 'Mg': 'sandybrown', 'MgH': 'lawngreen', 'Mg(OH)2': 'orangered', 'Fe': 'royalblue', 'FeH': 'wheat', 'Fe(OH)2': 'tan', 'F': 'yellow', 'OAlF2': 'sienna', 'TiF3': 'saddlebrown', 'AlF': 'orange', 'HF': 'lightblue', 'MnH': 'lime', 'Mn': 'rebeccapurple', 'PN': 'palegoldenrod', 'P': 'peachpuff', '(P2O3)2': 'cadetblue'} .. py:function:: thermochemical_equilibrium(pressure, temperature, element_rel_abundance, stoich_vals, gibbs_funcs, tolx=2.22e-16, tolf=2.22e-16) .. code-block:: pycon @@ -890,12 +828,12 @@ _____________ abundance in dex units relative to H=12.0. These values (if any) override metallicity. e_scale: Dictionary of element-scaling pairs - Set custom elemental abundances by scaling from its solar value. + Set custom elemental abundances by scaling relative to solar + values in dex units. The dict contains the name of the element and their custom - scaling factor in dex units, e.g., for 2x solar carbon set - e_scale = {'C': np.log10(2.0)}. - This argument modifies the abundances on top of any custom - metallicity and e_abundances. + scaling factor in dex units, e.g., for 5x solar carbon set + e_scale = {'C': 0.7}. # log10(5.0) = 0.7 + This argument modifies overrides metallicity and e_abundances. e_ratio: Dictionary of element-ratio pairs Set custom elemental abundances by scaling relative to another element. @@ -1077,7 +1015,7 @@ _____________ 'e': 'darkgreen', 'H3': 'royalblue'} -.. py:function:: plot_vmr(pressure, vmr, species, colors=None, vmr_range=None, fignum=320, title=None, fontsize=14, linewidth=2.0, rect=None, axis=None, savefig=None) +.. py:function:: plot_vmr(pressure, vmr, species, colors=None, vmr_range=None, fignum=320, title=None, fontsize=14, linewidth=2.0, rect=None, axis=None, savefig=None, show_legends=True) .. code-block:: pycon Plot VMRs vs pressure. @@ -1090,9 +1028,10 @@ _____________ Volume mixing ratios of shape [nlayers, nspecies]. species: 1D string iterable Names of the species in vmr. - colors: 1D iterable of strings - Color names to assign (sequentially) to the species. + colors: 1D iterable of strings or dict If None, default to chemcat.utils.COLOR_DICT values. + If list, color names to assign (sequentially) to the species. + If dict, the name--color pairs for each neutral species. Note that different ionic variations of a same species (e.g., H, H+, H-) are assigned a same color, but differ in line style. @@ -1113,6 +1052,8 @@ _____________ Axis where to draw the VMRs. If not None, overrides fignum. savefig: String If not None, file name where to save the figure. + show_legends: Bool + Flag indicating whether legends should be plotted. Returns ------- @@ -1133,7 +1074,7 @@ _____________ >>> 'H2O CH4 CO CO2 NH3 N2 H2 HCN C2H2 C2H4 OH H He C N O ' >>> 'e- H- H+ H2+ He+ ' >>> 'Na Na- Na+ K K- K+ ' - >>> 'Si S SiO SiH4 H2S HS SO SO2 SiS' + >>> 'Si S SiO SiH4 H2S SH SO SO2 SiS' >>> ).split() >>> net = cat.Network(pressure, temperature, molecs)