Changeset 13897
- Timestamp:
- Jun 19, 2007, 4:20:29 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfileDefine.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r13842 r13897 489 489 // set derived values 490 490 file->fileLevel = input->fileLevel; 491 psFree (file->format);492 file->format = psMemIncrRefCounter(input->format);493 491 494 492 // define the rule to identify these files in the file->names data … … 501 499 // associated each filename with an element of the FPA 502 500 // save the association on file->names 501 psMetadata *format = NULL; 503 502 for (int i = 0; i < infiles->n; i++) { 504 503 // this function is implicitly an INPUT operation: do not create the file … … 521 520 return NULL; 522 521 } 523 bool valid = false; 524 if (!pmConfigValidateCameraFormat (&valid, input->format, phu)) { 525 psError (PS_ERR_UNKNOWN, false, "Error in config scripts\n"); 526 psFree (realName); 527 psFitsClose (fits); 528 return NULL; 529 } 530 if (!valid) { 531 psError(PS_ERR_IO, false, "specified data file %s does not match format of supplied INPUT\n", realName); 532 psFree (realName); 533 psFitsClose (fits); 534 return NULL; 535 } 522 523 if (!format) { 524 format = pmConfigCameraFormatFromHeader((pmConfig*)config, phu, true); 525 if (!format) { 526 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName); 527 psFree(phu); 528 psFree(realName); 529 psFitsClose(fits); 530 psFree(file); 531 return NULL; 532 } 533 } else { 534 bool valid = false; 535 if (!pmConfigValidateCameraFormat(&valid, format, phu)) { 536 psError(PS_ERR_UNKNOWN, false, "Error in config scripts\n"); 537 psFree(realName); 538 psFree(file); 539 psFitsClose(fits); 540 return NULL; 541 } 542 if (!valid) { 543 psError(PS_ERR_IO, false, "specified data file %s does not match format of supplied INPUT\n", 544 realName); 545 psFree(realName); 546 psFree(file); 547 psFitsClose(fits); 548 return NULL; 549 } 550 } 551 536 552 psFree(realName); 537 psFitsClose (fits);553 psFitsClose(fits); 538 554 539 555 // set the view to the corresponding entry for this phu 540 pmFPAview *view = pmFPAIdentifySourceFromHeader (input->fpa, phu, input->format);556 pmFPAview *view = pmFPAIdentifySourceFromHeader (input->fpa, phu, format); 541 557 if (!view) { 542 558 psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name); … … 546 562 547 563 // associate the filename with the FPA element 548 char *name = pmFPAfileNameFromRule (file->filesrc, file, view);564 char *name = pmFPAfileNameFromRule(file->filesrc, file, view); 549 565 550 566 // save the name association in the pmFPAfile structure … … 555 571 psFree (phu); 556 572 } 573 psFree(file->format); 574 file->format = format; 575 557 576 if (success) *success = true; 558 577 return file; … … 962 981 file = fpaFileDefineOutput(config, fpa, filename, config->cameraName, "SKYCELL"); 963 982 } else { 964 // Find the correct camera configuration 965 psString cameraName = NULL; // Name of the new (automatically-generated) camera configuration 966 psStringAppend(&cameraName, "_%s-SKYCELL", config->cameraName); 967 968 file = fpaFileDefineOutput(config, fpa, filename, cameraName, "SKYCELL"); 983 psString cameraName = NULL; // Name of the old camera configuration 984 if (config->cameraName[0] == '_' && 985 strcmp(config->cameraName + strlen(config->cameraName) - 5, "-CHIP") == 0) { 986 cameraName = psStringNCopy(config->cameraName + 1, strlen(config->cameraName) - 6); 987 } else if (config->cameraName[0] == '_' && 988 strcmp(config->cameraName + strlen(config->cameraName) - 4 , "-FPA") == 0) { 989 cameraName = psStringNCopy(config->cameraName + 1, strlen(config->cameraName) - 5); 990 } else { 991 cameraName = psMemIncrRefCounter(config->cameraName); 992 } 993 psString newCameraName = NULL; // Name of the new (automatically-generated) camera configuration 994 psStringAppend(&newCameraName, "_%s-SKYCELL", cameraName); 995 file = fpaFileDefineOutput(config, fpa, filename, newCameraName, "SKYCELL"); 969 996 psFree(cameraName); 997 psFree(newCameraName); 970 998 } 971 999
Note:
See TracChangeset
for help on using the changeset viewer.
