Skip to content

Add dose rates to TUV-x Python output#595

Merged
mattldawson merged 2 commits intomainfrom
develop-tuvx-python
Sep 5, 2025
Merged

Add dose rates to TUV-x Python output#595
mattldawson merged 2 commits intomainfrom
develop-tuvx-python

Conversation

@mattldawson
Copy link
Copy Markdown
Collaborator

This PR adds dose rates as an output to the TUV-x Python API.

Also:

  • replaces stubbed out functions for rate labels with existing functions in the TUV-x C/C++ API.
  • adds some additional testing
  • removes TUV-x diagnostic output that is only needed for the internal TUV-x regression testing
  • allows creation of a TUV-x calculator based on a JSON/YAML string (in addition to the existing ability to read the configuration data from a file)

@mattldawson mattldawson added this to the TUV-x Python API milestone Sep 4, 2025
@mattldawson mattldawson self-assigned this Sep 4, 2025
@mattldawson mattldawson added the enhancement New feature or request label Sep 4, 2025
Copilot AI review requested due to automatic review settings September 4, 2025 22:08
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 4, 2025

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

This PR adds dose rate calculations as a new output to the TUV-x Python API, expanding the functionality beyond photolysis rates and heating rates. The changes integrate dose rate functionality throughout the C++/Fortran interface stack and update the Python API to support both file-based and string-based configuration initialization.

Key changes include:

  • Addition of dose rate calculation support in C++ and Fortran interfaces
  • Enhanced Python API to support JSON/YAML string configurations in addition to file-based configurations
  • Replacement of placeholder rate labeling functions with actual TUV-x API implementations
  • Removal of diagnostic output settings from configuration files

Reviewed Changes

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

Show a summary per file
File Description
src/tuvx/tuvx_c_interface.cpp Adds GetDoseRatesOrdering function to C interface
src/tuvx/tuvx.cpp Implements dose rate support and config string initialization
src/tuvx/interface.F90 Adds Fortran dose rate functions and config string parsing
src/test/data/tuvx/fixed/config.json Updates test configuration with dose rates and additional layers
musica/tuvx.py Enhances Python API with dose rates and string config support
musica/tuvx.cpp Updates Python bindings for dose rates and new config methods
musica/test/integration/test_tuvx.py Adds comprehensive tests for new functionality
include/musica/tuvx/tuvx_c_interface.hpp Updates C interface header with dose rate declarations
include/musica/tuvx/tuvx.hpp Updates C++ class header with dose rate methods
configs/tuvx/tuv_5_4.json Removes diagnostic output settings
configs/tuvx/data/photolysis_rate_constants.json Removes diagnostic output settings
configs/tuvx/data/dose_rates.json Removes diagnostic output settings
cmake/dependencies.cmake Updates TUV-x dependency version
Comments suppressed due to low confidence (2)

musica/tuvx.py:1

  • The names variable is a dictionary (dict[str, int]) but .index() method is being called on it. Use names[reaction_name] to get the index value instead.
"""

musica/tuvx.py:1

  • The temporary file is deleted when the context manager exits, but TUVX constructor may need to read the file after this function returns. Use delete=False and handle cleanup manually, or pass config_path=temp_file.name to ensure the file exists when needed.
"""

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 5, 2025

Codecov Report

❌ Patch coverage is 2.02020% with 97 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.81%. Comparing base (c5c44e4) to head (c30c176).

Files with missing lines Patch % Lines
src/tuvx/interface.F90 0.00% 53 Missing ⚠️
src/tuvx/tuvx.cpp 4.65% 41 Missing ⚠️
src/tuvx/tuvx_c_interface.cpp 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #595      +/-   ##
==========================================
- Coverage   81.14%   80.81%   -0.34%     
==========================================
  Files          54       54              
  Lines        6015     6040      +25     
==========================================
  Hits         4881     4881              
- Misses       1134     1159      +25     

☔ 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.

Copy link
Copy Markdown
Collaborator

@boulderdaze boulderdaze left a comment

Choose a reason for hiding this comment

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

Thank you for answering the questions!

@mattldawson mattldawson merged commit c7a0aee into main Sep 5, 2025
68 checks passed
@mattldawson mattldawson deleted the develop-tuvx-python branch September 5, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants