Changeset 38030
- Timestamp:
- Mar 28, 2015, 5:32:49 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150326/psastro/src
- Files:
-
- 2 edited
-
psastroConvert.c (modified) (1 diff)
-
psastroGalaxyShapeErrors.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150326/psastro/src/psastroConvert.c
r36868 r38030 335 335 pmChip *chip = readout->parent->parent; 336 336 char *chipName = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME"); 337 338 // skip stacks 339 if (!strcmp(chipName, "SkyChip")) { 340 psLogMsg ("psastro.correctKH", PS_LOG_DETAIL, "skipping KH correction: not a gpc1 chip\n"); 341 return true; 342 } 343 344 // only try to address gpc1 chips (should probably check the camera) 345 if (strncmp(chipName, "XY", 2)) { 346 psLogMsg ("psastro.correctKH", PS_LOG_DETAIL, "skipping KH correction: not a gpc1 chip\n"); 347 return true; 348 } 337 349 338 350 psAssert (strlen(chipName) == 4, "error in chip name"); -
branches/eam_branches/ipp-20150326/psastro/src/psastroGalaxyShapeErrors.c
r38025 r38030 12 12 13 13 # include "psastroInternal.h" 14 15 double psastroNormalizeAngleToMidpoint (double angle, double midpoint); 14 16 15 17 bool psastroGalaxyShapeErrors (psMetadata *recipe, pmReadout *readout) { … … 71 73 if (!(isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXY]) && isfinite(PAR[PM_PAR_SYY]))) { 72 74 // set a mask bit 75 model->flags |= PM_MODEL_STATUS_NAN_SHAPE; 73 76 continue; 74 77 } 75 78 if (!(isfinite(dPAR[PM_PAR_SXX]) && isfinite(dPAR[PM_PAR_SXY]) && isfinite(dPAR[PM_PAR_SYY]))) { 76 79 // set a (different) mask bit 80 model->flags |= PM_MODEL_STATUS_NAN_SHAPE_ERR; 77 81 continue; 78 82 } … … 89 93 bool useReff = model->class->useReff; 90 94 psEllipseAxes axes; 95 96 float SxxRef = PAR[PM_PAR_SXX]; 97 float SxyRef = PAR[PM_PAR_SXY]; 98 float SyyRef = PAR[PM_PAR_SYY]; 99 if (!(isfinite(SxxRef) && isfinite(SxyRef) && isfinite(SyyRef))) { 100 // skip objects which are already poor ellipses 101 model->flags |= PM_MODEL_STATUS_NAN_SHAPE; 102 continue; 103 } 104 pmModelParamsToAxes (&axes, SxxRef, SxyRef, SyyRef, useReff); 105 if (!(isfinite(axes.major) && isfinite(axes.minor) && isfinite(axes.theta))) { 106 // skip objects which are already poor ellipses 107 model->flags |= PM_MODEL_STATUS_NAN_SHAPE; 108 continue; 109 } 110 double ThetaRef = axes.theta; 111 91 112 for (int k = 0; k < nSample; k++) { 92 113 … … 101 122 if (!(isfinite(axes.major) && isfinite(axes.minor) && isfinite(axes.theta))) continue; 102 123 124 // theta should be in range ThetaRef - PI : ThetaRef + PI 125 double ThetaNorm = psastroNormalizeAngleToMidpoint (axes.theta, ThetaRef); 126 103 127 psVectorAppend (majorValues, axes.major); 104 128 psVectorAppend (minorValues, axes.minor); 105 psVectorAppend (thetaValues, axes.theta);129 psVectorAppend (thetaValues, ThetaNorm); 106 130 } 107 131 if (majorValues->n == 0) { 108 132 psWarning ("failed mc error search"); 133 model->flags |= PM_MODEL_STATUS_FAIL_SHAPE_ERR; 134 continue; 109 135 } 110 136 … … 129 155 psFree (thetaValues); 130 156 157 psMetadata *header = psMetadataLookupMetadata (&status, readout->analysis, "PSASTRO.HEADER"); 158 psMetadataAddStr (header, PS_LIST_TAIL, "GALAXY.SHAPE.ERRORS", PS_META_REPLACE, "error analysis mode", "MONTE CARLO"); 159 131 160 psLogMsg ("psastro.galaxy", PS_LOG_INFO, "monte carlo shape errors for %d of %d objects: %f sec\n", nObjects, (int) sources->n, psTimerMark ("psastro.galaxy.shape.errors")); 132 161 return true; 133 162 } 134 163 164 // these angles are in radians 165 double psastroNormalizeAngleToMidpoint (double angle, double midpoint) { 166 167 double x = cos(angle); 168 double y = sin(angle); 169 170 double result = atan2 (y, x); 171 if (result < midpoint - M_PI) result += 2.0*M_PI; 172 if (result > midpoint + M_PI) result -= 2.0*M_PI; 173 174 return result; 175 } 176
Note:
See TracChangeset
for help on using the changeset viewer.
