Skip to content

Implement two-ion model for >= v9 compatibility#254

Merged
wtbarnes merged 34 commits intomainfrom
collisional-radiative-effects
Mar 31, 2025
Merged

Implement two-ion model for >= v9 compatibility#254
wtbarnes merged 34 commits intomainfrom
collisional-radiative-effects

Conversation

@wtbarnes
Copy link
Owner

@wtbarnes wtbarnes commented Jan 12, 2024

Fixes #234
Fixes #224
Fixes #344

This PR represents the major changes needed for compatibility with versions 9 and later of the CHIANTI database. Most notably, it modifies Ion.level_populations method to include processes that couple a given ion and the next highest ionization state through ionization and recombination processes. In addition, this PR also includes the following changes:

High-level Summary

  • Include ionization, autoionization, radiative recombination, dielectronic recombination, and dielectronic capture in the level populations equation.
  • Refactor how the rate matrices are compute for all processes used to solve the level populations equation. This includes refactoring and greatly simplifying Ion.level_populations
  • Add n_levels and n_transitions property to Ion
  • Add is_autoionization and is_bound_bound to Transitions for more easily differentiating between different kinds of transitions.
  • Rename Level to Levels and add ability to hold information about multiple energy levels at once.
  • Refactor Transitions to be more efficient and useful as a high-level object
  • Fix a bug in burgess_tully_descale to never return object-type arrays
  • The default version of the database to be used is now v9.0.1 and v9.0.1 is now in the supported version list
  • Add IDL comparison tests for the matrices that connect ionization states in the level population equations

Checklist

  • Add n_levels property
  • Add n_transitions property
  • Fix bug in burgess_tully_descale to never return object-type arrays
  • Review how indexing into rate matrices is done (e.g. vectorize where)
  • Separate out code for building coefficient matrices
  • Implement ionization rates in coefficient matrix
  • Implement level-resolved radiative recombination
  • Implement autoionization rates in coefficient matrix
  • Dielectronic capture
  • Dielectronic recombination
  • Refactor how depopulation terms are added along the diagonal
  • Logic for excluding ionization/recombination correction factor when two-ion model is used
  • Logic for turning on/off two-ion model
  • Decide where depopulating rates along the diagonal should be added to the rate matrices (in IDl these aren't added until right before solving the rate matrix equation, but in fiasco we treat these as terms in the coefficient matrix)
  • Tests for two-ion model
  • Docs (see Add topic guide on level populations calculation #349)
  • Change default version of database to be v9 everywhere
  • Add v9 to list of allowed database versions
  • IDL comparison tests for two-ion model
  • Review where _elvlc is used explicitly (favor levels) Create an issue to replace all usage of _elvlc with self.levels (or indexing)
  • Create an issue to replace all usage of _wgfa with self.transitions
  • Write a high-level summary of the changes in this PR description
  • Add necessary files to test database so that two-ion model is actually run
  • Review example gallery
  • Update message about database compatibility
  • Review test coverage changes.

@wtbarnes wtbarnes added WIP Work in progress Ion Anything related to the Ion object labels Jan 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

Attention: Patch coverage is 88.66279% with 39 lines in your changes missing coverage. Please review.

Project coverage is 90.50%. Comparing base (63a2778) to head (4cd4d61).

Files with missing lines Patch % Lines
fiasco/tests/idl/helpers.py 30.76% 18 Missing ⚠️
fiasco/ions.py 94.52% 11 Missing ⚠️
fiasco/tests/idl/test_idl_level_pops.py 81.57% 7 Missing ⚠️
fiasco/tests/idl/conftest.py 85.71% 1 Missing ⚠️
fiasco/tests/idl/test_idl_goft.py 50.00% 1 Missing ⚠️
fiasco/tests/test_ion.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   90.71%   90.50%   -0.21%     
==========================================
  Files          41       42       +1     
  Lines        3456     3667     +211     
==========================================
+ Hits         3135     3319     +184     
- Misses        321      348      +27     

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

@wtbarnes wtbarnes force-pushed the collisional-radiative-effects branch from 864203c to 0f80c04 Compare January 16, 2025 20:00
@wtbarnes wtbarnes force-pushed the collisional-radiative-effects branch from 0f80c04 to b81199d Compare January 28, 2025 18:22
@wtbarnes wtbarnes changed the title Incorporate collisional radiative effects Implement two-ion model for >= v9 compatibility Feb 13, 2025
@wtbarnes wtbarnes marked this pull request as ready for review March 27, 2025 22:26
@wtbarnes wtbarnes added enhancement API API design, naming conventions, etc. refactor Atomic Physics Knowledge Requires some knowledge of atomic physics Run full database tests Run the test suite using a complete version of the database Run v8 tests Run the test suite using CHIANTI database version 8 and removed WIP Work in progress labels Mar 31, 2025
@wtbarnes
Copy link
Owner Author

The v8 test failures are just due to a naming change in the variables used in the test data. This is already tracked by #347.

@wtbarnes wtbarnes merged commit 68af4d6 into main Mar 31, 2025
14 of 16 checks passed
@wtbarnes wtbarnes deleted the collisional-radiative-effects branch March 31, 2025 19:32
@github-project-automation github-project-automation bot moved this from In progress to Done in Support for CHIANTI v9 Mar 31, 2025
@jwreep
Copy link
Collaborator

jwreep commented Mar 31, 2025

Hooray! Thanks for your efforts, Will! That's a major milestone for the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API design, naming conventions, etc. Atomic Physics Knowledge Requires some knowledge of atomic physics enhancement Ion Anything related to the Ion object refactor Run full database tests Run the test suite using a complete version of the database Run v8 tests Run the test suite using CHIANTI database version 8

Projects

No open projects

3 participants