Changeset 18148
- Timestamp:
- Jun 16, 2008, 12:13:21 PM (18 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 3 edited
-
dettool.c (modified) (1 diff)
-
stacktool.c (modified) (4 diffs)
-
stacktoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r18099 r18148 603 603 psArray *subset = psArrayAlloc (randomLimit); 604 604 for (int i = 0; i < randomLimit; i++ ){ 605 int j = indexVector->data.S32[i];606 subset->data[i] = psMemIncrRefCounter (detrendExps->data[j]);605 int j = indexVector->data.S32[i]; 606 subset->data[i] = psMemIncrRefCounter (detrendExps->data[j]); 607 607 } 608 608 psFree (detrendExps); -
trunk/ippTools/src/stacktool.c
r18101 r18148 120 120 PXOPT_COPY_F32(config->args, whereRE, "-select_solang_max", "solang", "<="); 121 121 PXOPT_COPY_STR(config->args, whereWSF, "-select_skycell_id", "skycell_id", "=="); 122 PXOPT_LOOKUP_BOOL(randomSubset, config->args, "-random_subset", false); 123 PXOPT_LOOKUP_S32(randomLimit, config->args, "-random_limit", false, false); 122 124 123 125 if (!psListLength(whereRE->list) && !psListLength(whereWSF->list) && … … 182 184 } 183 185 186 // valid_warpids should be NULL unless randomSubset is specified 187 psVector *valid_warpids = NULL; 188 if (randomSubset && (randomLimit < psArrayLength(output))) { 189 // loop over the array of metadata and figure out which warp_id are in 190 // the result set 191 psArray *warps = psArrayAlloc(0); 192 for (long i = 0; i < psArrayLength(output); i++) { 193 psMetadata *md = output->data[i]; 194 195 // pull out the warp_id 196 bool status; 197 psS64 warp_id = psMetadataLookupS64(&status, md, "warp_id"); 198 if (!status) { 199 psError(PS_ERR_UNKNOWN, false, "failed to lookup warp_id"); 200 psFree(output); 201 psFree(warps); 202 return NULL; 203 } 204 205 psArrayAdd(warps, 0, warp_id); 206 } 207 208 // generate a random-valued vector, return an index sorted by the 209 // random values 210 psVector *randomVector = psVectorAlloc(psArrayLength(output), PS_TYPE_F32); 211 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); 212 for (int i = 0; i < randomVector->n; i++) { 213 randomVector->data.F32[i] = psRandomUniform(rng); 214 } 215 psVector *indexVector = psVectorSortIndex(NULL, randomVector); 216 psFree(randdomVector); 217 218 // accept for first n of the sequence 219 valid_warpids = psVectorAlloc(randomLimit, PS_TYPE_S64); 220 for (int i = 0; i < randomLimit; i++ ){ 221 int j = indexVector->data.S32[i]; 222 valid_warpids->data[i] = psMemIncrRefCounter (warps->data[j]); 223 } 224 psFree(indexVector); 225 psFree(warps); 226 } 227 228 184 229 psHash *stacks = psHashAlloc(psArrayLength(output)); 185 230 186 // loop over the array of metadata 231 // loop over the array of metadata and build a hash keyed by tess_id & 232 // skycell_id 187 233 for (long i = 0; i < psArrayLength(output); i++) { 188 234 psMetadata *md = output->data[i]; 189 235 190 // pull out the warp_id, skycell_id, & tess_id191 236 bool status; 237 if (valid_warpids) { 238 psS64 warp_id = psMetadataLookupS64(&status, md, "warp_id"); 239 if (!status) { 240 psError(PS_ERR_UNKNOWN, false, "failed to lookup warp_id"); 241 psFree(valid_warpids); 242 psFree(output); 243 return NULL; 244 } 245 246 // is this a warp_id that should be left out of the stack set(s)? 247 for (long i = 0; i < psArrayLength(valid_warpids); i++) { 248 if (valid_warpids->data[i] == warp_id) { 249 continue; 250 } 251 } 252 } 253 254 // pull out the skycell_id, & tess_id 192 255 psString skycell_id = psMetadataLookupStr(&status, md, "skycell_id"); 193 256 if (!status) { 194 257 psError(PS_ERR_UNKNOWN, false, "failed to lookup skycell_id"); 258 psFree(valid_warpids); 195 259 psFree(output); 196 260 return NULL; … … 200 264 if (!status) { 201 265 psError(PS_ERR_UNKNOWN, false, "failed to lookup tess_id"); 266 psFree(valid_warpids); 202 267 psFree(output); 203 268 return NULL; … … 220 285 221 286 } 287 psFree(valid_warpids); 222 288 psFree(output); 223 289 -
trunk/ippTools/src/stacktoolConfig.c
r18093 r18148 91 91 psMetadataAddF64(queueArgs, PS_LIST_TAIL, "-select_solang_max", 0, 92 92 "define max solar angle", NAN); 93 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-random_subset", 0, 94 "use a random subset of elements", false); 95 psMetadataAddS32(definebyqueryArgs, PS_LIST_TAIL, "-random_limit", 0, 96 "use this number of random elements", 20); 93 97 94 98 psMetadataAddBool(queueArgs, PS_LIST_TAIL, "-all", 0,
Note:
See TracChangeset
for help on using the changeset viewer.
