-
Notifications
You must be signed in to change notification settings - Fork 16
implement custom API #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement custom API #603
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a custom molecular database API for the FeH line list by Hargreaves et al. (2010), including utilities to fetch, parse, and convert it into ExoMol‐compatible format.
- Introduces
MdbHargreaves
incustomapi.py
(with fetching, parsing, intensity/A‐coefficient estimation, and activation logic) - Adds
HargreavesDatabaseManager
underdbmanager.py
and a test harness (mock_mdbHargreaves
) inemulate_mdb.py
- Provides basic unit tests for
set_wavenum
and line‐strength sums incustomapi_test.py
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
tests/unittests/spec/api/customapi_test.py | New tests for set_wavenum and Hargreaves line strengths |
src/exojax/test/emulate_mdb.py | Added mock_mdbHargreaves and related import |
src/exojax/spec/qstate.py | Added branch_to_number helper |
src/exojax/spec/dbmanager.py | New CustomDatabaseManager and HargreavesDatabaseManager |
src/exojax/spec/customapi.py | Implementation of MdbHargreaves and related utilities |
Comments suppressed due to low confidence (4)
src/exojax/spec/customapi.py:102
- The database name string is not formatted; it literally contains
{molecule}
. Use an f-string (e.g.f"Hargreaves2010-{molecule}"
) or format before passing.
super().__init__( name="Hargreaves2010-{molecule}",
tests/unittests/spec/api/customapi_test.py:24
- There are no unit tests covering
convert_to_exomol
logic, NaN handling forjlower
or A‐coefficient estimation paths. Consider adding tests for those branches.
def test_line_strength_hargreaves():
src/exojax/spec/qstate.py:36
- [nitpick] This error message is generic; consider including the invalid values or their indices to aid debugging, e.g.
f"Invalid branch values at positions {invalid_indices}: {branch_str[invalid_indices]}"
.
raise ValueError("Invalid or NaN branch values found.")
src/exojax/test/emulate_mdb.py:120
- The code uses os.getcwd() and os.path.exists but
os
is not imported. Addimport os
at the top of the file.
target_dir = os.getcwd() + "/" + molecule
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
I made the following modifications in response to @HajimeKawahara's comments:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Since I would like to use the FeH line list by Hargreaves et al. (2010), I implemented a custom API by referencing
radis.api.dbmanager
andexojax.spec.api
.MdbExoMol
for FeH, and then overwrite certain attributes usingMdbHargreaves
.Please see the sample code
documents/userguide/customapi.ipynb
for its usage.https://github.com/YuiKasagi/exojax/blob/api_mdb_external/documents/userguide/customapi.ipynb