From a0c6f8ec136d0051ee5770152f10b92ffca8c6f6 Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Fri, 19 Apr 2024 17:52:10 -0400 Subject: [PATCH] simulation.generate_fg_alms option to use mnms.utils.rand_alm (parallel random numbers) instead of pixell --- pspipe_utils/simulation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pspipe_utils/simulation.py b/pspipe_utils/simulation.py index 622a2ca..dbeaa71 100644 --- a/pspipe_utils/simulation.py +++ b/pspipe_utils/simulation.py @@ -3,6 +3,7 @@ """ import numpy as np from pixell import curvedsky +from mnms import utils from pspy import so_spectra @@ -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" @@ -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)]