Skip to content

Commit

Permalink
fix bug in sub
Browse files Browse the repository at this point in the history
  • Loading branch information
guanyilun committed Mar 1, 2022
1 parent 77075bf commit 72b5008
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAngles = "6fb2a4bd-7999-5318-a3b2-8ad61056cd98"
WCS = "15f3aee2-9e10-537f-b834-a6fb8bdb944d"
WCS_jll = "550c8279-ae0e-5d1b-948f-937f2608a23e"

[compat]
ColorSchemes = "3"
Expand Down
1 change: 1 addition & 0 deletions src/Pixell.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Pixell

using WCS
using WCS_jll
import WCS: AbstractWCSTransform
using FITSIO
using FFTW
Expand Down
15 changes: 8 additions & 7 deletions src/enmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,14 @@ function Base.show(io::IO, imap::Enmap)
end

# Select the first n axes, should move to WCS.jl at some point
function sub(wcs::WCS.WCSTransform, n::Int; inplace=true)
new_wcs = inplace ? wcs : copy(wcs)
# all naxis fields will be truncated after changing naxis, as
# WCS.getproperty refs naxis. Note that wcs.naxis = 2 doesn't work
# because it isn't implemented in WCS.setproperty!.
setfield!(new_wcs, :naxis, Int32(min(n, wcs.naxis)))
new_wcs
function sub(src::WCS.WCSTransform, n::Int)
dst = WCSTransform(n)
nsub = Array{Cint}([n])
axes = Array{Cint}(collect(1:n))
ccall((:wcssub, libwcs), Cint,
(Cint, Ref{WCSTransform}, Ptr{Cint}, Ptr{Cint}, Ref{WCSTransform}),
0, src, nsub, axes, dst)
dst
end

function resolve_polcconv!(data::A, header::FITSIO.FITSHeader, sel; verbose=true) where {A<:AbstractArray}
Expand Down

0 comments on commit 72b5008

Please sign in to comment.