Changeset 20724 for trunk/psastro/src/psastroMaskUpdates.c
- Timestamp:
- Nov 13, 2008, 1:50:19 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroMaskUpdates.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroMaskUpdates.c
r20650 r20724 41 41 bool REFSTAR_MASK = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK"); 42 42 if (!REFSTAR_MASK) return true; 43 44 bool REFSTAR_MASK_REGIONS = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_REGIONS"); 43 45 44 46 double REFSTAR_MASK_MAX_MAG = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_MAX_MAG"); … … 112 114 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 113 115 114 char *filename = NULL; 115 char *chipname = psMetadataLookupStr (&status, chip->concepts, "CHIP.NAME"); 116 psStringAppend (&filename, "refstars.mask.%s.dat", chipname); 117 FILE *f = fopen (filename, "w"); 118 if (!f) { 116 // text region files for testing 117 FILE *f = NULL; 118 if (REFSTAR_MASK_REGIONS) { 119 char *filename = NULL; 120 char *chipname = psMetadataLookupStr (&status, chip->concepts, "CHIP.NAME"); 121 psStringAppend (&filename, "refstars.mask.%s.dat", chipname); 122 FILE *f = fopen (filename, "w"); 123 if (!f) { 119 124 psWarning ("cannot create refstar mask file %s\n", filename); 120 125 continue; 121 } 122 psFree (filename); 126 } 127 psFree (filename); 128 } 123 129 124 130 pmChip *refChip = pmFPAviewThisChip (view, refMask->fpa); … … 176 182 // CIRCLE around the stars (scaled by magnitude) 177 183 float radius = REFSTAR_MASK_SATSTAR_MAG_SLOPE * (REFSTAR_MASK_SATSTAR_MAG_MAX - ref->Mag); 178 fprintf (f, "CIRCLE %f %f %f %f\n", ref->chip->x, ref->chip->y, radius, radius); 184 185 if (REFSTAR_MASK_REGIONS) { 186 fprintf (f, "CIRCLE %f %f %f %f\n", ref->chip->x, ref->chip->y, radius, radius); 187 } 179 188 180 189 // XXX for now, assume cell binning is 1x1 relative to chip … … 192 201 float Theta = POSANGLE - REFSTAR_MASK_SATSTAR_POS_ZERO + theta; 193 202 194 // lower side 195 x0 = ref->chip->x + spikeWidth*sin(Theta); 196 y0 = ref->chip->y - spikeWidth*cos(Theta); 197 x1 = ref->chip->x + spikeLength*cos(Theta) + spikeWidth*sin(Theta); 198 y1 = ref->chip->y + spikeLength*sin(Theta) - spikeWidth*cos(Theta); 199 dx = x1 - x0; 200 dy = y1 - y0; 201 fprintf (f, "LINE %f %f %f %f\n", x0, y0, dx, dy); 202 203 // upper side 204 x0 = ref->chip->x - spikeWidth*sin(Theta); 205 y0 = ref->chip->y + spikeWidth*cos(Theta); 206 x1 = ref->chip->x + spikeLength*cos(Theta) - spikeWidth*sin(Theta); 207 y1 = ref->chip->y + spikeLength*sin(Theta) + spikeWidth*cos(Theta); 208 dx = x1 - x0; 209 dy = y1 - y0; 210 fprintf (f, "LINE %f %f %f %f\n", x0, y0, dx, dy); 203 if (REFSTAR_MASK_REGIONS) { 204 // lower side 205 x0 = ref->chip->x + spikeWidth*sin(Theta); 206 y0 = ref->chip->y - spikeWidth*cos(Theta); 207 x1 = ref->chip->x + spikeLength*cos(Theta) + spikeWidth*sin(Theta); 208 y1 = ref->chip->y + spikeLength*sin(Theta) - spikeWidth*cos(Theta); 209 dx = x1 - x0; 210 dy = y1 - y0; 211 212 fprintf (f, "LINE %f %f %f %f\n", x0, y0, dx, dy); 213 214 // upper side 215 x0 = ref->chip->x - spikeWidth*sin(Theta); 216 y0 = ref->chip->y + spikeWidth*cos(Theta); 217 x1 = ref->chip->x + spikeLength*cos(Theta) - spikeWidth*sin(Theta); 218 y1 = ref->chip->y + spikeLength*sin(Theta) + spikeWidth*cos(Theta); 219 dx = x1 - x0; 220 dy = y1 - y0; 221 fprintf (f, "LINE %f %f %f %f\n", x0, y0, dx, dy); 222 } 211 223 212 224 if (readoutMask) { … … 219 231 220 232 // LINE for boundaries of the bleed lines 221 fprintf (f, "LINE %f %f %f %f\n", ref->chip->x, ref->chip->y, 0.0, -100.0); 233 if (REFSTAR_MASK_REGIONS) { 234 fprintf (f, "LINE %f %f %f %f\n", ref->chip->x, ref->chip->y, 0.0, -100.0); 235 } 236 222 237 if (readoutMask && refCell) { 223 238 float xCell = 0.0; … … 253 268 254 269 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE; 255 fclose (f); 270 if (REFSTAR_MASK_REGIONS) { 271 fclose (f); 272 } 256 273 } 257 274 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
Note:
See TracChangeset
for help on using the changeset viewer.
