Skip to content

fix: fix tdim issue - #46

Open
jamesrafe wants to merge 2 commits into
mainfrom
fix/fix-tdim-issue
Open

fix: fix tdim issue#46
jamesrafe wants to merge 2 commits into
mainfrom
fix/fix-tdim-issue

Conversation

@jamesrafe

@jamesrafe jamesrafe commented Jul 26, 2026

Copy link
Copy Markdown

Closes #44

Fix one-dimensional FITS TDIM values such as TDIM=(3). These were parsed as an integer, but BinaryField expects dimensions as a tuple or nothing. The new helper normalizes them to (3,) across all binary-table construction paths and adds tests for the changes.

@jamesrafe
jamesrafe requested a review from barrettp as a code owner July 26, 2026 16:38
@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.68%. Comparing base (870e4ee) to head (c00fcc3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   46.35%   46.68%   +0.33%     
==========================================
  Files          17       17              
  Lines        2550     2551       +1     
==========================================
+ Hits         1182     1191       +9     
+ Misses       1368     1360       -8     

☔ 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.

@jamesrafe
jamesrafe force-pushed the fix/fix-tdim-issue branch from 11c5a1b to cef8eb2 Compare July 31, 2026 14:47

@barrettp barrettp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. Remove prepended underscore, i.e., _parse_tdim() -> parse_tdim(),
  2. The argument string should not require the strip() function. If it does, then there is a problem with the initial string parsing function or regex,
  3. Suggest parsing the string using a Regex to ensure that the Tuple values are integers, instead of eval() or using a replace() to insert the missing comma,
  4. The function should return a Tuple or nothing, where nothing means that TDIMj is either missing or an empty string, and
  5. The function should be more concise, i.e., no more that 1 or 2 lines of code.

Note that the TDIMj Tuple also needs to be reconciled with the array size and element type. For example, if the element type is a string then, the TDIMj should return a Tuple of one fewer dimensions, because the first dimension gives the size of the string. See the FITS standards document for details.

@jamesrafe

Copy link
Copy Markdown
Author

Hi @barrettp, parse_tdim now uses regex, returns nothing for missing/empty values, and handles FITS header padding without strip. Tests also cover one-dimensional and multi-dimensional values plus invalid input. Thank you!

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.

Error in handling one-dimensional TDIM values in binary tables

2 participants