Skip to content

Commit

Permalink
#159 - disc and full sky maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Augstein authored and Bradley Augstein committed Jun 12, 2024
1 parent ba9b1b5 commit b62c9f3
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion glass/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
Visibility
----------
.. autofunction:: vmap_full
.. autofunction:: vmap_disc
.. autofunction:: vmap_galactic_ecliptic
Expand All @@ -38,6 +40,51 @@
from .core.array import cumtrapz


def vmap_full(nside: int) -> np.ndarray:

'''visibility map for full sky
Parameters
----------
nside : int
The NSIDE parameter of the resulting HEALPix map.
Returns
-------
vis : array_like
A HEALPix :term:`visibility map`.
'''

m = np.ones(hp.nside2npix(nside))
return m

def vmap_disc(nside: int, coords: Tuple[float, float] = (60, 60),
radius: float = 20) -> np.ndarray:

'''visibility map for a disc on the full sky
Parameters
----------
nside : int
The NSIDE parameter of the resulting HEALPix map.
coords : Tuple[float, float]
colatitude and longitude in degress
Returns
-------
vis : array_like
A HEALPix :term:`visibility map`.
'''

vec = hp.ang2vec(coords[0]/180*np.pi, coords[1]/180*np.pi)
ipix_disc = hp.query_disc(nside=nside, vec=vec, radius=np.radians(radius))
m = np.zeros(hp.nside2npix(nside))
m[ipix_disc] = 1
return m

def vmap_galactic_ecliptic(nside: int, galactic: Tuple[float, float] = (30, 90),
ecliptic: Tuple[float, float] = (20, 80)
) -> np.ndarray:
Expand Down Expand Up @@ -72,7 +119,7 @@ def vmap_galactic_ecliptic(nside: int, galactic: Tuple[float, float] = (30, 90),
raise TypeError('ecliptic stripe must be a pair of numbers')

m = np.ones(hp.nside2npix(nside))
m[hp.query_strip(nside, *galactic)] = 0
#m[hp.query_strip(nside, *galactic)] = 0
m = hp.Rotator(coord='GC').rotate_map_pixel(m)
m[hp.query_strip(nside, *ecliptic)] = 0
m = hp.Rotator(coord='CE').rotate_map_pixel(m)
Expand Down

0 comments on commit b62c9f3

Please sign in to comment.