mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 21:38:03 +00:00
Add nside2radec
This commit is contained in:
parent
c9829c0acc
commit
64bacc20db
1 changed files with 21 additions and 0 deletions
|
@ -17,6 +17,7 @@ Utility functions for the field module.
|
||||||
"""
|
"""
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
|
|
||||||
|
import healpy
|
||||||
import numpy
|
import numpy
|
||||||
import smoothing_library as SL
|
import smoothing_library as SL
|
||||||
|
|
||||||
|
@ -65,3 +66,23 @@ def smoothen_field(field, smooth_scale, boxsize, threads=1):
|
||||||
W_k = SL.FT_filter(boxsize, smooth_scale, field.shape[0], "Gaussian",
|
W_k = SL.FT_filter(boxsize, smooth_scale, field.shape[0], "Gaussian",
|
||||||
threads)
|
threads)
|
||||||
return SL.field_smoothing(field, W_k, threads)
|
return SL.field_smoothing(field, W_k, threads)
|
||||||
|
|
||||||
|
|
||||||
|
def nside2radec(nside):
|
||||||
|
"""
|
||||||
|
Generate RA and declination for HEALPix pixel centres.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
nside : int
|
||||||
|
HEALPix nside parameter.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
radec : array of shape `(npix, 2)`
|
||||||
|
RA and declination in degrees.
|
||||||
|
"""
|
||||||
|
pixs = numpy.arange(healpy.nside2npix(nside))
|
||||||
|
theta, phi = healpy.pix2ang(nside, pixs)
|
||||||
|
theta -= numpy.pi / 2
|
||||||
|
return numpy.rad2deg(numpy.vstack([phi, theta]).T)
|
||||||
|
|
Loading…
Reference in a new issue