In [11]:
%load_ext autoreload
%autoreload 2
from __future__ import print_function
from enlib import enmap
import numpy as np
import os,sys


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [12]:
res = 2.0
ishape,iwcs = enmap.geometry(pos=np.deg2rad([[-70,110],[10,-65]]),res=res*np.pi/180./60.,proj='car')
iarea = enmap.area(ishape,iwcs)

In [13]:
gmap = enmap.enmap(np.random.random(size=ishape),iwcs)
enmap.write_map("temp.fits",gmap)
imap = enmap.read_map("temp.fits")
assert np.all(np.isclose(gmap,imap))
oshape,owcs = imap.shape,imap.wcs
oarea = enmap.area(oshape,owcs)
print((iarea-oarea)/iarea*100.)


1.7801316205279277e-12

In [14]:
from pixell import wcsutils
assert wcsutils.equal(iwcs,owcs)

In [15]:
from pixell import curvedsky
alms = curvedsky.map2alm(gmap,lmax=3072)

In [16]:
alms = curvedsky.map2alm(imap,lmax=3072)


---------------------------------------------------------------------------
ShapeError                                Traceback (most recent call last)
~/repos/pixell/pixell/curvedsky.py in map2alm(map, alm, ainfo, lmax, spin, direct, copy, oversample, method, rtol, atol)
    128 			alm = map2alm_cyl(map, alm, ainfo=ainfo, lmax=lmax, spin=spin, direct=direct,
--> 129 					copy=copy, rtol=rtol, atol=atol)
    130                 except ShapeError as e:

~/repos/pixell/pixell/curvedsky.py in map2alm_cyl(map, alm, ainfo, lmax, spin, direct, copy, rtol, atol)
    248         # See if our pixelization matches one with known weights.
--> 249         minfo = match_predefined_minfo(tmap, rtol=rtol, atol=atol)
    250         return map2alm_raw(tmap, alm, minfo, ainfo, spin=spin)

~/repos/pixell/pixell/curvedsky.py in match_predefined_minfo(m, rtol, atol)
    463         i2 = i1+ntheta
--> 464         if not aoff < atol: raise ShapeError("Could not find a map_info with predefined weights matching input map (abs offset %e >= %e)" % (aoff, atol))
    465         if not roff < rtol: raise ShapeError("Could not find a map_info with predefined weights matching input map (%rel offset e >= %e)" % (aoff, atol))

ShapeError: Could not find a map_info with predefined weights matching input map (abs offset 2.908882e-04 >= 2.908882e-04)

During handling of the above exception, another exception occurred:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-16-9e527da66726> in <module>()
----> 1 alms = curvedsky.map2alm(imap,lmax=3072)

~/repos/pixell/pixell/curvedsky.py in map2alm(map, alm, ainfo, lmax, spin, direct, copy, oversample, method, rtol, atol)
    129 					copy=copy, rtol=rtol, atol=atol)
    130                 except ShapeError as e:
--> 131                         raise NotImplementedError("map2alm for noncylindrical layouts not implemented")
    132         else:
    133                 raise ValueError("Unknown alm2map method %s" % method)

NotImplementedError: map2alm for noncylindrical layouts not implemented

In [17]:
print(gmap.shape,gmap.wcs)
print(imap.shape,imap.wcs)


(2400, 5250) car:{cdelt:[-0.03333,0.03333],crval:[22.5,0],crpix:[2626,2100]}
(2400, 5250) car:{cdelt:[-0.03333,0.03333],crval:[22.5,0],crpix:[2626,2100]}

In [17]:


In [ ]: