Skip to content

Added line_ratio and example with EIS data#441

Open
nabobalis wants to merge 4 commits intowtbarnes:mainfrom
nabobalis:ratio-feature
Open

Added line_ratio and example with EIS data#441
nabobalis wants to merge 4 commits intowtbarnes:mainfrom
nabobalis:ratio-feature

Conversation

@nabobalis
Copy link
Copy Markdown
Collaborator

@nabobalis nabobalis commented Apr 1, 2026

This is my attempt with AI to add helpers into fiasco which will allow me to create https://soho.nascom.nasa.gov/solarsoft/iris/idl/sao/util/tian/iris_ne.pro inside irispy.

Maybe fixes #161

# First download the precomputed EIS products. These two FITS files are hosted
# in a separate data repository so that this example does not need to run the
# EIS fitting step with `eispac <https://eispac.readthedocs.io/en/latest/>`__.
data_base_url = 'https://media.githubusercontent.com/media/nabobalis/data/main/fiasco'
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Update URL when PR merged into sunpy/data

Copy link
Copy Markdown
Owner

@wtbarnes wtbarnes left a comment

Choose a reason for hiding this comment

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

I've left a few detailed comments, but am holding off on a full line-by-line review as a I have a couple of high-level comments.

The functionality for interpolating between the theoretical and observed ratios is out of scope for fiasco. It is easy enough to do this in 2-3 lines in the example gallery without a dedicated function in fiasco. Additionally, the theoretical line ratio method should be a separate function (it can go in fiasco/fiasco.py). I am worried about overcrowding of the Ion namespace and this is more of an "analysis" function rather than something directly related to properties of the ion.

Comment thread fiasco/tests/data/eis_fe_xiii.readme Outdated
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What is this supposed to be?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Some text to explain how and when the sav file was created

Comment thread fiasco/tests/data/eis_fe_xiii.sav Outdated
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This should be be removed. See

def test_ionization_fraction_from_idl(ion_name, idl_env, dbase_version, chianti_idl_version, hdf5_dbase_root):
for an example of how to add an IDL comparison test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You would rather have people use IDL to run the tests over test files?

Comment thread fiasco/tests/test_fiasco.py Outdated
Comment thread fiasco/tests/test_fiasco.py Outdated
Comment thread fiasco/ions.py Outdated
"A `~fiasco.Transitions` object holding the information about transitions for this ion."
return Transitions(self.levels, self._wgfa, n_levels=self.n_levels)

def _transition_indices(self, transitions):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Get rid of this

Comment thread fiasco/ions.py Outdated
Comment on lines +1197 to +1199
temperature : `~astropy.units.Quantity` or `None`, optional
Temperature grid on which to evaluate the ratio. If `None`, the
temperature grid of the current ion instance is used.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Get rid of this input. The result should always be evaluated on the ion temperature grid.

Comment thread fiasco/ions.py Outdated
Comment on lines +1191 to +1194
numerator, denominator : `~astropy.units.Quantity`
Transition wavelength(s) for the numerator and denominator. If multiple
transitions are provided, their contribution functions are summed before
taking the ratio.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It should be possible to provide either an array of wavelengths or an array of strings representing the transition labels (see

def label(self):
). The latter is a more exact way to specify a transition. In the case of passing a label, the appropriate index can be found through a string equality check.

Comment thread fiasco/ions.py Outdated
density arrays or ``(n_temperature, 1)`` for ``couple_density_to_temperature=True``.
Points where the denominator vanishes are returned as `~numpy.nan`.
"""
ion = self if temperature is None else self._new_instance(temperature=temperature)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
ion = self if temperature is None else self._new_instance(temperature=temperature)

@nabobalis nabobalis force-pushed the ratio-feature branch 3 times, most recently from b28fc65 to 6678590 Compare April 6, 2026 19:10
@nabobalis nabobalis changed the title Add ratio curve helpers and density-mapping utilities Added line_ratio and example with EIS data Apr 6, 2026
@nabobalis nabobalis marked this pull request as ready for review April 6, 2026 19:43
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.

Add example gallery entry for density diagnostics

2 participants