Skip to content

Tuvx api#417

Merged
K20shores merged 11 commits intomainfrom
tuvx_api
Jul 14, 2025
Merged

Tuvx api#417
K20shores merged 11 commits intomainfrom
tuvx_api

Conversation

@K20shores
Copy link
Copy Markdown
Collaborator

@K20shores K20shores commented Jul 11, 2025

This is the the final PR which closes #400

The first PR I tried to make was #393, but that was too large. Those that replace it are listed below

  1. Refactor conditional backend import in python to remove circular import dependency at package initialization time #406
  2. Add tuvx into the python build for linux and macos #409
  3. Separate tuvx c api #413
  4. This one (Tuvx api #417)

This PR separates adds all of the functions which create tuv from a config file, which can be done in code or read from disk, and then gets out some photolysis rates.

@github-actions
Copy link
Copy Markdown
Contributor

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 2.00000% with 147 lines in your changes missing coverage. Please review.

Project coverage is 83.47%. Comparing base (1880ced) to head (abbe3d3).

Files with missing lines Patch % Lines
src/tuvx/tuvx.cpp 3.79% 76 Missing ⚠️
src/tuvx/interface.F90 0.00% 71 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #417      +/-   ##
==========================================
- Coverage   86.62%   83.47%   -3.15%     
==========================================
  Files          44       44              
  Lines        3894     4043     +149     
==========================================
+ Hits         3373     3375       +2     
- Misses        521      668     +147     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@K20shores K20shores marked this pull request as ready for review July 11, 2025 13:31

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

@mattldawson mattldawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one minor comment about a comment.

Also, is the output folder needed?

@K20shores K20shores mentioned this pull request Jul 14, 2025
@K20shores K20shores requested a review from Copilot July 14, 2025 18:42
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 JSON-based “config-only” mode to the TUV-x API so users can create, run, and inspect photolysis and heating rates directly from a JSON configuration file.

  • Introduce CreateFromConfigOnly, RunFromConfig, and related getters in musica::TUVX
  • Extend the Fortran/C interface and C++ headers to expose the new config-only entry points
  • Add a high-level Python TUVX class and pybind11 bindings, plus updated tests

Reviewed Changes

Copilot reviewed 24 out of 217 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tuvx/tuvx.cpp Add is_config_only_mode_, config-only methods
src/tuvx/interface.F90 Implement InternalCreateTuvxFromConfig and stubs
include/musica/tuvx/tuvx.hpp Declare simple interface methods
include/musica/tuvx/tuvx_c_interface.hpp Declare new C interface functions
musica/tuvx.py High-level Python class for JSON config use
musica/tuvx.cpp Bind new functions in pybind11
musica/test/test_tuvx.py Update tests for JSON config workflow
src/test/data/tuvx/fixed/stand_alone_tuvx_config.json Remove unused test fixture
Comments suppressed due to low confidence (3)

musica/tuvx.py:44

  • [nitpick] The error message hardcodes "windows" but TUV-x is unsupported on Windows and macOS; consider making the message generic or matching the actual unsupported platforms.
            raise ValueError("TUV-x backend is not available on windows.")

src/tuvx/interface.F90:501

  • The C-binding stub for InternalGetPhotolysisRateNames is unimplemented and only sets error_code; add proper string allocation and conversion or document that this function is a placeholder.
   subroutine get_photolysis_rate_names_c(tuvx, names, error_code) &

include/musica/tuvx/tuvx_c_interface.hpp:104

  • Signature uses int for config_path_length but the Fortran binding uses size_t (could be 64-bit); consider matching types to avoid truncation on large paths.
    void *InternalCreateTuvxFromConfig(const char *config_path, int config_path_length, int *error_code);

Co-authored-by: Copilot <[email protected]>
@K20shores K20shores merged commit 3f0bcb1 into main Jul 14, 2025
69 checks passed
@K20shores K20shores deleted the tuvx_api branch July 14, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a TUVX python wrapper

5 participants