Changeset 41662 for trunk/Ohana/src/relphot/src/TGroupOps.c
- Timestamp:
- Jun 14, 2021, 11:02:20 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/relphot/src/TGroupOps.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/src/TGroupOps.c
r41647 r41662 1365 1365 } 1366 1366 1367 double get_median_zpt_tgroups (short photcode) { 1368 1369 double *mlist; 1370 1371 if (!TGROUP_ZEROPT) return NAN; 1372 1373 ALLOCATE (mlist, double, NtgroupTimes); 1374 1375 int N = 0; 1376 for (int i = 0; i < NtgroupTimes; i++) { 1377 TGroup *tgroup = tgroupTimes[i][0].byCode; 1378 for (int j = 0; j < tgroupTimes[i][0].nCode; j++) { 1379 if (tgroup[j].photcode != photcode) continue; 1380 if (!(tgroup[j].flags & ID_IMAGE_TGROUP_PHOTCAL)) continue; 1381 mlist[N] = tgroup[j].McalPSF; 1382 N++; 1383 } 1384 } 1385 1386 if (N == 0) { 1387 free (mlist); 1388 return NAN; 1389 } 1390 1391 StatType stats; 1392 liststats_setmode (&stats, "MEAN"); 1393 1394 liststats (mlist, NULL, NULL, N, &stats); 1395 free (mlist); 1396 1397 return stats.median; 1398 } 1399 1400 void set_median_zpt_tgroups (short photcode, double zpt) { 1401 1402 if (!TGROUP_ZEROPT) return; 1403 if (!isfinite(zpt)) return; // do not break the zero points 1404 1405 for (int i = 0; i < NtgroupTimes; i++) { 1406 TGroup *tgroup = tgroupTimes[i][0].byCode; 1407 for (int j = 0; j < tgroupTimes[i][0].nCode; j++) { 1408 if (tgroup[j].photcode != photcode) continue; 1409 tgroup[j].McalPSF -= zpt; 1410 tgroup[j].McalAPER -= zpt; 1411 } 1412 } 1413 return; 1414 } 1415 1367 1416 void plot_tgroup_fields (Catalog *catalog) { 1368 1417
Note:
See TracChangeset
for help on using the changeset viewer.
