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

ENH(observations) #159 - disc and full sky maps #160

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions 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 @@ -31,13 +33,55 @@
import numpy as np
import healpy as hp
import math

from typing import Optional, Tuple, List
from numpy.typing import ArrayLike

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
Loading