Skip to content

XRT DEM Iterative Solver Module - #367

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

joyvelasquez wants to merge 305 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 917 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.68%. Comparing base (3cdc55f) to head (18472be).

Files with missing lines Patch % Lines
xrtpy/xrt_dem_iterative/dem_solver.py 0.00% 386 Missing ⚠️
...hysical_data_testing/test_dem_idl_comparison_mc.py 0.00% 168 Missing ⚠️
...rative/tests/physical_data_testing/utils_sav_io.py 0.00% 146 Missing ⚠️
...s/physical_data_testing/test_dem_idl_comparison.py 0.00% 111 Missing ⚠️
xrtpy/xrt_dem_iterative/dem_plotting.py 0.00% 99 Missing ⚠️
..._iterative/tests/physical_data_testing/conftest.py 0.00% 3 Missing ⚠️
xrtpy/xrt_dem_iterative/__init__.py 0.00% 2 Missing ⚠️
xrtpy/xrt_dem_iterative/tests/conftest.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #367       +/-   ##
===========================================
- Coverage   87.97%   49.68%   -38.30%     
===========================================
  Files          26       35        +9     
  Lines        1855     3285     +1430     
  Branches      110      235      +125     
===========================================
  Hits         1632     1632               
- Misses        180     1610     +1430     
  Partials       43       43               

☔ 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 30 commits September 28, 2026 16:36
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
Co-authored-by: Nick Murphy <namurphy@users.noreply.github.com>
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