Changeset 11226 for trunk/psModules/src/camera/pmFPAfileDefine.c
- Timestamp:
- Jan 21, 2007, 3:11:21 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfileDefine.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r11182 r11226 406 406 407 407 file->format = format; 408 *found = true; 408 if (found) 409 *found = true; 409 410 return file; 410 411 } … … 427 428 pmFPAfile *file = NULL; 428 429 psMetadata *phu = NULL; 429 psMetadata *format = NULL;430 430 431 431 if (found && *found) … … 452 452 } 453 453 // XXX temporary hack : force PSF input onto filename 454 // XXX EAM : I need to define a PSF container which specifies the chip/cell element 455 // XXX we could use the flat metadata style IF we restrict it to SIMPLE cameras 456 // XXX (ie, one readout per cell, one cell per chip, one chip per fpa) 454 457 if (file->type == PM_FPA_FILE_PSF) { 455 458 file->filerule = psStringCopy (infiles->data[0]); … … 461 464 file->format = psMemIncrRefCounter(input->format); 462 465 463 // defin the rule to identify these files in the file->names data466 // define the rule to identify these files in the file->names data 464 467 psFree (file->filerule); 465 468 psFree (file->filextra); … … 489 492 return NULL; 490 493 } 491 if (!pmConfigValidateCameraFormat ( format, phu)) {492 psError(PS_ERR_IO, false, "specified MASK%s does not match format of supplied INPUT\n", realName);494 if (!pmConfigValidateCameraFormat (input->format, phu)) { 495 psError(PS_ERR_IO, false, "specified data file %s does not match format of supplied INPUT\n", realName); 493 496 psFree (realName); 494 497 psFitsClose (fits); … … 499 502 500 503 // set the view to the corresponding entry for this phu 501 // XXX this will override the fpa->header, which I don't want to do. 502 // XXX do I need to carry around the mask and weight headers??? 503 psAbort ("psModules", "pmFPAfileBindMaskFromArgs is not completed"); 504 pmFPAview *view = pmFPAAddSourceFromHeader (input->fpa, phu, format); 504 pmFPAview *view = pmFPAIdentifySourceFromHeader (input->fpa, phu, input->format); 505 505 if (!view) { 506 506 psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name); 507 507 psFree(phu); 508 psFree (format);509 508 return NULL; 510 509 } … … 520 519 psFree (phu); 521 520 } 522 *found = true; 521 if (found) 522 *found = true; 523 523 return file; 524 524 } … … 604 604 if (!filemenu) { 605 605 psError (PS_ERR_IO, true, "missing FILE in FORMAT"); 606 psFree(phu); 607 psFree(fpa); 608 psFree(format); 606 609 return NULL; 607 610 } … … 609 612 if (!levelName) { 610 613 psError (PS_ERR_IO, true, "missing PHU in FILE in FORMAT"); 614 psFree(phu); 615 psFree(fpa); 616 psFree(format); 611 617 return NULL; 612 618 } … … 614 620 if (file->fileLevel == PM_FPA_LEVEL_NONE) { 615 621 psError (PS_ERR_IO, true, "unknown level"); 622 psFree(phu); 623 psFree(fpa); 624 psFree(format); 616 625 return NULL; 617 626 } … … 622 631 psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name); 623 632 psFree(phu); 624 psFree (fpa);625 psFree (format);633 psFree(fpa); 634 psFree(format); 626 635 return NULL; 627 636 } … … 638 647 psFree (fpa); 639 648 640 file->format = format;641 *found = true;649 if (found) 650 *found = true; 642 651 return file; 643 652 } … … 669 678 // the returned file is just a view to the entry on config->files 670 679 pmFPAfile *file = pmFPAfileDefineInput (config, fpa, filename); 680 psFree (fpa); 671 681 if (!file) { 672 682 psError(PS_ERR_IO, false, "file %s not defined\n", filename); 673 psFree(fpa); 674 psFree(file); 675 return NULL; 676 } 677 683 return NULL; 684 } 678 685 679 686 // image names may not come from file->names … … 681 688 psError(PS_ERR_IO, true, "supplied filerule uses illegal value @FILES"); 682 689 // XXX remove the file from config->files 683 psFree(fpa);684 690 psFree(file); 685 691 return NULL; … … 691 697 // don't free the file here: it is left on config->files 692 698 // to be used optionally by pmFPAfileDefineFromDetDB (or others) 693 psFree(fpa);694 699 return NULL; 695 700 } … … 700 705 file->filerule = tmpName; 701 706 702 if (found) {707 if (found) 703 708 *found = true; 704 }705 psFree (fpa); // Drop reference706 707 709 return file; 708 710 } … … 794 796 } 795 797 char *option = item->name; // item->name must correspond to a valid detselect option 796 797 psArray *conceptData = psStringSplitArray ((char *) item->data.V, ":", true); 798 if (conceptData == NULL) 799 psAbort ("psModules", "programming error"); 800 if (conceptData->n == 0) 801 psAbort ("psModules", "missing data for %s", item->name); 802 if (conceptData->n > 2) 803 psAbort ("psModules", "invalid format for %s", item->name); 804 805 char *concept = NULL; 806 char *function = NULL; 807 if (conceptData->n == 1) { 808 concept = conceptData->data[0]; 809 } 810 if (conceptData->n == 2) { 811 function = conceptData->data[0]; 812 concept = conceptData->data[1]; 813 } 814 815 // XXX: 'function' unncesssary now that it's not required for filter? 798 char *concept = item->data.V; 799 816 800 if (!strcasecmp (option, "filter")) { 817 if (function)818 psAbort ("psModules", "no detrend constraint function for filter");819 801 options->filter = psMetadataLookupPtr (&status, input->concepts, concept); 820 802 if (!status) … … 823 805 } 824 806 if (!strcasecmp (option, "exptime")) { 825 if (function)826 psAbort ("psModules", "no detrend constraint function for exptime");827 807 options->exptime = psMetadataLookupF32 (&status, input->concepts, concept); 828 808 if (!status) … … 830 810 } 831 811 if (!strcasecmp (option, "airmass")) { 832 if (function) 833 psAbort ("psModules", "no detrend constraint function for airmass"); 834 options->airmass = psMetadataLookupF32 (NULL, input->concepts, concept); 812 options->airmass = psMetadataLookupF32 (&status, input->concepts, concept); 835 813 if (!status) 836 814 psAbort ("psModules", "airmass not found"); … … 838 816 # if (0) 839 817 if (!strcasecmp (option, "dettemp")) { 840 options->dettemp = psMetadataLookupF32 ( NULL, input->concepts, concept);818 options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept); 841 819 if (!status) 842 820 psAbort ("psModules", "dettemp not found"); … … 844 822 if (!strcasecmp (option, "version")) { 845 823 // version is applied as a literal string 846 if (function)847 psAbort ("psModules", "no detrend constraint function for airmass");848 options->version = psStringCopy(concept);824 options->version = psMetadataLookupF32 (&status, input->concepts, concept); 825 if (!status) 826 psAbort ("psModules", "version not found"); 849 827 } 850 828 if (!strcasecmp (option, "twilight")) { 851 829 // XXX determine the twilight time based on concept defining the time-of-day 852 options->twilight = psMetadataLookupF32 (NULL, input->concepts, concept); 830 // XXX need to include twilight time somehow (uses lookup based on a time value) 831 options->twilight = psMetadataLookupF32 (&status, input->concepts, concept); 853 832 if (!status) 854 psAbort ("psModules", "dettemp not found"); 855 } 856 // XXX need to include twilight time somehow (uses lookup based on a time value) 833 psAbort ("psModules", "twilight not found"); 834 } 857 835 # endif 858 836 … … 877 855 psFree (options); 878 856 879 *found = true; 857 if (found) 858 *found = true; 880 859 return file; 881 860 }
Note:
See TracChangeset
for help on using the changeset viewer.
