Skip to content

Conversation

@nabobalis
Copy link
Member

@nabobalis nabobalis commented Dec 19, 2025

Summary by Sourcery

Align IRIS SJI/SG timing with DATE_OBS metadata, expand wavelength band mappings, and add an example demonstrating potential SJI–spectrograph WCS offsets.

New Features:

  • Add an example script illustrating potential WCS offsets between IRIS slit-jaw images and spectrograph data using archival observations.

Bug Fixes:

  • Correct time handling in SJI and wobble utilities to derive cadences and timestamps from DATE_OBS and full per-frame timing arrays rather than STARTOBS plus deltas.
  • Ensure spectrograph reader uses DATE_OBS as the base observation time when constructing the Earth observer location.

Enhancements:

  • Simplify and clarify human-readable string representations for SJI and spectrograph cubes by consolidating observation timing and metadata labels.
  • Expand spectral band lookup constants to cover additional IRIS FUV and NUV wavelength keys.

Build:

  • Extend tox test matrix to include Python 3.14.

CI:

  • Relax Ruff linting by ignoring N816 for a specific mixedCase global variable.

Documentation:

  • Update example documentation links to point to HEK event pages and add narrative around SJI–SG offset behavior.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 19, 2025

Reviewer's Guide

Refactors IRIS time metadata usage from STARTOBS/ENDOBS to DATE_OBS and explicit per-frame times, expands spectral band mappings, updates string representations and wobble timestamp logic, adds an example demonstrating SJI–SG WCS offsets, and refreshes tooling configs (tox, Ruff).

Sequence diagram for updated per-frame WCS time handling in _create_wcs

sequenceDiagram
    participant User
    participant read_spectrograph_lvl2
    participant _create_wcs
    participant FITS_HDUList as FITS_HDUList
    participant AstropyTime as Time
    participant SunPyCoord as get_body_heliographic_stonyhurst

    User->>read_spectrograph_lvl2: open spectrograph FITS
    read_spectrograph_lvl2->>FITS_HDUList: load primary and extension headers
    read_spectrograph_lvl2->>_create_wcs: call with hdulist

    _create_wcs->>AstropyTime: base_time = Time(hdulist[0].header[STARTOBS])
    _create_wcs->>FITS_HDUList: read per-frame TIME column
    _create_wcs->>AstropyTime: obs_times = base_time + time_column * s

    loop for each frame i
        _create_wcs->>SunPyCoord: get_body_heliographic_stonyhurst(Earth, obs_times[i].isot)
        SunPyCoord-->>_create_wcs: Earth heliographic location at obs_times[i]
        _create_wcs->>_create_wcs: build Helioprojective observer with obstime = obs_times[i]
        _create_wcs->>_create_wcs: compute rotation_matrix and FITS WCS for frame i
    end

    _create_wcs-->>read_spectrograph_lvl2: list of per-frame WCS objects
    read_spectrograph_lvl2-->>User: SpectrogramCube with accurate per-frame WCS times
Loading

File-Level Changes

Change Details Files
Update SJI GWCS construction to use DATE_OBS as the reference obstime and a zero-based cadence lookup instead of a mutated base time and times array.
  • Rename base_time to start_time and take it from the primary header DATE_OBS field
  • Rename times array to cadence, compute it from the TIME column, and normalize to start at zero seconds
  • Use cadence as the lookup_table in the Tabular1D temporal model
  • Set Helioprojective and TemporalFrame obstime to start_time instead of a time-shifted base_time
irispy/io/sji.py
Refine spectrograph WCS time handling to compute absolute observation times directly for each frame.
  • Replace base_time+times pattern with a precomputed obs_times Time array using STARTOBS plus TIME offsets
  • Use obs_times[i] for both observer location queries and Helioprojective obstime values
irispy/io/sji.py
Simplify and standardize SJI and spectrograph cube str metadata output around observation date ranges and naming.
  • Collapse separate start/end/instance time and description fields into a single Obs Date line for SJI output and shorten label names
  • Remove explicit Obs. Start/End and Spectrogram period strings, replacing with Obs Date for spectrograph output while keeping OBS ID and description
irispy/sji.py
irispy/spectrograph.py
Expand spectral band lookup constants to cover more numeric window identifiers for FUV/NUV classification.
  • Add additional FUV numeric keys (1336, 1349, 1352, 1356, 1394, 1403) mapped to 'FUV'
  • Add additional NUV numeric keys (2796, 2831) mapped to 'NUV'
irispy/utils/constants.py
Align wobble movie timestamp generation and spectrograph reading with DATE_OBS usage instead of STARTOBS.
  • Update wobble docstring to state timestamps are based on DATE_OBS
  • Change wobble timestamp calculation and default single timestamp to parse header['DATE_OBS']
  • Change spectrograph level-2 reader base_time to come from header['DATE_OBS'] before building the observer frame
irispy/utils/wobble.py
irispy/io/spectrograph.py
Add an example script demonstrating potential WCS offsets between SJI and SG data using AUX data and plotting.
  • Download a specific IRIS raster and SJI dataset with pooch and open via irispy.read_files
  • Compute nearest SJI time to a chosen raster step using axis_world_coords
  • Load AUX extensions from both raster and SJI files to extract offset and slit pixel information
  • Convert slit locations to SkyCoord, apply SG and SJI offsets, and visualize differences overlayed on SJI imagery with cropped view
examples/offset_sji_sg.py
Minor documentation and tooling configuration updates to support the new example and Python version.
  • Update the umbral_flashes example URL to a HEK VOEvent link
  • Extend tox test matrix to include Python 3.14 and adjust Ruff ignores to skip N816 for a specific mixedCase variable
examples/umbral_flashes.py
tox.ini
ruff.toml
docs/guide.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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.

2 participants