Skip to content

Commit

Permalink
simulation.generate_fg_alms option to use mnms.utils.rand_alm (parall…
Browse files Browse the repository at this point in the history
…el random numbers) instead of pixell
  • Loading branch information
zatkins2 committed Apr 19, 2024
1 parent 63b67be commit a0c6f8e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pspipe_utils/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import numpy as np
from pixell import curvedsky
from mnms import utils
from pspy import so_spectra


Expand Down Expand Up @@ -114,7 +115,8 @@ def foreground_matrix_from_files(f_name_tmp, arrays_list, lmax, spectra, input_t
return l, fl_array


def generate_fg_alms(fg_mat, arrays_list, lmax, dtype="complex64"):
def generate_fg_alms(fg_mat, arrays_list, lmax, dtype="complex64",
method='mnms', **method_kwargs):
"""
This function generate the alms corresponding to a fg matrix
the alms are returned in the form of a dict with key "freq"
Expand All @@ -134,7 +136,12 @@ def generate_fg_alms(fg_mat, arrays_list, lmax, dtype="complex64"):

narrays = len(arrays_list)

fglms_all = curvedsky.rand_alm(fg_mat, lmax=lmax, dtype=dtype)
if method == 'mnms':
func = utils.rand_alm
elif method == 'curvedsky':
func = curvedsky.rand_alm

fglms_all = func(fg_mat, lmax=lmax, dtype=dtype, **method_kwargs)
fglm_dict = {}
for i, array in enumerate(arrays_list):
fglm_dict[array] = [fglms_all[i + k * narrays] for k in range(3)]
Expand Down

0 comments on commit a0c6f8e

Please sign in to comment.