Commits
Des Small authored b4a2b9b093f Merge
177 177 | FringeJonesTest() : |
178 178 | VisCalTestBase(1, // nfield |
179 179 | 1, // nscan |
180 180 | 1, // nspw |
181 181 | 7, // nant |
182 182 | 4, // ncorr |
183 183 | 64, // nchan per spw |
184 184 | 16, // ntime per scan |
185 185 | false), // unpolarized |
186 186 | // nPar, 1, {1 | nAntennas} |
187 - | fpar(8, 1, VisCalTestBase::nAnt, 0.0f) // 8 pars per antenna |
187 + | fpar(8, 1, VisCalTestBase::nAnt, 0.0f) // Now 8 pars per antenna |
188 188 | { |
189 189 | // Add FringeJonesTest specific init |
190 190 | // e.g., fill fpar with interesting values |
191 191 | for (Int i=1; i!=VisCalTestBase::nAnt; i++) { |
192 192 | // 1, 4 are delay. |
193 193 | fpar(1, 0, i) = 2.3; |
194 - | fpar(5, 0, i) = -1.7; |
195 - | // Parameters 2 and 6 are rate. But VisCal::setMeta currently |
194 + | fpar(1+4, 0, i) = -1.7; |
195 + | // Parameters 2 and 5 are rate. But VisCal::setMeta currently |
196 196 | // only supports a single double for time, and this meta data is |
197 197 | // used to generate all the Jones matrices for the FringeJones |
198 198 | // (or any other VisCal subclass) calibrater; I don't feel |
199 199 | // comfortable enough with the calibration stack to try to |
200 200 | // intervene on this, so for now we can only test zero rates for |
201 201 | // the FringeJones class proper. |
202 202 | fpar(2, 0, i) = 0.0; |
203 - | fpar(6, 0, i) = 0.0; |
203 + | fpar(2+4, 0, i) = 0.0; |
204 204 | } |
205 205 | // uncomment to see data shape summary from |
206 206 | //VisCalTestBase::summary("FringeJonesTest"); |
207 207 | } |
208 208 | }; |
209 209 | |
210 210 | |
211 211 | TEST_F(FringeJonesTest, FringeJonesApplyState) { |
212 212 | |
213 213 | FringeJones ff(VisCalTestBase::msmc); |
214 214 | ff.setApply(); |
215 215 | |
216 216 | ASSERT_EQ(VisCalEnum::JONES,ff.matrixType()); |
217 217 | ASSERT_EQ(VisCal::K,ff.type()); |
218 218 | ASSERT_EQ(String("Fringe Jones"),ff.typeName()); |
219 - | //ASSERT_EQ(6,ff.nPar()); |
219 + | // ASSERT_EQ(8,ff.nPar()); |
220 220 | ASSERT_FALSE(ff.freqDepPar()); |
221 221 | ASSERT_TRUE(ff.freqDepMat()); |
222 222 | ASSERT_FALSE(ff.freqDepCalWt()); |
223 223 | ASSERT_EQ(True,ff.timeDepMat()); |
224 224 | ASSERT_TRUE(ff.isApplied()); |
225 225 | ASSERT_TRUE(ff.isSolvable()); |
226 226 | ASSERT_TRUE(ff.useGenericGatherForSolve()); |
227 227 | ASSERT_FALSE(ff.useGenericSolveOne()); |
228 228 | |
229 229 | } |
264 264 | solvePar.define("niter", 20); |
265 265 | solvePar.define("zerorates", true); |
266 266 | Array<Double> delayWindow(IPosition(1, 2)); |
267 267 | Array<Double> rateWindow(IPosition(1, 2)); |
268 268 | delayWindow(IPosition(1, 0)) = -100.0; |
269 269 | delayWindow(IPosition(1, 1)) = +100.0; |
270 270 | rateWindow(IPosition(1, 0)) = -100.0; |
271 271 | rateWindow(IPosition(1, 1)) = +100.0; |
272 272 | solvePar.define("delaywindow", delayWindow); |
273 273 | solvePar.define("ratewindow", rateWindow); |
274 - | |
274 + | Array<Bool> paramActive(IPosition(1,4)); |
275 + | paramActive(IPosition(1, 0)) = true; |
276 + | paramActive(IPosition(1, 1)) = true; |
277 + | paramActive(IPosition(1, 2)) = true; |
278 + | paramActive(IPosition(1, 3)) = false; |
279 + | |
280 + | solvePar.define("paramactive", paramActive); |
281 + | |
275 282 | FJsol.setSolve(solvePar); |
276 283 | |
277 284 | |
278 285 | SDBList sdbs; |
279 286 | Double reftime; |
280 287 | |
281 288 | Bool isFirst = true; |
282 289 | for (vi2.originChunks();vi2.moreChunks();vi2.nextChunk()) { |
283 290 | for (vi2.origin();vi2.more();vi2.next()) { |
284 291 | if (isFirst) { |
316 323 | sdbs.aggregateScan(), |
317 324 | sdbs.aggregateTime(), |
318 325 | sdbs.aggregateSpw(), |
319 326 | sdbs.freqs(), |
320 327 | sdbs.aggregateFld()); |
321 328 | FJsol.sizeSolveParCurrSpw(sdbs.nChannels()); |
322 329 | FJsol.selfSolveOne(sdbs); |
323 330 | |
324 331 | // Add comparison tests here |
325 332 | Matrix<Float> p = FJsol.solveRPar().nonDegenerate(); |
333 + | cerr << p.shape() << endl; |
326 334 | Float delay1 = 2.3; |
327 335 | Float delay2 = -1.7; |
328 336 | Float rate1 = 0.0; |
329 337 | Float rate2 = 0.0; |
330 338 | |
331 339 | if (FRINGEJONES_TEST_VERBOSE) { |
332 340 | cerr << "delay1 results " << p(1,1) << endl; |
333 - | cerr << "delay2 results " << p(4,1) << endl; |
341 + | cerr << "delay2 results " << p(3+1,1) << endl; |
334 342 | cerr << "rate1 results " << p(2,1) << endl; |
335 - | cerr << "rate2 results " << p(5,1) << endl; |
343 + | cerr << "rate2 results " << p(4+1,1) << endl; |
336 344 | cerr << "Parameters out: " << p << endl; |
337 345 | } |
338 346 | ASSERT_TRUE(allNearAbs(p(1, 1), delay1, 2e-2)); |
339 - | ASSERT_TRUE(allNearAbs(p(5, 1), delay2, 2e-2)); |
347 + | ASSERT_TRUE(allNearAbs(p(4+1, 1), delay2, 2e-2)); |
340 348 | |
341 349 | ASSERT_TRUE(allNearAbs(p(2, 1), rate1, 1e-5)); |
342 - | ASSERT_TRUE(allNearAbs(p(6, 1), rate2, 1e-5)); |
350 + | ASSERT_TRUE(allNearAbs(p(4+2, 1), rate2, 1e-5)); |
343 351 | |
344 352 | ASSERT_TRUE(FJsol.refant()==0); |
345 353 | |
346 354 | } |