Changeset 12300
- Timestamp:
- Mar 7, 2007, 3:22:17 PM (19 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 4 edited
-
camera/pmFPAfileDefine.c (modified) (2 diffs)
-
camera/pmFPAfileIO.c (modified) (1 diff)
-
detrend/pmDetrendDB.c (modified) (5 diffs)
-
detrend/pmDetrendDB.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r12152 r12300 880 880 return NULL; 881 881 } 882 file->detrend = results; 882 883 883 884 // replace the existing value of filextra with the selected detID … … 889 890 // file->fileLevel = results->level; 890 891 891 psFree (results);892 892 psFree (options); 893 893 -
trunk/psModules/src/camera/pmFPAfileIO.c
r11801 r12300 225 225 // get name from detrend database 226 226 // extrule expands to yield the class_id 227 // file xtracontains the desired -det_id detID -iteration iter string227 // file->detrend->detID contains the desired -det_id detID -iteration iter string 228 228 if (!strcasecmp (file->filename, "@DETDB")) { 229 char *extra = pmFPAfileNameFromRule (file->extrule, file, view); 230 if (extra == NULL) { 231 psError(PS_ERR_IO, false, "error converting extrule to name %s\n", file->extrule); 232 return false; 233 } 234 psTrace ("pmFPAfile", 6, "looking for detrend (%s, %s)\n", file->filextra, extra); 235 229 if (!file->detrend) { 230 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find information about selected detrend."); 231 return false; 232 } 233 234 psString classId = NULL; // The class identifier, to pass to pmDetrendFile 235 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "CLASSID"); // Menu of class IDs 236 if (!status || !menu) { 237 psWarning("Unable to find CLASSID metadata in camera configuration --- " 238 "assuming no class identifier required."); 239 } else { 240 const char *rule = psMetadataLookupStr(&status, menu, file->detrend->level); // Rule for class_id 241 if (!status || !rule || strlen(rule) == 0) { 242 psWarning("Unable to find %s in CLASSID within camera configuration --- " 243 "attempting to proceed without it.", file->detrend->level); 244 } else { 245 classId = pmFPAfileNameFromRule(rule, file, view); 246 if (!classId) { 247 psError(PS_ERR_IO, false, "error converting extrule to name: %s\n", rule); 248 return false; 249 } 250 } 251 } 252 psTrace ("pmFPAfile", 6, "looking for detrend (%s, %s)\n", file->detrend->detID, classId); 236 253 psFree (file->filename); 237 file->filename = pmDetrendFile(file->filextra, extra, config); 254 255 file->filename = pmDetrendFile(file->detrend->detID, classId, config); 238 256 if (file->filename == NULL) { 239 psError(PS_ERR_IO, false, "failed to find a valid detrend image for detID %s : classID %s\n", file-> filextra, extra);240 psFree ( extra);257 psError(PS_ERR_IO, false, "failed to find a valid detrend image for detID %s : classID %s\n", file->detrend->detID, classId); 258 psFree (classId); 241 259 return false; 242 260 } 243 261 244 262 psTrace ("pmFPAfile", 6, "got detrend file %s\n", file->filename); 245 psFree ( extra);263 psFree (classId); 246 264 } 247 265 -
trunk/psModules/src/detrend/pmDetrendDB.c
r11876 r12300 47 47 options->version = NULL; 48 48 options->dettype = NULL; 49 options->exptime = 0.0; 50 options->airmass = 0.0; 51 options->dettemp = 0.0; 52 options->twilight = 0.0; 49 options->exptime = 0.0; 50 options->airmass = 0.0; 51 options->dettemp = 0.0; 52 options->twilight = 0.0; 53 53 54 54 options->exptimeSet = false; // not selected … … 120 120 char *type = NULL; 121 121 if (options->dettype) { 122 type = psMemIncrRefCounter (options->dettype);122 type = psMemIncrRefCounter (options->dettype); 123 123 } else { 124 type = pmDetrendTypeToString (options->type);124 type = pmDetrendTypeToString (options->type); 125 125 } 126 126 unsigned int nFail; … … 189 189 190 190 bool mdstatus; 191 results->level = 0;192 191 int detID = psMetadataLookupS32 (&mdstatus, md, "det_id"); 192 if (!mdstatus) { 193 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find det_id in output from detselect."); 194 psLogMsg ("psModule.detrend", PS_LOG_ERROR, "detselect response:\n %s\n", buffer->data); 195 goto failure; 196 } 193 197 int iteration = psMetadataLookupS32 (&mdstatus, md, "iteration"); 198 if (!mdstatus) { 199 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find iteration in output from detselect."); 200 psLogMsg ("psModule.detrend", PS_LOG_ERROR, "detselect response:\n %s\n", buffer->data); 201 goto failure; 202 } 203 psString fileLevel = psMetadataLookupStr(&mdstatus, md, "file_level"); 204 if (!mdstatus || !fileLevel || strlen(fileLevel) == 0) { 205 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find file_level in output from detselect."); 206 psLogMsg ("psModule.detrend", PS_LOG_ERROR, "detselect response:\n %s\n", buffer->data); 207 goto failure; 208 } 194 209 195 210 results->detID = NULL; // it should be NULL already from the Alloc above 196 211 psStringAppend (&results->detID, " -det_id %d -iteration %d ", detID, iteration); 212 results->level = psMemIncrRefCounter(fileLevel); 197 213 198 214 psTrace("psModules.detrend", 5, "generated detID %s\n", results->detID); … … 225 241 226 242 PS_ASSERT_PTR_NON_NULL(detID, NULL); 227 PS_ASSERT_PTR_NON_NULL(classID, NULL);228 243 229 244 bool status; … … 232 247 233 248 // generate the detselect command 234 psStringAppend (&line, "detselect -select %s -class_id %s", detID, classID); 249 psStringAppend (&line, "detselect -select %s", detID); 250 if (classID && strlen(classID) > 0) { 251 psStringAppend(&line, " -class_id %s", classID); 252 } 235 253 pmConfigDatabaseCommand(&line, config); 236 254 pmConfigTraceCommand(&line); -
trunk/psModules/src/detrend/pmDetrendDB.h
r11876 r12300 9 9 * @author EAM, IfA 10 10 * 11 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 2-18 21:03:20$11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-03-08 01:22:17 $ 13 13 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 14 14 */ … … 35 35 } pmDetrendType; 36 36 37 typedef struct 38 { 39 char *camera; // name of camera 40 char *version; // optional version string 41 char *filter; // name of filter 42 char *dettype; // actual detrend type name 43 float exptime; // exposure time (for dark, maybe flat & fringe) 44 float airmass; // for fringe 45 float dettemp; // for fringe 46 float twilight; // hours (or seconds?) since/before nearest twilight 47 psTime time; // time of input data 48 pmDetrendType type; // type of detrend data 37 typedef struct { 38 char *camera; // name of camera 39 char *version; // optional version string 40 char *filter; // name of filter 41 char *dettype; // actual detrend type name 42 float exptime; // exposure time (for dark, maybe flat & fringe) 43 float airmass; // for fringe 44 float dettemp; // for fringe 45 float twilight; // hours (or seconds?) since/before nearest twilight 46 psTime time; // time of input data 47 pmDetrendType type; // type of detrend data 49 48 50 49 bool exptimeSet; … … 52 51 bool dettempSet; 53 52 bool twilightSet; 54 } 55 pmDetrendSelectOptions; 53 } pmDetrendSelectOptions; 56 54 57 typedef struct 58 { 59 char *detID; // identifier of detrend run 60 pmFPALevel level; // level in FPA hierarchy of individual file 61 } 62 pmDetrendSelectResults; 63 64 typedef struct 65 { 66 char *detID; // identifier of detrend image 67 char *classID; // level in FPA hierarchy of individual file 68 } 69 pmDetrendFileOptions; 55 typedef struct { 56 char *detID; // identifier of detrend run 57 const char *level; // level in FPA hierarchy of individual file 58 } pmDetrendSelectResults; 70 59 71 60 psString pmDetrendTypeToString (pmDetrendType type);
Note:
See TracChangeset
for help on using the changeset viewer.
