Changeset 33827 for branches/eam_branches/ipp-20120405/Ohana/src/opihi
- Timestamp:
- Apr 26, 2012, 12:30:42 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20120405/Ohana/src/opihi
- Files:
-
- 4 edited
-
cmd.data/gridify.c (modified) (6 diffs)
-
dvo/avextract.c (modified) (3 diffs)
-
dvo/avmatch.c (modified) (2 diffs)
-
dvo/gstar.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120405/Ohana/src/opihi/cmd.data/gridify.c
r31450 r33827 5 5 int i, Nx, Ny, Xb, Yb, Normalize, N; 6 6 float Xmin, Xmax, dX, Ymin, Ymax, dY, initValue; 7 float *buf, *val ;7 float *buf, *val, *cnt; 8 8 int *Nval; 9 Buffer *bf;10 9 Vector *vx, *vy, *vz; 11 10 opihi_flt *x, *y, *z; 11 12 Buffer *bf = NULL; 13 Buffer *ct = NULL; 12 14 13 15 Normalize = TRUE; … … 15 17 remove_argument (N, &argc, argv); 16 18 Normalize = FALSE; 19 if ((ct = SelectBuffer (argv[N], ANYBUFFER, TRUE)) == NULL) return (FALSE); 20 remove_argument (N, &argc, argv); 17 21 } 18 22 … … 24 28 } 25 29 26 if (argc != 11) { 27 gprint (GP_ERR, "USAGE: gridify x y z buffer Xmin Xmax dX Ymin Ymax dY\n"); 30 Xmin = Xmax = dX = NAN; 31 if ((N = get_argument (argc, argv, "-x"))) { 32 remove_argument (N, &argc, argv); 33 Xmin = atof (argv[N]); 34 remove_argument (N, &argc, argv); 35 Xmax = atof (argv[N]); 36 remove_argument (N, &argc, argv); 37 dX = atof (argv[N]); 38 remove_argument (N, &argc, argv); 39 } 40 41 Ymin = Ymax = dY = NAN; 42 if ((N = get_argument (argc, argv, "-y"))) { 43 remove_argument (N, &argc, argv); 44 Ymin = atof (argv[N]); 45 remove_argument (N, &argc, argv); 46 Ymax = atof (argv[N]); 47 remove_argument (N, &argc, argv); 48 dY = atof (argv[N]); 49 remove_argument (N, &argc, argv); 50 } 51 52 if (argc != 5) { 53 gprint (GP_ERR, "USAGE: gridify x y z buffer [-x Xmin Xmax dX] [-y Ymin Ymax dY] [-init-value value] [-raw]\n"); 28 54 return (FALSE); 29 55 } … … 41 67 REQUIRE_VECTOR_FLT (vz, FALSE); 42 68 43 Xmin = atof (argv[5]); 44 Xmax = atof (argv[6]); 45 dX = atof (argv[7]); 69 if (isnan(dX)) { 70 Xmin = 0; 71 Xmax = bf[0].matrix.Naxis[0]; 72 dX = 1; 73 } 46 74 47 Ymin = atof (argv[8]); 48 Ymax = atof (argv[9]); 49 dY = atof (argv[10]); 75 if (isnan(dY)) { 76 Ymin = 0; 77 Ymax = bf[0].matrix.Naxis[1]; 78 dY = 1; 79 } 50 80 51 Nx = (Xmax - Xmin) / dX + 1;52 Ny = (Ymax - Ymin) / dY + 1;81 Nx = (Xmax - Xmin) / dX; 82 Ny = (Ymax - Ymin) / dY; 53 83 54 gfits_free_matrix (&bf[0].matrix); 55 gfits_free_header (&bf[0].header); 56 CreateBuffer (bf, Nx, Ny, -32, 0.0, 1.0); 57 strcpy (bf[0].file, "(empty)"); 84 if ((Nx != bf[0].matrix.Naxis[0]) || (Ny != bf[0].matrix.Naxis[1])) { 85 gfits_free_matrix (&bf[0].matrix); 86 gfits_free_header (&bf[0].header); 87 CreateBuffer (bf, Nx, Ny, -32, 0.0, 1.0); 88 strcpy (bf[0].file, "(empty)"); 89 } 58 90 59 91 ALLOCATE (val, float, Nx*Ny); … … 68 100 Xb = (*x - Xmin) / dX; 69 101 Yb = (*y - Ymin) / dY; 102 if (Xb < 0) continue; 103 if (Yb < 0) continue; 70 104 if (Xb >= Nx) continue; 71 105 if (Yb >= Ny) continue; … … 74 108 } 75 109 110 if (!Normalize) { 111 gfits_free_matrix (&ct[0].matrix); 112 gfits_free_header (&ct[0].header); 113 CreateBuffer (ct, Nx, Ny, -32, 0.0, 1.0); 114 strcpy (ct[0].file, "(empty)"); 115 116 buf = (float *) bf[0].matrix.buffer; 117 cnt = (float *) ct[0].matrix.buffer; 118 for (i = 0; i < Nx*Ny; i++) { 119 if (Nval[i] == 0) continue; 120 buf[i] = val[i]; 121 cnt[i] = Nval[i]; 122 } 123 free (val); 124 free (Nval); 125 return TRUE; 126 } 127 76 128 buf = (float *) bf[0].matrix.buffer; 77 129 for (i = 0; i < Nx*Ny; i++) { 78 130 buf[i] = initValue; 79 if (Normalize) { 80 if (Nval[i] == 0) { 81 continue; 82 } 83 buf[i] = val[i] / Nval[i]; 84 } else { 85 buf[i] = val[i]; 86 } 131 if (Nval[i] == 0) continue; 132 buf[i] = val[i] / Nval[i]; 87 133 } 88 134 -
branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/avextract.c
r33662 r33827 35 35 remove_argument (N, &argc, argv); 36 36 VERBOSE = TRUE; 37 } 38 39 int VERBOSE2 = FALSE; 40 if ((N = get_argument (argc, argv, "-vv"))) { 41 remove_argument (N, &argc, argv); 42 VERBOSE = TRUE; 43 VERBOSE2 = TRUE; 37 44 } 38 45 … … 173 180 catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i]; 174 181 catalog.catflags = LOAD_AVES | LOAD_SECF; 175 if (needMeasures) { 176 catalog.catflags |= LOAD_MEAS; 177 } 182 catalog.catflags |= needMeasures ? LOAD_MEAS : SKIP_MEAS; 178 183 catalog.Nsecfilt = 0; 179 184 … … 181 186 182 187 // an error exit status here is a significant error 183 if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {188 if (!dvo_catalog_open (&catalog, NULL, VERBOSE2, "r")) { 184 189 gprint (GP_ERR, "ERROR: failure to open catalog file %s\n", catalog.filename); 185 190 exit (2); -
branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/avmatch.c
r33662 r33827 129 129 } 130 130 131 // check the requested fields : are all average/secfilt entries, or do we need measures? 132 int needMeasures = FALSE; 133 for (i = 0; !needMeasures && (i < Nfields); i++) { 134 if (fields[i].magMode == MAG_NONE) continue; 135 if (fields[i].photcode == NULL) continue; // assert this? 136 if (fields[i].photcode[0].type == PHOT_REF) needMeasures = TRUE; 137 if (fields[i].photcode[0].type == PHOT_DEP) needMeasures = TRUE; 138 } 139 131 140 /* load regions which contain all supplied RA,DEC coordinates */ 132 141 if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape; … … 168 177 snprintf (hostfile, 1024, "%s/%s.cpt", HOSTDIR, skylist[0].regions[i]->name); 169 178 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 170 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 179 catalog.catflags = LOAD_AVES | LOAD_SECF; 180 catalog.catflags |= needMeasures ? LOAD_MEAS : SKIP_MEAS; 171 181 catalog.Nsecfilt = 0; 172 182 -
branches/eam_branches/ipp-20120405/Ohana/src/opihi/dvo/gstar.c
r33662 r33827 116 116 117 117 /* lock, load, unlock catalog */ 118 catalog.catflags = GetMeasures ? LOAD_AVES | LOAD_MEAS | LOAD_SECF : LOAD_AVES | LOAD_SECF; 118 catalog.catflags = LOAD_AVES | LOAD_SECF; 119 catalog.catflags |= GetMeasures ? LOAD_MEAS : SKIP_MEAS; 119 120 catalog.Nsecfilt = 0; 120 121
Note:
See TracChangeset
for help on using the changeset viewer.
