Skip to content

Commit d6926c4

Browse files
author
Thomas Satterthwaite
committed
Fixed factors of 2pi, dPhidT calculation
1 parent 3e7be09 commit d6926c4

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

sotodlib/toast/ops/mumux_crosstalk_util.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ def pos_to_chi(focalplane, dets, alpha=9.64e-30, tol=1.0, collision=1.0):
181181
is_north_subset.append(None)
182182
mux_band_subset.append(None)
183183
bond_pad_subset.append(None)
184+
# Convert to numpy objects
185+
freq_subset = np.array(freq_subset)
186+
is_north_subset = np.array(is_north_subset)
187+
mux_band_subset = np.array(mux_band_subset)
188+
bond_pad_subset = np.array(bond_pad_subset)
184189
# Compute chi for all detector pairs in this subset
185190
ndet = len(detector_subset)
186191
for idet1, det1 in enumerate(detector_subset):
@@ -211,6 +216,14 @@ def pos_to_chi(focalplane, dets, alpha=9.64e-30, tol=1.0, collision=1.0):
211216
continue
212217
if np.abs(bond_pad1 - bond_pad2) != 4:
213218
continue
219+
# Check that this truly is the nearly frequency neighbor
220+
neighbors = np.argwhere((is_north_subset == is_north1) & \
221+
(mux_band_subset == mux_band1)).flatten()
222+
freq_neighbors = np.argsort(np.abs(freq_subset[neighbors] - freq1)).flatten()
223+
if not idet2 in neighbors[freq_neighbors[1:3]]:
224+
# freq_neighbors[0] is idet1
225+
# frequency neighbors on either side
226+
continue
214227
x2, y2 = position_subset[idet2]
215228
# Translate frequencies to chi
216229
df = freq1 - freq2

sotodlib/toast/ops/sim_mumux_crosstalk.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
R_BOLO = 0.008
8282
# Readout noise fraction
8383
R_FRAC = 0.5
84+
# Shunt Resistance [Ohm]
85+
R_SHUNT = 400e-6
8486

8587

8688
@trait_docs
@@ -152,7 +154,7 @@ def _squid_phase_to_temperature(self, input_signal, dPhi0dT):
152154
output_signal = input_signal / dPhi0dT
153155
return output_signal
154156

155-
def _draw_Phi0(self, obs, focalplane, detectors, vmin=0.3, vmax=1.3):
157+
def _draw_Phi0(self, obs, focalplane, detectors, vmin=0.0, vmax=1.0):
156158
""" Draw initial SQUID phases from a flat distribution
157159
"""
158160
Phi0 = {}
@@ -173,6 +175,8 @@ def _draw_Phi0(self, obs, focalplane, detectors, vmin=0.3, vmax=1.3):
173175
counter=(counter1, counter2),
174176
)[0]
175177
v = vmin + x * (vmax - vmin)
178+
# Convert from Phi0 to Phi
179+
v *= 2 * np.pi
176180
Phi0[det] = v
177181

178182
return Phi0
@@ -209,9 +213,12 @@ def _evaluate_dPhi0dT(self, obs, signal, detectors, rows, Phi0):
209213
P_atm = efficiency * bandpass.optical_loading(det, median_signal) # W
210214
P_opt += P_atm - P_atm_ref
211215
dPdT = bandpass.kcmb2w(det) # K_CMB -> W
212-
dIdP = 1 / np.sqrt((P_sat - P_opt) * R_FRAC * R_BOLO) # W -> A
216+
R_TES = R_FRAC * R_BOLO
217+
I_TES = np.sqrt((P_sat - P_opt) / R_TES)
218+
dIdP = -1 / (I_TES * (R_TES - R_SHUNT)) # W -> A
213219
dPhi0dI = 1 / 9e-6 # A -> [rad]
214-
dPhi0dT[det] = dPdT * dIdP * dPhi0dI # K_CMB -> [rad]
220+
dPhidPhi0 = 2 * np.pi
221+
dPhi0dT[det] = dPdT * dIdP * dPhi0dI * dPhidPhi0 # K_CMB -> [rad]
215222

216223
return dPhi0dT
217224

@@ -290,10 +297,11 @@ def _exec(self, data, detectors=None, **kwargs):
290297
crosstalk += chi * np.sin(
291298
source_squid_phase - target_squid_phase
292299
)
293-
else:
294-
# Otherwise flag
295-
temp_obs.detdata[self.det_flags][det_source] |= self.det_flag_mask
296-
temp_obs.detdata[self.det_flags][det_target] |= self.det_flag_mask
300+
#else:
301+
# # Otherwise flag
302+
# print('Flagging!')
303+
# temp_obs.detdata[self.det_flags][det_source] |= self.det_flag_mask
304+
# temp_obs.detdata[self.det_flags][det_target] |= self.det_flag_mask
297305

298306
# Translate crosstalk into temperature units and scale to
299307
# match input data

0 commit comments

Comments
 (0)