Skip to content

XRT DEM Iterative Solver Module#367

Open
joyvelasquez wants to merge 244 commits into
HinodeXRT:mainfrom
joyvelasquez:xray-plasma-decoder-dem-solver
Open

XRT DEM Iterative Solver Module#367
joyvelasquez wants to merge 244 commits into
HinodeXRT:mainfrom
joyvelasquez:xray-plasma-decoder-dem-solver

Conversation

@joyvelasquez

@joyvelasquez joyvelasquez commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR introduces XRTDEMIterative, a Python implementation of the IDL
routine xrt_dem_iterative2.pro for estimating Differential Emission
Measures (DEMs) from Hinode/XRT multi-filter observations.

What's Included

Core Solver (dem_solver.py)

  • XRTDEMIterative class with full DEM solving pipeline
  • Spline-parameterized DEM representation with iterative least-squares
    fitting via lmfit
  • Temperature response interpolation onto a regular log10(T) grid
  • User-supplied or default intensity uncertainty model:
    max(0.03 * intensity, 2 DN/s/pix), matching IDL default behavior
  • Monte Carlo uncertainty estimation via monte_carlo_runs parameter
  • Input validation with informative warnings (saturation, negative
    intensities, missing errors)
  • summary() method for diagnostic output

Plotting (dem_plotting.py)

  • plot_dem() — base DEM solution visualization
  • plot_dem_mc() — base DEM + Monte Carlo ensemble overlay

Tests

  • 70+ unit tests covering input validation, grid construction,
    response interpolation, spline system, residuals, solver, and
    Monte Carlo behavior
  • Currently - heavy work in progress (UPDATED JULY 2026)

Documentation

  • dem_overview.rst — introduction to DEM analysis with XRTpy
  • API reference for xrtpy.xrt_dem_iterative
  • Changelog entry in docs/changelog/0.6.0.rst

Validation -

  • Validated against IDL xrt_dem_iterative2.pro across multiple
    solar observation cases using Monte Carlo comparison
  • Currently - heavy work in progress (UPDATED JULY 2026)

@joyvelasquez joyvelasquez self-assigned this Jul 16, 2025
@joyvelasquez joyvelasquez added this to the 0.6.0 milestone Jul 16, 2025
@joyvelasquez

Copy link
Copy Markdown
Contributor Author

Ensure the function checks for minimum required inputs (filters, observed intensities, etc.) and validates that all observation values are non-zero before proceeding.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2560 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.28%. Comparing base (28a2e02) to head (bb258ef).

Files with missing lines Patch % Lines
xrtpy/xrt_dem_iterative/test/test_dem_solver.py 0.00% 502 Missing ⚠️
xrtpy/xrt_dem_iterative/dem_solver.py 0.00% 386 Missing ⚠️
...rative/test/older_testing_methods/plots_results.py 0.00% 294 Missing ⚠️
...ive/test/older_testing_methods/idl_vs_xrtpy_dem.py 0.00% 265 Missing ⚠️
xrtpy/xrt_dem_iterative/test/plot_mc_comparison.py 0.00% 211 Missing ⚠️
...t_dem_iterative/test/test_dem_idl_comparison_mc.py 0.00% 168 Missing ⚠️
xrtpy/xrt_dem_iterative/test/utils_sav_io.py 0.00% 164 Missing ⚠️
...py/xrt_dem_iterative/test/plot_idl_vs_xrtpy_dem.py 0.00% 149 Missing ⚠️
...rative/test/older_testing_methods/utils_case_io.py 0.00% 117 Missing ⚠️
.../xrt_dem_iterative/test/test_dem_idl_comparison.py 0.00% 114 Missing ⚠️
... and 4 more

❗ There is a different number of reports uploaded between BASE (28a2e02) and HEAD (bb258ef). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (28a2e02) HEAD (bb258ef)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #367       +/-   ##
===========================================
- Coverage   87.35%   36.28%   -51.07%     
===========================================
  Files          26       40       +14     
  Lines        1819     4379     +2560     
  Branches      106      334      +228     
===========================================
  Hits         1589     1589               
- Misses        184     2744     +2560     
  Partials       46       46               

☔ View full report in Codecov by Harness.
📢 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.

Comment thread docs/gallery/data_processing/deconvolving.py
Comment thread docs/gallery/data_processing/remove_lightleak.py
Comment thread docs/gallery/data_processing/temperature_from_filter_ratios.py
Comment thread docs/gallery/instrument_response/effective_area.py
Comment thread docs/about_xrt.rst
joyvelasquez and others added 2 commits July 13, 2026 12:44
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
@namurphy

Copy link
Copy Markdown
Contributor

Thinking about compatibility with GenericModel in sunkit-dem, it would help to add attributes for temperature_bin_centers and temperature_bin_widths to XRTDEMIterative.

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

Labels

Code Improvement For general improvements to the codebase without adding new features. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants