Changeset 41657 for trunk/psastro/src/psastroLoadGhosts.c
- Timestamp:
- Jun 8, 2021, 3:40:00 PM (5 years ago)
- Location:
- trunk/psastro
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psastroLoadGhosts.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro
- Property svn:mergeinfo changed
/tags/ipp-ps1-20210510/psastro (added) merged: 41591,41597,41618-41619,41633-41634,41641-41643,41652
- Property svn:mergeinfo changed
-
trunk/psastro/src/psastroLoadGhosts.c
r41434 r41657 120 120 121 121 //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists 122 float mirCheck = 0;122 int mirCheck = 0; 123 123 md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD"); 124 124 if (!md) { psLogMsg ("psastro", PS_LOG_INFO, "No ghost mirror_rad polynomial found. Assuming old-style ghost masking"); } … … 144 144 pmFPA *fpa = astrom->fpa; 145 145 146 // select the reference mask fpa :: we use this to determine cell boundaries 147 pmFPAfile *refMask = psMetadataLookupPtr (NULL, config->files, "PSASTRO.REFMASK"); 148 if (!refMask) { 149 psError(PSASTRO_ERR_CONFIG, true, "Can't find mask reference"); 150 return false; 151 } 152 // Activate the reference mask to generate an FPA structure we can use to map stars down to cells 153 pmFPAfileActivate (config->files, false, NULL); 154 pmFPAfileActivate (config->files, true, "PSASTRO.REFMASK"); 155 146 156 // raise an error if the config is broken 147 157 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &INSTR_MAX_MAG, NULL, fpa, recipe)) { … … 161 171 if (!chip->fromFPA) { continue; } 162 172 173 // Get the current chip's name, and parse out the grid location. 174 pmChip *refChip = pmFPAviewThisChip (view, refMask->fpa); 175 const char *chipName = psMetadataLookupStr(NULL,refChip->concepts, "CHIP.NAME"); 176 int X = chipName[2] - '0'; 177 int Y = chipName[3] - '0'; 178 179 //Check if we are in the central 8 chips, where old ghost-style locations work better 180 int cenChip = 0; 181 if ( (Y >= 3)&&(Y <=4)&&(X >= 2)&&(X <= 5) ) {cenChip = 0;} 182 163 183 while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) { 164 184 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); … … 188 208 189 209 double rSrc = hypot (cal->FP->x, cal->FP->y); 190 double theta0 = atan2(cal->FP-> x,cal->FP->y);191 192 if( mirCheck) {210 double theta0 = atan2(cal->FP->y,cal->FP->x); 211 212 if((mirCheck) & (!cenChip)) { 193 213 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle 194 214 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); … … 200 220 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 201 221 } 202 if( !mirCheck) {222 if((!mirCheck) | cenChip) { 203 223 //Use the old-style ghost position determination 204 224 ghost->FP->x = -cal->FP->x + psPolynomial2DEval(centerX, -cal->FP->x, -cal->FP->y); … … 312 332 double theta0 = atan2(ref->FP->y,ref->FP->x); 313 333 314 if( mirCheck) {334 if((mirCheck) & (!cenChip)) { 315 335 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle 316 336 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); … … 322 342 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 323 343 } 324 if( !mirCheck) {344 if((!mirCheck) | cenChip) { 325 345 //Use the old-style ghost position determination 326 346 ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
Note:
See TracChangeset
for help on using the changeset viewer.
