@@ -124,59 +124,6 @@ def update_pseudospectra_dict(f1, f2, pseudospectra_dict=None):
124124
125125 return pseudospectra_dict
126126
127- def TEB2pol (TEB ):
128- if TEB == 'T' :
129- return 'T'
130- elif TEB in ('E' , 'B' ):
131- return 'pol'
132- else :
133- raise ValueError ('Only valid strs are T, E, or B' )
134-
135- def get_can_discon_com_4pt (snf1 , snf2 , snf3 , snf4 ):
136- sv1 , m1 , pol1 , split1 = snf1
137- sv2 , m2 , pol2 , split2 = snf2
138- sv3 , m3 , pol3 , split3 = snf3
139- sv4 , m4 , pol4 , split4 = snf4
140- can_sn_field_info = pspipe_list .canonize_disconnected_4pt (snf1 , snf2 , snf3 , snf4 )
141- can = can_sn_field_info in canonized_sn_field_info2canonized_disconnected_combo_4pt
142-
143- ref_split1 , ref_split2 , ref_split3 , ref_split4 = covariance .get_4pt_sn_term_type (split1 , split2 , split3 , split4 )
144- ref_snf1 = (sv1 , m1 , pol1 , ref_split1 )
145- ref_snf2 = (sv2 , m2 , pol2 , ref_split2 )
146- ref_snf3 = (sv3 , m3 , pol3 , ref_split3 )
147- ref_snf4 = (sv4 , m4 , pol4 , ref_split4 )
148- ref_sn_field_info = (ref_snf1 , ref_snf2 , ref_snf3 , ref_snf4 )
149- ref = ref_sn_field_info in reference_sn_field_info2reference_canonized_disconnected_combo_4pt
150-
151- if can and ref :
152- raise ValueError (
153- f'For sn_field_info { snf1 , snf2 , snf3 , snf4 } , the possible reference disconnected '
154- f'sn_field_info { ref_sn_field_info } is in '
155- 'reference_sn_field_info2reference_canonized_disconnected_combo_4pt '
156- f'and canonized disconnected sn_field_info { can_sn_field_info } is in '
157- 'canonized_sn_field_info2canonized_disconnected_combo_4pt'
158- )
159-
160- if can :
161- can_discon_com_4pt = canonized_sn_field_info2canonized_disconnected_combo_4pt [can_sn_field_info ]
162- if ref :
163- can_discon_com_4pt = reference_sn_field_info2reference_canonized_disconnected_combo_4pt [ref_sn_field_info ]
164-
165- return can_discon_com_4pt
166-
167- # NOTE: this function is insensitive to disconnected 4pt canonization
168- def pols_disconnected_combo_4pt2ducc_optype (pol1 , pol2 , pol3 , pol4 ):
169- if cov_spin00_coupling_only :
170- return 0
171- else :
172- spin2_1 = int (pol1 == 'pol' and pol2 == 'pol' )
173- spin2_2 = int (pol3 == 'pol' and pol4 == 'pol' )
174-
175- # if 0, then the spintype is 00, which is ducc optype 0
176- # if 1, then the spintype is 02 (or 20), which is ducc optype 1
177- # if 2, then the spintype is ++, which is ducc optype 2
178- return spin2_1 + spin2_2
179-
180127@numba .njit (parallel = True )
181128def add_term_to_pseudo_cov_block (pseudo_cov_block , num_terms , w4_1234 , w4_coupling , w2_12 , w2_34 , C12 , C34 , coupling ):
182129 # important to cast the scalar to the right type before multiplication,
@@ -296,10 +243,10 @@ def add_term_to_pseudo_cov_block(pseudo_cov_block, num_terms, w4_1234, w4_coupli
296243 sv3 , m3 , TEB3 , split3 = sna3
297244 sv4 , m4 , TEB4 , split4 = sna4
298245
299- pol1 = TEB2pol (TEB1 )
300- pol2 = TEB2pol (TEB2 )
301- pol3 = TEB2pol (TEB3 )
302- pol4 = TEB2pol (TEB4 )
246+ pol1 = covariance . TEB2pol (TEB1 )
247+ pol2 = covariance . TEB2pol (TEB2 )
248+ pol3 = covariance . TEB2pol (TEB3 )
249+ pol4 = covariance . TEB2pol (TEB4 )
303250
304251 snf1 = (sv1 , m1 , pol1 , split1 )
305252 snf2 = (sv2 , m2 , pol2 , split2 )
@@ -312,7 +259,11 @@ def add_term_to_pseudo_cov_block(pseudo_cov_block, num_terms, w4_1234, w4_coupli
312259 w4_1234 = canonized_w4s [can_con_com_4pt_1234 ]
313260
314261 # get the w4 for the coupling that will be used for this term
315- can_discon_com_4pt_coupling = get_can_discon_com_4pt (snf1 , snf2 , snf3 , snf4 )
262+ can_discon_com_4pt_coupling = covariance .get_can_discon_com_4pt (
263+ snf1 , snf2 , snf3 , snf4 ,
264+ canonized_sn_field_info2canonized_disconnected_combo_4pt ,
265+ reference_sn_field_info2reference_canonized_disconnected_combo_4pt
266+ )
316267 can_con_com_4pt_coupling = pspipe_list .canonize_connected_4pt (* can_discon_com_4pt_coupling )
317268 w4_coupling = canonized_w4s [can_con_com_4pt_coupling ]
318269
@@ -334,7 +285,9 @@ def add_term_to_pseudo_cov_block(pseudo_cov_block, num_terms, w4_1234, w4_coupli
334285 #
335286 # NOTE: although using uncanonized pol1, pol2, pol3, pol4, the optype is
336287 # insensitive to disconnected 4pt canonization
337- optype = pols_disconnected_combo_4pt2ducc_optype (pol1 , pol2 , pol3 , pol4 )
288+ optype = covariance .pols_disconnected_combo_4pt2ducc_optype (
289+ pol1 , pol2 , pol3 , pol4 , cov_spin00_coupling_only
290+ )
338291 coups_idx = can_discon_com_4pts_and_optypes .index ((can_discon_com_4pt_coupling , optype ))
339292 coupling = coups [coups_idx ]
340293
0 commit comments