@@ -44,11 +44,9 @@ def mc_lightcone_random_ra_dec(ran_key, npts, ra_min, ra_max, dec_min, dec_max):
4444 Random coords on the sphere within the input range
4545
4646 """
47- phi_min = jnp .deg2rad (ra_min )
48- phi_max = jnp .deg2rad (ra_max )
49-
50- theta_min = jnp .deg2rad (90.0 - dec_max )
51- theta_max = jnp .deg2rad (90.0 - dec_min )
47+ theta_min , theta_max , phi_min , phi_max = _get_theta_phi_minmax_from_ra_dec_minmax (
48+ ra_min , ra_max , dec_min , dec_max
49+ )
5250
5351 theta , phi = mc_lightcone_random_theta_phi (
5452 ran_key , npts , theta_min , theta_max , phi_min , phi_max
@@ -58,6 +56,28 @@ def mc_lightcone_random_ra_dec(ran_key, npts, ra_min, ra_max, dec_min, dec_max):
5856 return ra , dec
5957
6058
59+ @jjit
60+ def _get_ra_dec_minmax_from_theta_phi_minmax (theta_min , theta_max , phi_min , phi_max ):
61+ ra_min = jnp .rad2deg (phi_min )
62+ ra_max = jnp .rad2deg (phi_max )
63+
64+ dec_min = 90.0 - jnp .rad2deg (theta_max )
65+ dec_max = 90.0 - jnp .rad2deg (theta_min )
66+
67+ return ra_min , ra_max , dec_min , dec_max
68+
69+
70+ @jjit
71+ def _get_theta_phi_minmax_from_ra_dec_minmax (ra_min , ra_max , dec_min , dec_max ):
72+ phi_min = jnp .deg2rad (ra_min )
73+ phi_max = jnp .deg2rad (ra_max )
74+
75+ theta_min = jnp .deg2rad (90.0 - dec_max )
76+ theta_max = jnp .deg2rad (90.0 - dec_min )
77+
78+ return theta_min , theta_max , phi_min , phi_max
79+
80+
6181@partial (jjit , static_argnames = ["npts" ])
6282def mc_lightcone_random_theta_phi (
6383 ran_key , npts , theta_min , theta_max , phi_min , phi_max
0 commit comments