XRT DEM Iterative Solver Module#367
Conversation
|
Ensure the function checks for minimum required inputs (filters, observed intensities, etc.) and validates that all observation values are non-zero before proceeding. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #367 +/- ##
===========================================
- Coverage 87.35% 40.48% -46.88%
===========================================
Files 26 38 +12
Lines 1819 3925 +2106
Branches 106 277 +171
===========================================
Hits 1589 1589
- Misses 184 2290 +2106
Partials 46 46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2041e0a to
bd4687b
Compare
bd4687b to
582c8f7
Compare
for more information, see https://pre-commit.ci
* Enable parallel test execution in noxfile * Ignore sphinx-gallery scripts in pytest --------- Co-authored-by: joyvelasquez <joy.velasquez@cfa.harvard>
| ogp_custom_meta_tags = ('<meta property="og:ignore_canonical" content="true" />',) | ||
| # ogp_custom_meta_tags = ('<meta property="og:ignore_canonical" content="true" />',) |
There was a problem hiding this comment.
I'm curious why this line was commented out. 🤔
| The core solver is implemented in :class:`xrtpy.xrt_dem_iterative.XRTDEMIterative`. | ||
|
|
||
| Conceptually, the solver: | ||
| 1. Builds a regular grid in log10(T) between user-specified bounds. |
There was a problem hiding this comment.
| 1. Builds a regular grid in log10(T) between user-specified bounds. | |
| 1. Builds a regular grid in :math:`\log_{10}(T)` between user-specified bounds. |
I'm not sure if the \log will work. 🤔
| Conceptually, the solver: | ||
| 1. Builds a regular grid in log10(T) between user-specified bounds. | ||
| 2. Interpolates the filter temperature responses onto that grid. | ||
| 3. Represents log10(DEM) as a spline in log10(T). |
There was a problem hiding this comment.
| 3. Represents log10(DEM) as a spline in log10(T). | |
| 3. Represents :math:`\log_{10}(DEM)` as a spline in :math:`\log_{10}(T)`. |
| The DEM class requires temperature response functions for each filter, which | ||
| describe the instrument sensitivity as a function of temperature. These | ||
| responses can be generated for a chosen observation date using utilities | ||
| provided in ``xrtpy.response.tools``. |
There was a problem hiding this comment.
| provided in ``xrtpy.response.tools``. | |
| provided in `xrtpy.response.tools`. |
This would make it into a link.
|
|
||
| dem_solver = XRTDEMIterative( | ||
| observed_channel=filters, | ||
| observed_intensities=intensities, |
There was a problem hiding this comment.
Could we provide some sample intensities for a toy problem, maybe within something like xrtpy.data or xrtpy.examples? 🤔
There might be parallels in SunPy.
| The arrays ``dem_solver.mc_dem``, ``dem_solver.mc_chisq``, | ||
| ``dem_solver.mc_base_obs``, and ``dem_solver.mc_mod_obs`` are then available | ||
| for custom analysis. |
There was a problem hiding this comment.
We might be able to put links here like `~xrtpy.dem.dem_solver.mc_dem` (though my example here probably has the wrong namespace).
|
|
||
| Small numerical differences between the Python and IDL implementations can arise due to: | ||
|
|
||
| * Different interpolation choices (for example, cubic splines from SciPy). |
There was a problem hiding this comment.
"cubic splines from SciPy" compared to what in IDL? 🤔
| Small numerical differences between the Python and IDL implementations can arise due to: | ||
|
|
||
| * Different interpolation choices (for example, cubic splines from SciPy). | ||
| * Differences in optimization libraries (lmfit versus IDL MPFIT). |
| XRTpy DEM solver. It is intended for orientation rather than as a full | ||
| mathematical derivation. | ||
|
|
||
| The DEM inversion problem is mathematically ill posed, meaning that multiple |
There was a problem hiding this comment.
| The DEM inversion problem is mathematically ill posed, meaning that multiple | |
| The DEM inversion problem is underdetermined, meaning that multiple |
maybe? up to you.
| curves provides an estimate of the uncertainty in :math:`DEM(T)`. | ||
|
|
||
|
|
||
| Extended example with options |
There was a problem hiding this comment.
I'm wondering if this would be best in an example notebook since that way the code will be executed to make sure it works. 🤔
| minimum_bound_temperature=5.5, # Minimum log T (default: 5.5) | ||
| maximum_bound_temperature=8.0, # Maximum log T (default: 8.0) | ||
| logarithmic_temperature_step_size=0.1, # Bin width in log T (default: 0.1) | ||
| monte_carlo_runs=100, # Number of Monte Carlo runs (default: 0 -(disabled)) | ||
| max_iterations=2000, # Solver max iterations (default: 2000) | ||
| normalization_factor=1e21, # Normalization scaling factor (default: 1e21) | ||
| ) | ||
|
|
||
| dem_solver.solve() | ||
| dem_solver.plot_dem_mc() | ||
|
|
||
| .. note:: | ||
| The values shown above correspond to the solver defaults and are written | ||
| out here to illustrate which parameters can be tuned. You can adjust these |
There was a problem hiding this comment.
It would help to put a comment near the class definition (especially __init__) that if the default values are changed, then the arguments in this example should be updated.
|
|
||
| .. Acknowledgement | ||
| .. --------------- | ||
| .. *Development of the DEM solver in XRTpy has been supported in part by | ||
| .. a NASA Heliophysics Tools and Methods (HTM) program grant (ROSES-2025, | ||
| .. element B.20). This effort reflects the ongoing transition of DEM | ||
| .. capabilities from legacy IDL routines into modern, open-source Python | ||
| .. tools for the solar physics community.* | ||
|
|
There was a problem hiding this comment.
This would likely go best onto a separate acknowledgements page accessible from the landing page.
|
|
||
| Monte Carlo DEM | ||
| A set of DEM solutions computed by adding random noise (based on intensity errors) to the observed intensities and re-solving the DEM multiple times. | ||
| The spread of these Monte Carlo solutions provides an estimate ofuncertainty in the DEM at each temperature. |
There was a problem hiding this comment.
| The spread of these Monte Carlo solutions provides an estimate ofuncertainty in the DEM at each temperature. | |
| The spread of these Monte Carlo solutions provides an estimate of uncertainty in the DEM at each temperature. |
| Point Spread Function — describes the response of the telescope to a point source of light. In XRTpy, it is used in deconvolution routines to sharpen images. | ||
|
|
||
| Response Matrix | ||
| A two-dimensional array containing the temperature response of each XRT filter interpolated onto the solver's regular log10 temperature grid.This matrix connects |
There was a problem hiding this comment.
| A two-dimensional array containing the temperature response of each XRT filter interpolated onto the solver's regular log10 temperature grid.This matrix connects | |
| A two-dimensional array containing the temperature response of each XRT filter interpolated onto the solver's regular log10 temperature grid. This matrix connects |
| """ | ||
| Test suite for xrtpy.xrt_dem_iterative and related DEM tools. | ||
|
|
||
| This file marks the 'tests' directory as a Python package and allows |
There was a problem hiding this comment.
| This file marks the 'tests' directory as a Python package and allows | |
| This file marks the `tests/` directory as a Python package and allows |
Mostly a personal stylistic preference to have the / and the end of a directory name to communicate that it's a directory. 🎨
Creating a tool to estimate differential emission measures (DEMs) from Hinode/XRT observations using temperature response functions and spline-based fitting techniques. It is a Python implementation inspired by the IDL routine
xrt_dem_iterative2.pro