89 """Measure crosstalk coefficients from the ratios 91 Given a list of ratios for each target/source amp combination, 92 we measure a robust mean and error. 94 The coefficient errors returned are the (robust) standard deviation of 99 ratios : `list` of `list` of `numpy.ndarray` 100 Matrix of arrays of ratios. 102 Number of rejection iterations. 104 Rejection threshold (sigma). 108 coeff : `numpy.ndarray` 109 Crosstalk coefficients. 110 coeffErr : `numpy.ndarray` 111 Crosstalk coefficient errors. 112 coeffNum : `numpy.ndarray` 113 Number of pixels for each measurement. 115 numAmps = len(ratios)
116 assert all(len(rr) == numAmps
for rr
in ratios)
118 coeff = np.zeros((numAmps, numAmps))
119 coeffErr = np.zeros((numAmps, numAmps))
120 coeffNum = np.zeros((numAmps, numAmps), dtype=int)
122 for ii, jj
in itertools.product(range(numAmps), range(numAmps)):
126 values = np.array(ratios[ii][jj])
127 values = values[np.abs(values) < 1.0]
129 coeffNum[ii][jj] = len(values)
132 coeff[ii][jj] = np.nan
133 coeffErr[ii][jj] = np.nan
136 for rej
in range(rejIter):
137 lo, med, hi = np.percentile(values, [25.0, 50.0, 75.0])
138 sigma = 0.741*(hi - lo)
139 good = np.abs(values - med) < rejSigma*sigma
140 if good.sum() == len(good):
142 values = values[good]
144 coeff[ii][jj] = np.mean(values)
145 coeffErr[ii][jj] = np.nan
if coeffNum[ii][jj] == 1
else np.std(values)
147 return coeff, coeffErr, coeffNum
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
def measureCrosstalkCoefficients(ratios, rejIter=3, rejSigma=2.0)