You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Pixell, WCS
shape, wcs =fullsky_geometry(WCSTransform, deg2rad(1))
shape = (shape..., 2) # this is a map with shape (nx, ny, 2)# read map to disk and then get it back
m =Enmap(randn(shape), wcs)
write_map("test.fits", m)
m2 =read_map("test.fits") # add ; trim=false if PR #41 is merged
wcs = m2.wcs
# check sky coordinates, then check sky coordinates of a *copy*print(pix_to_world(wcs, [50., 50.]), "", pix_to_world(copy(wcs), [50., 50.]))
ok, I think I've figured out what is going on. When the image is loaded from disk, sub is called to trim the wcs to leave only the first two axes. I did it in a sloppy way by simply changing the naxis field. This works for all 1D fields such as crval, cdelt, etc., but it doesn't change naxis and the linear transformation matrix stored in the linprm struct in wcs.lin. For example, after the map has been read from disk (m2), wcs.naxis=2 but wcs.lin.naxis=3. This mismatch causes memory overflow when one tries to make a copy of it, resulting in the above error.
I think the
sub
function is affecting some memory references in the C struct, and does bad things to the WCSTransform.This manifests in a strange way: the
copy
method is broken on such WCS.Here's the MWE @guanyilun
This is related to JuliaAstro/WCS.jl#43
The text was updated successfully, but these errors were encountered: