Skip to content

Rework level 2 __repr__s for consistency with level 1 - #745

Merged
Cadair merged 24 commits into
DKISTDC:mainfrom
SolarDrew:inv-repr
Oct 1, 2026
Merged

Cadair merged 24 commits into
DKISTDC:mainfrom
SolarDrew:inv-repr

Conversation

@SolarDrew

Copy link
Copy Markdown
Contributor

Closes #675

Scraps the basic repr for Inversion and Profiles, which is currently a slight variation on the NDCollection repr, and replaces it with a more detailed one based on the info string developed previously for Dataset and TiledDataset.

@codspeed

codspeed Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.49%

❌ 3 (👁 3) regressed benchmarks
✅ 13 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
👁 test_dataset_repr 8.5 ms 10 ms -14.56%
👁 test_tileddataset_repr[simple-nomask] 3.9 ms 4.2 ms -8.37%
👁 test_tileddataset_repr[simple-masked] 3.8 ms 4.1 ms -8.38%

Comparing SolarDrew:inv-repr (46e8b9e) with main (b645f33)

Open in CodSpeed

@SolarDrew

Copy link
Copy Markdown
Contributor Author

Example Inversion repr:

<dkist.dataset.inversion.Inversion object at 0x7f13b0b4c4a0>
This Level 2 product is a dictionary of 11 Datasets with 3 aligned dimensions and consists of 4664 total frames.
Files are stored in /home/drew/oss-projects/dkist/dkist/data/test

This Inversion has ID ...

The Datasets in this Inversion represent the following 11 physical parameters:
- optical_depth
- temperature
- electron_pressure
- microturbulence
- mag_strength
- velocity
- mag_inclination
- mag_azimuth
- geo_height
- gas_pressure
- density

These parameters were calculated using the following 3 line profiles (see the .profiles attribute for more information) :
- NaID
- FeI630
- CaII854

These Datasets share 3 pixel and 5 world dimensions.The shared pixel axes have shape [424, 508, 81].

Array Dim  Axis Name      Data size  Bounds
        0  frame_y             None  None
        1  slit_x              None  None
        2  optical_depth       None  None

World Dim  Axis Name                Physical Type                   Units
        4  stokes                   phys.polarization.stokes        unknown
        3  isot(utc; None           time                            s
        2  pos.helioprojective.lat  custom:pos.helioprojective.lat  arcsec
        1  pos.helioprojective.lon  custom:pos.helioprojective.lon  arcsec
        0  optical depth            phys.absorption.opticalDepth    pixel

Correlation between pixel and world axes:

                        |                PIXEL DIMENSIONS
       WORLD DIMENSIONS | optical_depth |     slit_x    |    frame_y
----------------------- | ------------- | ------------- | -------------
          optical depth |       x       |               |
pos.helioprojective.lon |               |       x       |       x
pos.helioprojective.lat |               |       x       |       x
         isot(utc; None |               |               |       x
                 stokes |               |       x       |

The above WCS information relates to only the pixel axes shared by all inversions, and the
corresponding world axes. Invdividual inversions may include other coordinate information.

@Cadair Cadair added the pre-commit.ci autofix Run the pre-commit bot on this PR automatically label Oct 1, 2026
@pre-commit-ci pre-commit-ci Bot removed the pre-commit.ci autofix Run the pre-commit bot on this PR automatically label Oct 1, 2026
@Cadair
Cadair merged commit d92d766 into DKISTDC:main Oct 1, 2026
41 checks passed
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.

Better repr for Inversion and Profiles classes

2 participants