Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 46.35% 46.94% +0.58%
==========================================
Files 17 17
Lines 2550 2550
==========================================
+ Hits 1182 1197 +15
+ Misses 1368 1353 -15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
These PRs do not provide sufficient descriptions to review them properly. |
|
Hi Paul, sure, here is more detail based on my current understanding. Please correct me if I have misunderstood something. I've also updated the PR description in the Reproject.jl repo to include more detail as well:
Does this seem reasonable to you? Happy to adjust/provide additional examples if it is useful here |
Hi Paul, these are three fixes/additions that surfaced while I was porting Reproject.jl over to FITSFiles.jl. The first changes the types of some parsed card values, so I've marked this as a breaking release: 0.3.2 --> 0.4.0 for your review.
1. Header real values are no longer silently corrupted (
parse_number)parse_numberpickedFloat32vs.Float64by counting fractional digits (10 or more -->Float64), which seemed to unintentionally introduce a bug. Any value whose decimal representation didn't fitFloat32was silently corrupted:Before:
After:
The parser now reads every real at
Float64precision and narrows toFloat32only when the narrowed value represents the written decimal exactly (Float64(Float32(x)) == x), preserving the smallest-type behavior for values like1.0or0.5while never losing information.D-exponent values always parse asFloat64per the FITS convention, and E-notation values get the same round-trip treatment (previously, e.g.,1E30also parsed lossily asFloat32). The now-unusedoverflowhelper is removed.Downstream consequence: Scale keywords like
BSCALE = 0.1are nowFloat64, so scaled integer data promotes toFloat64(e.g.,Int32data withBSCALE = 0.1,BZERO = 1.0now reads as exactly1.1rather than1.1f0), matching what astropy and FITSIO produce. Test expectations that encoded the old lossy values are updated accordingly.2. HDU vector methods now accept concrete vectors
All the
Vector{HDU}signatures infitscore.jl(write,info,show,haskey,getindex,get,findfirst) only matched vectors with the abstract element type, because parametric invariance meansVector{HDU{Primary}}is not aVector{HDU}. Vectors returned byfits()happened to dispatch fine, but user-constructed ones did not:All signatures are now widened to
AbstractVector{<:HDU}, with an additionalVector{<:HDU}method forwriteso it takes precedence overBase.write(::IO, ::Array)in dispatch.3. New:
Base.size(hdu)Base.size(hdu::HDU{<:Union{Primary, Image}})returns the data dimensions from theNAXISncards without reading the data, so callers holding a lazy-loaded HDU can get its shape for free (Reproject.jl uses this to size output projections).