JuliaAstro / FITSIO.jl

Flexible Image Transport System (FITS) file support for Julia
http://juliaastro.org/FITSIO.jl/
MIT License
55 stars 29 forks source link

Add deleteat #156

Closed jishnub closed 2 years ago

jishnub commented 3 years ago

This PR depends on https://github.com/JuliaAstro/CFITSIO.jl/pull/6, where the function to delete an HDU is added. Now it's possible to remove an HDU from a FITS file.

julia> f = FITS(tempname() * ".fits", "w");

julia> write(f, ones(1,1))

julia> write(f, ones(2,2))

julia> write(f, ones(3,3))

julia> deleteat!(f, 2)
File: /tmp/jl_XeX9WX.fits
Mode: "w" (read-write)
HDUs: Num  Name  Type   
      1          Image  
      2          Image  

julia> size(f[2])
(3, 3)

julia> deleteat!(f, 1) # deleting the primary HDU recreates one with minimal metadata and no image
File: /tmp/jl_XeX9WX.fits
Mode: "w" (read-write)
HDUs: Num  Name  Type   
      1          Image  
      2          Image  

julia> size(f[1])
()

julia> size(f[2])
(3, 3)
codecov[bot] commented 2 years ago

Codecov Report

Merging #156 (e0aaa91) into master (95780ef) will increase coverage by 0.06%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
+ Coverage   91.35%   91.42%   +0.06%     
==========================================
  Files           5        5              
  Lines         613      618       +5     
==========================================
+ Hits          560      565       +5     
  Misses         53       53              
Impacted Files Coverage Δ
src/FITSIO.jl 100.00% <ø> (ø)
src/header.jl 85.88% <ø> (ø)
src/fits.jl 95.83% <100.00%> (+0.31%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 95780ef...e0aaa91. Read the comment docs.

jishnub commented 2 years ago

@giordano @mileslucas Could you have a look at this PR?