- Timestamp:
- Jun 19, 2012, 5:24:19 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
Ohana/src/opihi/dvo/skycoverage.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/Ohana/src/opihi/dvo/skycoverage.c
r33415 r34041 1 1 # include "dvoshell.h" 2 2 3 // enum to define possible modes 4 enum {COVERAGE, DENSITY, MIN_UBERCAL, MIN_DMAG_SYS, MIN_MCAL, MAX_MCAL, MIN_TIME, MAX_TIME}; 5 3 6 int wordhash (char *word); 4 7 5 8 int skycoverage (int argc, char **argv) { 6 9 7 int WITH_MOSAIC, SOLO_MOSAIC, ShowDensity;10 int WITH_MOSAIC, SOLO_MOSAIC, mode; 8 11 off_t i, Nimage; 9 12 int N, status, TimeSelect, ByName, xs, ys; … … 20 23 PhotCode *PhotcodeValue; 21 24 25 time_t TimeReference; 26 int TimeFormat; 27 28 GetTimeFormat (&TimeReference, &TimeFormat); 29 22 30 WITH_MOSAIC = FALSE; 23 31 if ((N = get_argument (argc, argv, "+mosaic"))) { … … 60 68 } 61 69 62 ShowDensity = FALSE;70 mode = COVERAGE; 63 71 if ((N = get_argument (argc, argv, "-density"))) { 64 72 remove_argument (N, &argc, argv); 65 ShowDensity = TRUE; 73 mode = DENSITY; 74 } 75 if ((N = get_argument (argc, argv, "-min-ubercal"))) { 76 remove_argument (N, &argc, argv); 77 mode = MIN_UBERCAL; 78 } 79 if ((N = get_argument (argc, argv, "-min-time"))) { 80 remove_argument (N, &argc, argv); 81 mode = MIN_TIME; 82 } 83 if ((N = get_argument (argc, argv, "-max-time"))) { 84 remove_argument (N, &argc, argv); 85 mode = MAX_TIME; 86 } 87 if ((N = get_argument (argc, argv, "-min-dmag-sys"))) { 88 remove_argument (N, &argc, argv); 89 mode = MIN_DMAG_SYS; 90 } 91 if ((N = get_argument (argc, argv, "-min-mcal"))) { 92 remove_argument (N, &argc, argv); 93 mode = MIN_MCAL; 94 } 95 if ((N = get_argument (argc, argv, "-max-mcal"))) { 96 remove_argument (N, &argc, argv); 97 mode = MAX_MCAL; 66 98 } 67 99 … … 194 226 V = (float *)buf[0].matrix.buffer; 195 227 228 // init the V array (depends on mode) 196 229 for (ys = 0; ys < Ny; ys++) { 197 230 for (xs = 0; xs < Nx; xs++) { … … 199 232 status &= (r >= 0); 200 233 status &= (r <= 360); 234 // are we in a part of the projection covering the sky or not? 201 235 if (status) { 202 V[ys*Nx + xs] = ShowDensity ? 0 : 2; 236 switch (mode) { 237 case COVERAGE: 238 V[ys*Nx + xs] = 2; 239 break; 240 case DENSITY: 241 V[ys*Nx + xs] = 0; 242 break; 243 case MIN_UBERCAL: 244 case MIN_DMAG_SYS: 245 case MIN_MCAL: 246 case MIN_TIME: 247 V[ys*Nx + xs] = 1E9; 248 break; 249 case MAX_MCAL: 250 case MAX_TIME: 251 V[ys*Nx + xs] = -1E9; 252 break; 253 } 203 254 } else { 204 V[ys*Nx + xs] = ShowDensity ? NAN : 0; 255 switch (mode) { 256 case COVERAGE: 257 V[ys*Nx + xs] = 0; 258 break; 259 case DENSITY: 260 case MIN_UBERCAL: 261 case MIN_DMAG_SYS: 262 case MIN_MCAL: 263 case MAX_MCAL: 264 case MIN_TIME: 265 case MAX_TIME: 266 V[ys*Nx + xs] = NAN; 267 break; 268 } 205 269 } 206 270 } … … 257 321 xs = (int)Xs; 258 322 ys = (int)Ys; 259 if (ShowDensity) { 323 switch (mode) { 324 case COVERAGE: 325 V[ys*Nx + xs] = 1; 326 break; 327 case DENSITY: 260 328 V[ys*Nx + xs] += 1; 261 } else { 262 V[ys*Nx + xs] = 1; 329 break; 330 case MIN_UBERCAL: 331 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].ubercalDist); 332 break; 333 case MIN_DMAG_SYS: 334 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].dMagSys); 335 break; 336 case MIN_MCAL: 337 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].Mcal); 338 break; 339 case MAX_MCAL: 340 V[ys*Nx + xs] = MAX(V[ys*Nx + xs], image[i].Mcal); 341 break; 342 case MIN_TIME: { 343 double timeVal = TimeValue (image[i].tzero, TimeReference, TimeFormat); 344 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], timeVal); 345 break; } 346 case MAX_TIME: { 347 double timeVal = TimeValue (image[i].tzero, TimeReference, TimeFormat); 348 V[ys*Nx + xs] = MAX(V[ys*Nx + xs], timeVal); 349 break; } 263 350 } 264 351 }
Note:
See TracChangeset
for help on using the changeset viewer.
