Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert a new primary HDU #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Aug 26, 2021

Uses PREPEND_PRIMARY as discussed in #16 . Currently I've hard-coded the value here, which is not ideal. This allows one to insert a new primary HDU and convert the pre-existing one to an image HDU.

julia> f = fits_create_file(tempname());

julia> a = ones(3);

julia> fits_create_img(f, a); fits_write_pix(f, a);

julia> fits_get_img_size(f)
1-element Vector{Int64}:
 3

julia> fits_insert_img(f, Float64, [3,2], true); # insert new primary image

julia> fits_get_hdu_num(f) # check that the current HDU index is still 1
1

julia> fits_get_img_size(f) # the original HDU has been replaced
2-element Vector{Int64}:
 3
 2

julia> fits_movabs_hdu(f, 2) # the original primary HDU is now an image
:image_hdu

julia> fits_get_img_size(f)
1-element Vector{Int64}:
 3

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #18 (fd66522) into master (5c376e4) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   77.04%   76.85%   -0.19%     
==========================================
  Files           1        1              
  Lines         588      592       +4     
==========================================
+ Hits          453      455       +2     
- Misses        135      137       +2     
Impacted Files Coverage Δ
src/CFITSIO.jl 76.85% <100.00%> (-0.19%) ⬇️

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 5c376e4...fd66522. Read the comment docs.

Copy link
Member

@giordano giordano left a comment

Choose a reason for hiding this comment

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

I only wonder if prependprimary should be a keyword argument, but I don't have a strong opinion about that, I'm fine with the current implementation

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