Repository navigation
Add IonCollection.build_line_list - #472
Conversation
A table of the bound-bound transitions of every ion in a collection, one row per line, with the contribution function of each line as a function of temperature and density. Ions can be excluded by a minimum abundance or by having no line in a wavelength range, and if a DEM model in the form returned by `get_dem_model` is given the intensity of each line is included. Closes wtbarnes#464 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
For context on the consumer side: I have rewritten the MUSE pipeline's |
- One `line_list` fixture and a separate test for each concern - Document that any kwarg of `contribution_function` passes through, and stop listing every column - No guard on the ionization potential - `energy` from the level energies rather than the wavelength - Dataset names, CHIANTI version and fiasco version in `meta` Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SPbZHPLHsKKTtmMueYx5RM
wtbarnes
left a comment
There was a problem hiding this comment.
Mostly minor nitpicks around some of the logging in creating the table. Overall, this is great. Thanks for getting this together and sorry it has taken too long to review.
Ions dropped by `minimum_abundance` or `wavelength_range` are now logged at info level, with a test. Comments explain how the dataset names in `meta` are collected and why H II never appears in the line list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wtbarnes
left a comment
There was a problem hiding this comment.
Sorry, realized at the last minute I prefer more human-readable column names. Since they are not variables themselves, no need for them to be underscored.
Closes #464
Adds
IonCollection.build_line_list(density, minimum_abundance=0, wavelength_range=None, emission_measure=None, **kwargs), following the mock-up in #464. It loops over the ions in the collection, skips those below the abundance cutoff or with no bound-bound transition in the wavelength range (and, with a warning, those missing the data to compute a contribution function), and returns aQTablewith one row per transition.Columns:
element,atomic_number,ion_name(roman),abundance,ionization_potential,wavelength,energy,A,upper_level,lower_level,upper_label,lower_label,is_observed,contribution_function, andintensitywhen a DEM is given. Thecontribution_functionentry of each row has shape(l, m)over temperature and density, so a row is one line and its G(n, T).kwargspass through tocontribution_function, socouple_density_to_temperatureworks as usual.Two choices worth a look:
table.metarather than as columns, since they are the same for every row. Easy to change if you would rather have them as columns.emission_measuretakes the table returned byget_dem_model. The intensity is the sum over the model's temperature bins ofemtimes the contribution function interpolated (in log T) to the bin centers, divided by 4π sr. Bins outside the temperature range of the collection contribute nothing.Example, seven ions over 550–680 Å with the quiet-Sun DEM at constant pressure, brightest first:
I also checked it against the line-list builder in the MUSE pipeline that #464 links to, run on the same fiasco checkout: four ions over 170–185 Å at two pressures. Same lines in the same order and bit-identical G(n, T), apart from one theoretical Fe X line at exactly 185.0 Å which the inclusive bounds here keep and MUSE's strict bounds drop.
Tests cover the row count and contribution function against
Ion.contribution_function, the abundance and wavelength filters, the intensity column with a DEM model, and the error when no ion has lines. The fulltest_collections.pymodule passes against the full CHIANTI database.🤖 Generated with Claude Code