Skip to content

Comments

Handle VLA Q descriptor in TableDataDiff#109

Open
casey-brooks wants to merge 1 commit intoastropy__astropy-14539from
fix/fitsdiff-vla-q-swev-astropy__astropy-14539
Open

Handle VLA Q descriptor in TableDataDiff#109
casey-brooks wants to merge 1 commit intoastropy__astropy-14539from
fix/fitsdiff-vla-q-swev-astropy__astropy-14539

Conversation

@casey-brooks
Copy link

Related Issue

Summary

  • treat Q variable-length array descriptors exactly like the existing P descriptors in TableDataDiff
  • add regression coverage for QD/QJ VLA columns, mixed P/Q tables, and printdiff text for identical files

Reproduction (before fix)

  1. Create a binary table containing a QD() variable-length array column and write it to disk:
    from astropy.io import fits
    from astropy.io.fits import Column
    import numpy as np
    
    data = np.array([
        np.array([1.0, 2.5]),
        np.array([], dtype=float),
        np.array([3.3]),
    ], dtype=object)
    
    fits.BinTableHDU.from_columns([Column(name="a", format="QD()", array=data)]) \
        .writeto("q.fits", overwrite=True)
  2. Compare the file to itself:
    from astropy.io.fits.diff import FITSDiff
    
    diff = FITSDiff("q.fits", "q.fits")
    print(diff.report())
  3. The same output appears when running fits.printdiff("q.fits", "q.fits").

Observed output (diff report only, no stack trace):

 fitsdiff: 0.0.0
 a: q.fits
 b: q.fits
 ...
   Data contains differences:
     Column a data differs in row 0:
        at [0]:
          a> [1.0 2.5]
          b> [1.0 2.5]
     1 different table data element(s) found (33.33% different).

Testing

  • pytest astropy/io/fits/tests/test_diff.py -q
  • pytest astropy/io/fits/tests/test_diff.py -k vla -q

@casey-brooks casey-brooks requested a review from a team December 23, 2025 12:48
@casey-brooks
Copy link
Author

Local Testing

  • pytest astropy/io/fits/tests/test_diff.py -q (53 passed)
  • pytest astropy/io/fits/tests/test_diff.py -k vla -q (5 passed, 48 deselected)

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; Q VLAs now follow P path and tests cover key scenarios.

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