Changeset 18163
- Timestamp:
- Jun 17, 2008, 12:16:38 PM (18 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 18 edited
-
camera/pmFPAHeader.c (modified) (7 diffs)
-
camera/pmFPAHeader.h (modified) (4 diffs)
-
camera/pmFPARead.c (modified) (25 diffs)
-
camera/pmFPARead.h (modified) (25 diffs)
-
camera/pmFPAWrite.c (modified) (6 diffs)
-
camera/pmFPAWrite.h (modified) (11 diffs)
-
camera/pmFPAfileFitsIO.c (modified) (18 diffs)
-
camera/pmFPAfileFitsIO.h (modified) (9 diffs)
-
concepts/pmConcepts.c (modified) (18 diffs)
-
concepts/pmConcepts.h (modified) (9 diffs)
-
concepts/pmConceptsRead.c (modified) (6 diffs)
-
concepts/pmConceptsRead.h (modified) (4 diffs)
-
concepts/pmConceptsWrite.c (modified) (3 diffs)
-
concepts/pmConceptsWrite.h (modified) (2 diffs)
-
config/pmConfig.c (modified) (2 diffs)
-
detrend/pmDark.c (modified) (12 diffs)
-
detrend/pmDark.h (modified) (7 diffs)
-
imcombine/pmSubtraction.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAHeader.c
r18137 r18163 17 17 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 18 18 19 bool pmCellReadHeader(pmCell *cell, psFits *fits, p sDB *db)19 bool pmCellReadHeader(pmCell *cell, psFits *fits, pmConfig *config) 20 20 { 21 21 PS_ASSERT_PTR_NON_NULL(cell, false); … … 23 23 24 24 if (!cell->hdu) { 25 return pmChipReadHeader(cell->parent, fits, db);25 return pmChipReadHeader(cell->parent, fits, config); 26 26 } 27 27 if (!pmHDUReadHeader(cell->hdu, fits)) { … … 30 30 } 31 31 32 return pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, false, db);32 return pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, false, config); 33 33 } 34 34 35 35 36 bool pmChipReadHeader(pmChip *chip, psFits *fits, p sDB *db)36 bool pmChipReadHeader(pmChip *chip, psFits *fits, pmConfig *config) 37 37 { 38 38 PS_ASSERT_PTR_NON_NULL(chip, false); … … 40 40 41 41 if (!chip->hdu) { 42 return pmFPAReadHeader(chip->parent, fits, db);42 return pmFPAReadHeader(chip->parent, fits, config); 43 43 } 44 44 if (!pmHDUReadHeader(chip->hdu, fits)) { … … 47 47 } 48 48 49 if (!pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, true, db)) {49 if (!pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, true, config)) { 50 50 psError(PS_ERR_UNKNOWN, false, "Unable to read concepts for chip.\n"); 51 51 return false; … … 56 56 57 57 58 bool pmFPAReadHeader(pmFPA *fpa, psFits *fits, p sDB *db)58 bool pmFPAReadHeader(pmFPA *fpa, psFits *fits, pmConfig *config) 59 59 { 60 60 PS_ASSERT_PTR_NON_NULL(fpa, false); … … 69 69 } 70 70 71 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, db)) {71 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, config)) { 72 72 psError(PS_ERR_UNKNOWN, false, "Unable to read concepts for FPA.\n"); 73 73 return false; -
trunk/psModules/src/camera/pmFPAHeader.h
r18137 r18163 1 1 /* @file pmFPAHeader.h 2 2 * @brief Functions read FITS headers for FPA components 3 * 3 * 4 4 * @author Paul Price, IfA 5 * 6 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06-1 4 02:15:05$5 * 6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 21 21 bool pmFPAReadHeader(pmFPA *fpa, ///< FPA for which to read header 22 22 psFits *fits, ///< FITS file handle 23 psDB *db 23 pmConfig *config ///< Configuration 24 24 ); 25 25 … … 30 30 bool pmChipReadHeader(pmChip *chip, ///< Chip for which to read header 31 31 psFits *fits, ///< FITS file handle 32 psDB *db 32 pmConfig *config ///< Configuration 33 33 ); 34 34 … … 39 39 bool pmCellReadHeader(pmCell *cell, ///< Cell for which to read header 40 40 psFits *fits, ///< FITS file handle 41 psDB *db 41 pmConfig *config ///< Configuration 42 42 ); 43 43 /// @} -
trunk/psModules/src/camera/pmFPARead.c
r18140 r18163 82 82 static bool cellNumReadouts(pmCell *cell, // Cell of interest 83 83 psFits *fits, // FITS file 84 psDB *db 84 pmConfig *config // Configuration 85 85 ) 86 86 { … … 94 94 return false; 95 95 } 96 if (!pmCellReadHeader(cell, fits, db)) {96 if (!pmCellReadHeader(cell, fits, config)) { 97 97 psError(PS_ERR_IO, false, "Unable to read header for cell!\n"); 98 98 return false; … … 143 143 int numScans, // Number of scans to read at a time 144 144 fpaReadType type, // Type of image 145 p sDB *db // Database handle for concepts145 pmConfig *config // Configuration 146 146 ) 147 147 { … … 153 153 154 154 if (!pmConceptsReadCell(readout->parent, PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE, 155 true, db)) {155 true, config)) { 156 156 psError(PS_ERR_IO, false, "Failed to read concepts for cell."); 157 157 return false; … … 209 209 int numScans, // Number of scans to read at a time 210 210 fpaReadType type, // Type of image 211 p sDB *db // Database handle for concepts211 pmConfig *config// Configuration 212 212 ) 213 213 { … … 229 229 return false; 230 230 } 231 int naxis3 = cellNumReadouts(cell, fits, db); // Number of planes231 int naxis3 = cellNumReadouts(cell, fits, config); // Number of planes 232 232 if (z >= naxis3) { 233 233 // No more to read … … 237 237 int next; // Next position 238 238 int last; // Last position 239 if (!readoutScanProperties(&next, &last, readout, numScans, type, db)) {239 if (!readoutScanProperties(&next, &last, readout, numScans, type, config)) { 240 240 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 241 241 return false; … … 395 395 int overlap, // Number of scans (row/col) to overlap between scans 396 396 fpaReadType type, // Type of image 397 p sDB *db // Database handle for concepts397 pmConfig *config // Configuration 398 398 ) 399 399 { … … 416 416 } 417 417 418 int naxis3 = cellNumReadouts(cell, fits, db); // Number of image planes418 int naxis3 = cellNumReadouts(cell, fits, config); // Number of image planes 419 419 if (z >= naxis3) { 420 420 psError(PS_ERR_IO, false, "Desired image plane (%d) exceeds available number (%d).", … … 425 425 int next; // Next position 426 426 int last; // Last position 427 if (!readoutScanProperties(&next, &last, readout, numScans, type, db)) {427 if (!readoutScanProperties(&next, &last, readout, numScans, type, config)) { 428 428 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 429 429 return false; … … 532 532 static bool cellRead(pmCell *cell, // Cell into which to read 533 533 psFits *fits, // FITS file from which to read 534 p sDB *db, // Database handle, for concepts ingest534 pmConfig *config, // Configuration 535 535 fpaReadType type // Type to read 536 536 ) … … 578 578 579 579 // load in the concept information for this cell 580 if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, db)) {580 if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, config)) { 581 581 //psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for cell"); 582 582 //return false; … … 653 653 static bool chipRead(pmChip *chip, // Chip into which to read 654 654 psFits *fits, // FITS file from which to read 655 p sDB *db, // Database handle, for concepts ingest655 pmConfig *config, // Configuration 656 656 fpaReadType type // Type to read 657 657 ) … … 664 664 for (int i = 0; i < cells->n; i++) { 665 665 pmCell *cell = cells->data[i]; // The cell of interest 666 success |= cellRead(cell, fits, db, type);666 success |= cellRead(cell, fits, config, type); 667 667 } 668 668 if (success) { … … 684 684 static bool fpaRead(pmFPA *fpa, // FPA into which to read 685 685 psFits *fits, // FITS file from which to read 686 p sDB *db, // Database handle, for concepts ingest686 pmConfig *config, // Configuration 687 687 fpaReadType type // Type to read 688 688 ) … … 695 695 for (int i = 0; i < chips->n; i++) { 696 696 pmChip *chip = chips->data[i]; // The cell of interest 697 success |= chipRead(chip, fits, db, type);697 success |= chipRead(chip, fits, config, type); 698 698 } 699 699 if (success) { … … 720 720 // pmReadoutReadNext is maintained here (for now) to maintain backwards compatibility. 721 721 // pmReadoutReadNext has been replaced by pmReadoutRead, pmReadoutReadChunk, pmReadoutMore 722 bool pmReadoutReadNext(bool *status, pmReadout *readout, psFits *fits, int z, int numScans, p sDB *db)722 bool pmReadoutReadNext(bool *status, pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config) 723 723 { 724 724 PS_ASSERT_PTR_NON_NULL(readout, false); … … 741 741 } 742 742 743 if (!pmCellReadHeader(cell, fits, db)) {743 if (!pmCellReadHeader(cell, fits, config)) { 744 744 psError(PS_ERR_IO, false, "Unable to read header for cell!\n"); 745 745 return false; … … 896 896 897 897 898 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, p sDB *db)898 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config) 899 899 { 900 900 PS_ASSERT_PTR_NON_NULL(readout, false); 901 901 PS_ASSERT_FITS_NON_NULL(fits, false); 902 902 903 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE, db);904 } 905 906 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, p sDB *db)903 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE, config); 904 } 905 906 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, pmConfig *config) 907 907 { 908 908 PS_ASSERT_PTR_NON_NULL(readout, false); … … 911 911 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 912 912 913 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE, db);914 } 915 916 bool pmReadoutRead(pmReadout *readout, psFits *fits, int z, p sDB *db)913 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE, config); 914 } 915 916 bool pmReadoutRead(pmReadout *readout, psFits *fits, int z, pmConfig *config) 917 917 { 918 918 PS_ASSERT_PTR_NON_NULL(readout, false); 919 919 PS_ASSERT_FITS_NON_NULL(fits, false); 920 920 921 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE, db);922 } 923 924 int pmCellNumReadouts(pmCell *cell, psFits *fits, p sDB *db)921 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE, config); 922 } 923 924 int pmCellNumReadouts(pmCell *cell, psFits *fits, pmConfig *config) 925 925 { 926 926 PS_ASSERT_PTR_NON_NULL(cell, false); 927 927 PS_ASSERT_FITS_NON_NULL(fits, false); 928 928 929 return cellNumReadouts(cell, fits, db);930 } 931 932 bool pmCellRead(pmCell *cell, psFits *fits, p sDB *db)929 return cellNumReadouts(cell, fits, config); 930 } 931 932 bool pmCellRead(pmCell *cell, psFits *fits, pmConfig *config) 933 933 { 934 934 PS_ASSERT_PTR_NON_NULL(cell, false); 935 935 PS_ASSERT_FITS_NON_NULL(fits, false); 936 936 937 return cellRead(cell, fits, db, FPA_READ_TYPE_IMAGE);938 } 939 940 bool pmChipRead(pmChip *chip, psFits *fits, p sDB *db)937 return cellRead(cell, fits, config, FPA_READ_TYPE_IMAGE); 938 } 939 940 bool pmChipRead(pmChip *chip, psFits *fits, pmConfig *config) 941 941 { 942 942 PS_ASSERT_PTR_NON_NULL(chip, false); 943 943 PS_ASSERT_FITS_NON_NULL(fits, false); 944 944 945 return chipRead(chip, fits, db, FPA_READ_TYPE_IMAGE);946 } 947 948 bool pmFPARead(pmFPA *fpa, psFits *fits, p sDB *db)945 return chipRead(chip, fits, config, FPA_READ_TYPE_IMAGE); 946 } 947 948 bool pmFPARead(pmFPA *fpa, psFits *fits, pmConfig *config) 949 949 { 950 950 PS_ASSERT_PTR_NON_NULL(fpa, false); 951 951 PS_ASSERT_FITS_NON_NULL(fits, false); 952 952 953 return fpaRead(fpa, fits, db, FPA_READ_TYPE_IMAGE);953 return fpaRead(fpa, fits, config, FPA_READ_TYPE_IMAGE); 954 954 } 955 955 … … 959 959 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 960 960 961 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, p sDB *db)961 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config) 962 962 { 963 963 PS_ASSERT_PTR_NON_NULL(readout, false); 964 964 PS_ASSERT_FITS_NON_NULL(fits, false); 965 965 966 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_MASK, db); 967 } 968 969 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, psDB *db) 966 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_MASK, config); 967 } 968 969 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, 970 pmConfig *config) 970 971 { 971 972 PS_ASSERT_PTR_NON_NULL(readout, false); … … 974 975 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 975 976 976 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK, db);977 } 978 979 bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z, p sDB *db)977 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK, config); 978 } 979 980 bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z, pmConfig *config) 980 981 { 981 982 PS_ASSERT_PTR_NON_NULL(readout, false); 982 983 PS_ASSERT_FITS_NON_NULL(fits, false); 983 984 984 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK, db);985 } 986 987 bool pmCellReadMask(pmCell *cell, psFits *fits, p sDB *db)985 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK, config); 986 } 987 988 bool pmCellReadMask(pmCell *cell, psFits *fits, pmConfig *config) 988 989 { 989 990 PS_ASSERT_PTR_NON_NULL(cell, false); 990 991 PS_ASSERT_FITS_NON_NULL(fits, false); 991 992 992 return cellRead(cell, fits, db, FPA_READ_TYPE_MASK);993 } 994 995 bool pmChipReadMask(pmChip *chip, psFits *fits, p sDB *db)993 return cellRead(cell, fits, config, FPA_READ_TYPE_MASK); 994 } 995 996 bool pmChipReadMask(pmChip *chip, psFits *fits, pmConfig *config) 996 997 { 997 998 PS_ASSERT_PTR_NON_NULL(chip, false); 998 999 PS_ASSERT_FITS_NON_NULL(fits, false); 999 1000 1000 return chipRead(chip, fits, db, FPA_READ_TYPE_MASK);1001 } 1002 1003 bool pmFPAReadMask(pmFPA *fpa, psFits *fits, p sDB *db)1001 return chipRead(chip, fits, config, FPA_READ_TYPE_MASK); 1002 } 1003 1004 bool pmFPAReadMask(pmFPA *fpa, psFits *fits, pmConfig *config) 1004 1005 { 1005 1006 PS_ASSERT_PTR_NON_NULL(fpa, false); 1006 1007 PS_ASSERT_FITS_NON_NULL(fits, false); 1007 1008 1008 return fpaRead(fpa, fits, db, FPA_READ_TYPE_MASK);1009 return fpaRead(fpa, fits, config, FPA_READ_TYPE_MASK); 1009 1010 } 1010 1011 … … 1013 1014 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1014 1015 1015 bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, p sDB *db)1016 bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config) 1016 1017 { 1017 1018 PS_ASSERT_PTR_NON_NULL(readout, false); 1018 1019 PS_ASSERT_FITS_NON_NULL(fits, false); 1019 1020 1020 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_WEIGHT, db); 1021 } 1022 1023 bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, psDB *db) 1021 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_WEIGHT, config); 1022 } 1023 1024 bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, 1025 pmConfig *config) 1024 1026 { 1025 1027 PS_ASSERT_PTR_NON_NULL(readout, false); … … 1028 1030 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 1029 1031 1030 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT, db);1031 } 1032 1033 bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z, p sDB *db)1032 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT, config); 1033 } 1034 1035 bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z, pmConfig *config) 1034 1036 { 1035 1037 PS_ASSERT_PTR_NON_NULL(readout, false); 1036 1038 PS_ASSERT_FITS_NON_NULL(fits, false); 1037 1039 1038 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT, db);1039 } 1040 1041 bool pmCellReadWeight(pmCell *cell, psFits *fits, p sDB *db)1040 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT, config); 1041 } 1042 1043 bool pmCellReadWeight(pmCell *cell, psFits *fits, pmConfig *config) 1042 1044 { 1043 1045 PS_ASSERT_PTR_NON_NULL(cell, false); 1044 1046 PS_ASSERT_FITS_NON_NULL(fits, false); 1045 1047 1046 return cellRead(cell, fits, db, FPA_READ_TYPE_WEIGHT);1047 } 1048 1049 bool pmChipReadWeight(pmChip *chip, psFits *fits, p sDB *db)1048 return cellRead(cell, fits, config, FPA_READ_TYPE_WEIGHT); 1049 } 1050 1051 bool pmChipReadWeight(pmChip *chip, psFits *fits, pmConfig *config) 1050 1052 { 1051 1053 PS_ASSERT_PTR_NON_NULL(chip, false); 1052 1054 PS_ASSERT_FITS_NON_NULL(fits, false); 1053 1055 1054 return chipRead(chip, fits, db, FPA_READ_TYPE_WEIGHT);1055 } 1056 1057 bool pmFPAReadWeight(pmFPA *fpa, psFits *fits, p sDB *db)1056 return chipRead(chip, fits, config, FPA_READ_TYPE_WEIGHT); 1057 } 1058 1059 bool pmFPAReadWeight(pmFPA *fpa, psFits *fits, pmConfig *config) 1058 1060 { 1059 1061 PS_ASSERT_PTR_NON_NULL(fpa, false); 1060 1062 PS_ASSERT_FITS_NON_NULL(fits, false); 1061 1063 1062 return fpaRead(fpa, fits, db, FPA_READ_TYPE_WEIGHT);1064 return fpaRead(fpa, fits, config, FPA_READ_TYPE_WEIGHT); 1063 1065 } 1064 1066 … … 1067 1069 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1068 1070 1069 bool pmCellReadHeaderSet(pmCell *cell, psFits *fits, p sDB *db)1071 bool pmCellReadHeaderSet(pmCell *cell, psFits *fits, pmConfig *config) 1070 1072 { 1071 1073 PS_ASSERT_PTR_NON_NULL(cell, false); 1072 1074 PS_ASSERT_FITS_NON_NULL(fits, false); 1073 1075 1074 return cellRead(cell, fits, db, FPA_READ_TYPE_HEADER);1075 } 1076 1077 bool pmChipReadHeaderSet(pmChip *chip, psFits *fits, p sDB *db)1076 return cellRead(cell, fits, config, FPA_READ_TYPE_HEADER); 1077 } 1078 1079 bool pmChipReadHeaderSet(pmChip *chip, psFits *fits, pmConfig *config) 1078 1080 { 1079 1081 PS_ASSERT_PTR_NON_NULL(chip, false); 1080 1082 PS_ASSERT_FITS_NON_NULL(fits, false); 1081 1083 1082 return chipRead(chip, fits, db, FPA_READ_TYPE_HEADER);1083 } 1084 1085 bool pmFPAReadHeaderSet(pmFPA *fpa, psFits *fits, p sDB *db)1084 return chipRead(chip, fits, config, FPA_READ_TYPE_HEADER); 1085 } 1086 1087 bool pmFPAReadHeaderSet(pmFPA *fpa, psFits *fits, pmConfig *config) 1086 1088 { 1087 1089 PS_ASSERT_PTR_NON_NULL(fpa, false); 1088 1090 PS_ASSERT_FITS_NON_NULL(fits, false); 1089 1091 1090 return fpaRead(fpa, fits, db, FPA_READ_TYPE_HEADER);1092 return fpaRead(fpa, fits, config, FPA_READ_TYPE_HEADER); 1091 1093 } 1092 1094 -
trunk/psModules/src/camera/pmFPARead.h
r18137 r18163 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06-1 4 02:15:05$6 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 11 11 #ifndef PM_FPA_READ_H 12 12 #define PM_FPA_READ_H 13 14 #include <pmConfig.h> 13 15 14 16 /// @addtogroup Camera Camera Layout … … 20 22 int z, ///< Readout number/plane; zero-offset indexing 21 23 int numScans, ///< Number of scans (rows/cols) to read 22 p sDB *db ///< Database handle for concepts24 pmConfig *config ///< Configuration 23 25 ); 24 26 … … 31 33 int numScans, ///< Number of scans (rows/cols) to read 32 34 int overlap, ///< Overlap between consecutive reads 33 p sDB *db ///< Database handle for concepts35 pmConfig *config ///< Configuration 34 36 ); 35 37 … … 38 40 psFits *fits, ///< FITS file from which to read 39 41 int z, ///< Readout number/plane; zero-offset indexing 40 p sDB *db ///< Database handle for concepts42 pmConfig *config ///< Configuration 41 43 ); 42 44 … … 57 59 int z, // Readout number/plane; zero-offset indexing 58 60 int numRows, // The number of rows to read 59 psDB *db 61 pmConfig *config 60 62 ); 61 63 … … 63 65 /// 64 66 /// This function is type-independent (doesn't matter if you are interested in the image/mask/weight). 65 int pmCellNumReadouts(pmCell *cell, psFits *fits, p sDB *db);67 int pmCellNumReadouts(pmCell *cell, psFits *fits, pmConfig *config); 66 68 67 69 /// Read an entire cell … … 71 73 bool pmCellRead(pmCell *cell, // Cell to read into 72 74 psFits *fits, // FITS file from which to read 73 p sDB *db // Database handle, for "concepts" ingest75 pmConfig *config // Configuration 74 76 ); 75 77 … … 79 81 bool pmChipRead(pmChip *chip, // Chip to read into 80 82 psFits *fits, // FITS file from which to read 81 p sDB *db // Database handle, for "concepts" ingest83 pmConfig *config // Configuration 82 84 ); 83 85 … … 87 89 bool pmFPARead(pmFPA *fpa, // FPA to read into 88 90 psFits *fits, // FITS file from which to read 89 p sDB *db // Database handle, for "concepts" ingest91 pmConfig *config // Configuration 90 92 ); 91 93 … … 97 99 int z, ///< Readout number/plane; zero-offset indexing 98 100 int numScans, ///< Number of scans (rows/cols) to read 99 p sDB *db ///< Database handle for concepts101 pmConfig *config ///< Configuration 100 102 ); 101 103 … … 108 110 int numScans, ///< Number of scans (rows/cols) to read 109 111 int overlap, ///< Overlap between consecutive reads 110 p sDB *db ///< Database handle for concepts112 pmConfig *config ///< Configuration 111 113 ); 112 114 … … 115 117 psFits *fits, ///< FITS file from which to read 116 118 int z, ///< Readout number/plane; zero-offset indexing 117 p sDB *db ///< Database handle for concepts119 pmConfig *config ///< Configuration 118 120 ); 119 121 … … 123 125 bool pmCellReadMask(pmCell *cell, // Cell to read into 124 126 psFits *fits, // FITS file from which to read 125 p sDB *db // Database handle, for "concepts" ingest127 pmConfig *config // Configuration 126 128 ); 127 129 … … 131 133 bool pmChipReadMask(pmChip *chip, // Chip to read into 132 134 psFits *fits, // FITS file from which to read 133 p sDB *db // Database handle, for "concepts" ingest135 pmConfig *config // Configuration 134 136 ); 135 137 … … 139 141 bool pmFPAReadMask(pmFPA *fpa, // FPA to read into 140 142 psFits *fits, // FITS file from which to read 141 p sDB *db // Database handle, for "concepts" ingest143 pmConfig *config // Configuration 142 144 ); 143 145 … … 149 151 int z, ///< Readout number/plane; zero-offset indexing 150 152 int numScans, ///< Number of scans (rows/cols) to read 151 p sDB *db ///< Database handle for concepts153 pmConfig *config ///< Configuration 152 154 ); 153 155 … … 160 162 int numScans, ///< Number of scans (rows/cols) to read 161 163 int overlap, ///< Overlap between consecutive reads 162 p sDB *db ///< Database handle for concepts164 pmConfig *config ///< Configuration 163 165 ); 164 166 … … 167 169 psFits *fits, ///< FITS file from which to read 168 170 int z, ///< Readout number/plane; zero-offset indexing 169 p sDB *db ///< Database handle for concepts171 pmConfig *config ///< Configuration 170 172 ); 171 173 … … 173 175 /// 174 176 /// Same as pmCellRead, but reads into the weight element of the readouts. 175 bool pmCellReadWeight(pmCell *cell, // Cell to read into176 psFits *fits, // FITS file from which to read177 p sDB *db // Database handle, for "concepts" ingest177 bool pmCellReadWeight(pmCell *cell, // Cell to read into 178 psFits *fits, // FITS file from which to read 179 pmConfig *config // Configuration 178 180 ); 179 181 … … 181 183 /// 182 184 /// Same as pmChipRead, but reads into the weight element of the readouts. 183 bool pmChipReadWeight(pmChip *chip, // Chip to read into184 psFits *fits, // FITS file from which to read185 p sDB *db // Database handle, for "concepts" ingest185 bool pmChipReadWeight(pmChip *chip, // Chip to read into 186 psFits *fits, // FITS file from which to read 187 pmConfig *config // Configuration 186 188 ); 187 189 … … 189 191 /// 190 192 /// Same as pmFPARead, but reads into the weight element of the readouts. 191 bool pmFPAReadWeight(pmFPA *fpa, // FPA to read into192 psFits *fits, // FITS file from which to read193 p sDB *db // Database handle, for "concepts" ingest193 bool pmFPAReadWeight(pmFPA *fpa, // FPA to read into 194 psFits *fits, // FITS file from which to read 195 pmConfig *config // Configuration 194 196 ); 195 197 … … 197 199 /// 198 200 /// Same as pmCellRead, but reads only the headers of the readouts. 199 bool pmCellReadHeaderSet(pmCell *cell, // Cell to read into200 psFits *fits, // FITS file from which to read201 p sDB *db // Database handle, for "concepts" ingest201 bool pmCellReadHeaderSet(pmCell *cell, // Cell to read into 202 psFits *fits, // FITS file from which to read 203 pmConfig *config // Configuration 202 204 ); 203 205 … … 205 207 /// 206 208 /// Same as pmChipRead, but reads only the headers of the readouts. 207 bool pmChipReadHeaderSet(pmChip *chip, // Chip to read into208 psFits *fits, // FITS file from which to read209 p sDB *db // Database handle, for "concepts" ingest209 bool pmChipReadHeaderSet(pmChip *chip, // Chip to read into 210 psFits *fits, // FITS file from which to read 211 pmConfig *config // Configuration 210 212 ); 211 213 … … 213 215 /// 214 216 /// Same as pmFPARead, but reads only the headers of the readouts. 215 bool pmFPAReadHeaderSet(pmFPA *fpa, // FPA to read into216 psFits *fits, // FITS file from which to read217 p sDB *db // Database handle, for "concepts" ingest217 bool pmFPAReadHeaderSet(pmFPA *fpa, // FPA to read into 218 psFits *fits, // FITS file from which to read 219 pmConfig *config // Configuration 218 220 ); 219 221 -
trunk/psModules/src/camera/pmFPAWrite.c
r18027 r18163 128 128 static bool cellWrite(pmCell *cell, // Cell to write 129 129 psFits *fits, // FITS file to which to write 130 p sDB *db, // Database handle for "concepts" update130 pmConfig *config, // Configuration 131 131 bool blank, // Write a blank PHU? 132 132 fpaWriteType type // Type to write … … 178 178 static bool chipWrite(pmChip *chip, // Chip to write 179 179 psFits *fits, // FITS file to which to write 180 p sDB *db, // Database handle for "concepts" update180 pmConfig *config, // Configuration 181 181 bool blank, // Write a blank PHU? 182 182 bool recurse, // Recurse to lower levels? … … 228 228 for (int i = 0; i < cells->n; i++) { 229 229 pmCell *cell = cells->data[i]; // The cell of interest 230 if (!cellWrite(cell, fits, db, false, type)) {230 if (!cellWrite(cell, fits, config, false, type)) { 231 231 psError(PS_ERR_IO, false, "Unable to write Chip.\n"); 232 232 return false; … … 242 242 static bool fpaWrite(pmFPA *fpa, // FPA to write 243 243 psFits *fits, // FITS file to which to write 244 p sDB *db, // Database handle for "concepts" update244 pmConfig *config, // Configuration 245 245 bool blank, // Write a blank PHU? 246 246 bool recurse, // Recurse to lower levels? … … 291 291 for (int i = 0; i < chips->n; i++) { 292 292 pmChip *chip = chips->data[i]; // The chip of interest 293 if (!chipWrite(chip, fits, db, false, true, type)) {293 if (!chipWrite(chip, fits, config, false, true, type)) { 294 294 psError(PS_ERR_IO, false, "Unable to write FPA.\n"); 295 295 return false; … … 372 372 373 373 374 bool pmCellWrite(pmCell *cell, psFits *fits, p sDB *db, bool blank)374 bool pmCellWrite(pmCell *cell, psFits *fits, pmConfig *config, bool blank) 375 375 { 376 376 PS_ASSERT_PTR_NON_NULL(cell, false); 377 377 PS_ASSERT_PTR_NON_NULL(fits, false); 378 return cellWrite(cell, fits, db, blank, FPA_WRITE_TYPE_IMAGE);379 } 380 381 bool pmChipWrite(pmChip *chip, psFits *fits, p sDB *db, bool blank, bool recurse)378 return cellWrite(cell, fits, config, blank, FPA_WRITE_TYPE_IMAGE); 379 } 380 381 bool pmChipWrite(pmChip *chip, psFits *fits, pmConfig *config, bool blank, bool recurse) 382 382 { 383 383 PS_ASSERT_PTR_NON_NULL(chip, false); 384 384 PS_ASSERT_PTR_NON_NULL(fits, false); 385 return chipWrite(chip, fits, db, blank, recurse, FPA_WRITE_TYPE_IMAGE);386 } 387 388 bool pmFPAWrite(pmFPA *fpa, psFits *fits, p sDB *db, bool blank, bool recurse)385 return chipWrite(chip, fits, config, blank, recurse, FPA_WRITE_TYPE_IMAGE); 386 } 387 388 bool pmFPAWrite(pmFPA *fpa, psFits *fits, pmConfig *config, bool blank, bool recurse) 389 389 { 390 390 PS_ASSERT_PTR_NON_NULL(fpa, false); 391 391 PS_ASSERT_PTR_NON_NULL(fits, false); 392 return fpaWrite(fpa, fits, db, blank, recurse, FPA_WRITE_TYPE_IMAGE);393 } 394 395 396 bool pmCellWriteMask(pmCell *cell, psFits *fits, p sDB *db, bool blank)392 return fpaWrite(fpa, fits, config, blank, recurse, FPA_WRITE_TYPE_IMAGE); 393 } 394 395 396 bool pmCellWriteMask(pmCell *cell, psFits *fits, pmConfig *config, bool blank) 397 397 { 398 398 PS_ASSERT_PTR_NON_NULL(cell, false); 399 399 PS_ASSERT_PTR_NON_NULL(fits, false); 400 return cellWrite(cell, fits, db, blank, FPA_WRITE_TYPE_MASK);401 } 402 403 bool pmChipWriteMask(pmChip *chip, psFits *fits, p sDB *db, bool blank, bool recurse)400 return cellWrite(cell, fits, config, blank, FPA_WRITE_TYPE_MASK); 401 } 402 403 bool pmChipWriteMask(pmChip *chip, psFits *fits, pmConfig *config, bool blank, bool recurse) 404 404 { 405 405 PS_ASSERT_PTR_NON_NULL(chip, false); 406 406 PS_ASSERT_PTR_NON_NULL(fits, false); 407 return chipWrite(chip, fits, db, blank, recurse, FPA_WRITE_TYPE_MASK);408 } 409 410 bool pmFPAWriteMask(pmFPA *fpa, psFits *fits, p sDB *db, bool blank, bool recurse)407 return chipWrite(chip, fits, config, blank, recurse, FPA_WRITE_TYPE_MASK); 408 } 409 410 bool pmFPAWriteMask(pmFPA *fpa, psFits *fits, pmConfig *config, bool blank, bool recurse) 411 411 { 412 412 PS_ASSERT_PTR_NON_NULL(fpa, false); 413 413 PS_ASSERT_PTR_NON_NULL(fits, false); 414 return fpaWrite(fpa, fits, db, blank, recurse, FPA_WRITE_TYPE_MASK);415 } 416 417 418 bool pmCellWriteWeight(pmCell *cell, psFits *fits, p sDB *db, bool blank)414 return fpaWrite(fpa, fits, config, blank, recurse, FPA_WRITE_TYPE_MASK); 415 } 416 417 418 bool pmCellWriteWeight(pmCell *cell, psFits *fits, pmConfig *config, bool blank) 419 419 { 420 420 PS_ASSERT_PTR_NON_NULL(cell, false); 421 421 PS_ASSERT_PTR_NON_NULL(fits, false); 422 return cellWrite(cell, fits, db, blank, FPA_WRITE_TYPE_WEIGHT);423 } 424 425 bool pmChipWriteWeight(pmChip *chip, psFits *fits, p sDB *db, bool blank, bool recurse)422 return cellWrite(cell, fits, config, blank, FPA_WRITE_TYPE_WEIGHT); 423 } 424 425 bool pmChipWriteWeight(pmChip *chip, psFits *fits, pmConfig *config, bool blank, bool recurse) 426 426 { 427 427 PS_ASSERT_PTR_NON_NULL(chip, false); 428 428 PS_ASSERT_PTR_NON_NULL(fits, false); 429 return chipWrite(chip, fits, db, blank, recurse, FPA_WRITE_TYPE_WEIGHT);430 } 431 432 bool pmFPAWriteWeight(pmFPA *fpa, psFits *fits, p sDB *db, bool blank, bool recurse)429 return chipWrite(chip, fits, config, blank, recurse, FPA_WRITE_TYPE_WEIGHT); 430 } 431 432 bool pmFPAWriteWeight(pmFPA *fpa, psFits *fits, pmConfig *config, bool blank, bool recurse) 433 433 { 434 434 PS_ASSERT_PTR_NON_NULL(fpa, false); 435 435 PS_ASSERT_PTR_NON_NULL(fits, false); 436 return fpaWrite(fpa, fits, db, blank, recurse, FPA_WRITE_TYPE_WEIGHT);436 return fpaWrite(fpa, fits, config, blank, recurse, FPA_WRITE_TYPE_WEIGHT); 437 437 } 438 438 -
trunk/psModules/src/camera/pmFPAWrite.h
r12705 r18163 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-03-31 04:17:41$6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 11 11 #ifndef PM_FPA_WRITE_H 12 12 #define PM_FPA_WRITE_H 13 14 #include <pmConfig.h> 13 15 14 16 /// @addtogroup Camera Camera Layout … … 32 34 bool pmCellWrite(pmCell *cell, ///< Cell to write 33 35 psFits *fits, ///< FITS file to which to write 34 p sDB *db, ///< Database handle for "concepts" update36 pmConfig *config, ///< Configuration 35 37 bool blank ///< Write a blank PHU? 36 38 ); … … 44 46 bool pmChipWrite(pmChip *chip, ///< Chip to write 45 47 psFits *fits, ///< FITS file to which to write 46 p sDB *db, ///< Database handle for "concepts" update48 pmConfig *config, ///< Configuration 47 49 bool blank, ///< Write a blank PHU? 48 50 bool recurse ///< Recurse to lower levels? … … 57 59 bool pmFPAWrite(pmFPA *fpa, ///< FPA to write 58 60 psFits *fits, ///< FITS file to which to write 59 p sDB *db, ///< Database handle for "concepts" update61 pmConfig *config, ///< Configuration 60 62 bool blank, ///< Write a blank PHU? 61 63 bool recurse ///< Recurse to lower levels? … … 70 72 bool pmCellWriteMask(pmCell *cell, ///< Cell to write 71 73 psFits *fits, ///< FITS file to which to write 72 p sDB *db, ///< Database handle for "concepts" update74 pmConfig *config, ///< Configuration 73 75 bool blank ///< Write a blank PHU? 74 76 ); … … 83 85 bool pmChipWriteMask(pmChip *chip, ///< Chip to write 84 86 psFits *fits, ///< FITS file to which to write 85 p sDB *db, ///< Database handle for "concepts" update87 pmConfig *config, ///< Configuration 86 88 bool blank, ///< Write a blank PHU? 87 89 bool recurse ///< Recurse to lower levels? … … 97 99 bool pmFPAWriteMask(pmFPA *fpa, ///< FPA to write 98 100 psFits *fits, ///< FITS file to which to write 99 p sDB *db, ///< Database handle for "concepts" update101 pmConfig *config, ///< Configuration 100 102 bool blank, ///< Write a blank PHU? 101 103 bool recurse ///< Recurse to lower levels? … … 110 112 bool pmCellWriteWeight(pmCell *cell, ///< Cell to write 111 113 psFits *fits, ///< FITS file to which to write 112 p sDB *db, ///< Database handle for "concepts" update114 pmConfig *config, ///< Configuration 113 115 bool blank ///< Write a blank PHU? 114 116 ); … … 123 125 bool pmChipWriteWeight(pmChip *chip, ///< Chip to write 124 126 psFits *fits, ///< FITS file to which to write 125 p sDB *db, ///< Database handle for "concepts" update127 pmConfig *config, ///< Configuration 126 128 bool blank, ///< Write a blank PHU? 127 129 bool recurse ///< Recurse to lower levels? … … 137 139 bool pmFPAWriteWeight(pmFPA *fpa, ///< FPA to write 138 140 psFits *fits, ///< FITS file to which to write 139 p sDB *db, ///< Database handle for "concepts" update141 pmConfig *config, ///< Configuration 140 142 bool blank, ///< Write a blank PHU? 141 143 bool recurse ///< Recurse to lower levels? -
trunk/psModules/src/camera/pmFPAfileFitsIO.c
r18139 r18163 166 166 static bool fpaViewReadFitsImage(const pmFPAview *view, // FPA view, specifying the level of interest 167 167 pmFPAfile *file, // FPA file of interest 168 psDB *db, 169 bool (*fpaReadFunc)(pmFPA*, psFits*, p sDB*), // Function to read FPA170 bool (*chipReadFunc)(pmChip*, psFits*, p sDB*), // Function to read chip171 bool (*cellReadFunc)(pmCell*, psFits*, p sDB*) // Function to read cell168 pmConfig *config, // Configuration 169 bool (*fpaReadFunc)(pmFPA*, psFits*, pmConfig*), // Function to read FPA 170 bool (*chipReadFunc)(pmChip*, psFits*, pmConfig*), // Function to read chip 171 bool (*cellReadFunc)(pmCell*, psFits*, pmConfig*) // Function to read cell 172 172 ) 173 173 { … … 179 179 180 180 if (view->chip == -1) { 181 return fpaReadFunc(fpa, fits, db);181 return fpaReadFunc(fpa, fits, config); 182 182 } 183 183 … … 189 189 190 190 if (view->cell == -1) { 191 return chipReadFunc(chip, fits, db);191 return chipReadFunc(chip, fits, config); 192 192 } 193 193 … … 199 199 200 200 if (view->readout == -1) { 201 return cellReadFunc(cell, fits, db);201 return cellReadFunc(cell, fits, config); 202 202 } 203 203 psError(PS_ERR_UNKNOWN, true, "Bad view: %d,%d", view->chip, view->cell); … … 215 215 216 216 if (view->nRows == 0) { 217 pmReadoutRead (readout, fits, db);217 pmReadoutRead (readout, fits, config); 218 218 } else { 219 219 pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); … … 228 228 PS_ASSERT_PTR_NON_NULL(view, false); 229 229 PS_ASSERT_PTR_NON_NULL(file, false); 230 return fpaViewReadFitsImage(view, file, config ->database, pmFPARead, pmChipRead, pmCellRead);230 return fpaViewReadFitsImage(view, file, config, pmFPARead, pmChipRead, pmCellRead); 231 231 } 232 232 … … 235 235 PS_ASSERT_PTR_NON_NULL(view, false); 236 236 PS_ASSERT_PTR_NON_NULL(file, false); 237 return fpaViewReadFitsImage(view, file, config ->database, pmFPAReadMask, pmChipReadMask, pmCellReadMask);237 return fpaViewReadFitsImage(view, file, config, pmFPAReadMask, pmChipReadMask, pmCellReadMask); 238 238 } 239 239 … … 242 242 PS_ASSERT_PTR_NON_NULL(view, false); 243 243 PS_ASSERT_PTR_NON_NULL(file, false); 244 return fpaViewReadFitsImage(view, file, config ->database, pmFPAReadWeight, pmChipReadWeight, pmCellReadWeight);244 return fpaViewReadFitsImage(view, file, config, pmFPAReadWeight, pmChipReadWeight, pmCellReadWeight); 245 245 } 246 246 … … 249 249 PS_ASSERT_PTR_NON_NULL(view, false); 250 250 PS_ASSERT_PTR_NON_NULL(file, false); 251 return fpaViewReadFitsImage(view, file, config ->database, pmFPAReadDark, pmChipReadDark, pmCellReadDark);251 return fpaViewReadFitsImage(view, file, config, pmFPAReadDark, pmChipReadDark, pmCellReadDark); 252 252 } 253 253 … … 256 256 PS_ASSERT_PTR_NON_NULL(view, false); 257 257 PS_ASSERT_PTR_NON_NULL(file, false); 258 return fpaViewReadFitsImage(view, file, config ->database, pmFPAReadHeaderSet, pmChipReadHeaderSet, pmCellReadHeaderSet);258 return fpaViewReadFitsImage(view, file, config, pmFPAReadHeaderSet, pmChipReadHeaderSet, pmCellReadHeaderSet); 259 259 } 260 260 … … 267 267 static bool fpaViewWriteFitsImage(const pmFPAview *view, // FPA view, specifying the level of interest 268 268 pmFPAfile *file, // FPA file of interest 269 constpmConfig *config, // Configuration270 bool (*fpaWriteFunc)(pmFPA*, psFits*, p sDB*, bool, bool), // Func forFPA271 bool (*chipWriteFunc)(pmChip*, psFits*, p sDB*, bool, bool), // Func forchip272 bool (*cellWriteFunc)(pmCell*, psFits*, p sDB*, bool) // Func forcell269 pmConfig *config, // Configuration 270 bool (*fpaWriteFunc)(pmFPA*, psFits*, pmConfig*, bool, bool), // Func FPA 271 bool (*chipWriteFunc)(pmChip*, psFits*, pmConfig*, bool, bool),// Func chip 272 bool (*cellWriteFunc)(pmCell*, psFits*, pmConfig*, bool) // Func cell 273 273 ) 274 274 { … … 283 283 switch (pmFPAviewLevel(view)) { 284 284 case PM_FPA_LEVEL_FPA: { 285 bool success = fpaWriteFunc(fpa, fits, NULL, false, true);285 bool success = fpaWriteFunc(fpa, fits, config, false, true); 286 286 psFree(fpa); 287 287 return success; … … 289 289 case PM_FPA_LEVEL_CHIP: { 290 290 pmChip *chip = pmFPAviewThisChip(view, fpa); // Chip of interest 291 bool success = chipWriteFunc(chip, fits, NULL, false, true);291 bool success = chipWriteFunc(chip, fits, config, false, true); 292 292 psFree(fpa); 293 293 return success; … … 295 295 case PM_FPA_LEVEL_CELL: { 296 296 pmCell *cell = pmFPAviewThisCell(view, fpa); // Cell of interest 297 bool success = cellWriteFunc(cell, fits, NULL, false);297 bool success = cellWriteFunc(cell, fits, config, false); 298 298 psFree(fpa); 299 299 return success; … … 327 327 } 328 328 329 bool pmFPAviewWriteFitsImage(const pmFPAview *view, pmFPAfile *file, constpmConfig *config)329 bool pmFPAviewWriteFitsImage(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 330 330 { 331 331 PS_ASSERT_PTR_NON_NULL(view, false); … … 334 334 } 335 335 336 bool pmFPAviewWriteFitsMask(const pmFPAview *view, pmFPAfile *file, constpmConfig *config)336 bool pmFPAviewWriteFitsMask(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 337 337 { 338 338 PS_ASSERT_PTR_NON_NULL(view, false); … … 341 341 } 342 342 343 bool pmFPAviewWriteFitsWeight(const pmFPAview *view, pmFPAfile *file, constpmConfig *config)343 bool pmFPAviewWriteFitsWeight(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 344 344 { 345 345 PS_ASSERT_PTR_NON_NULL(view, false); … … 348 348 } 349 349 350 bool pmFPAviewWriteFitsDark(const pmFPAview *view, pmFPAfile *file, constpmConfig *config)350 bool pmFPAviewWriteFitsDark(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 351 351 { 352 352 PS_ASSERT_PTR_NON_NULL(view, false); -
trunk/psModules/src/camera/pmFPAfileFitsIO.h
r18139 r18163 5 5 * @author PAP, IfA 6 6 * 7 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-06-1 4 03:19:31$7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-06-17 22:16:38 $ 9 9 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 10 10 */ … … 19 19 bool pmFPAviewReadFitsImage(const pmFPAview *view, ///< View specifying level of interest 20 20 pmFPAfile *file, ///< FPA file into which to read 21 pmConfig *config21 pmConfig *config 22 22 ); 23 23 … … 25 25 bool pmFPAviewReadFitsMask(const pmFPAview *view, ///< View specifying level of interest 26 26 pmFPAfile *file, ///< FPA file into which to read 27 pmConfig *config27 pmConfig *config 28 28 ); 29 29 /// Read a weight map into the current view 30 30 bool pmFPAviewReadFitsWeight(const pmFPAview *view, ///< View specifying level of interest 31 31 pmFPAfile *file, ///< FPA file into which to read 32 pmConfig *config32 pmConfig *config 33 33 ); 34 34 … … 36 36 bool pmFPAviewReadFitsDark(const pmFPAview *view, ///< View specifying level of interest 37 37 pmFPAfile *file, ///< FPA file into which to read 38 pmConfig *config38 pmConfig *config 39 39 ); 40 40 … … 42 42 bool pmFPAviewReadFitsHeaderSet(const pmFPAview *view, ///< View specifying level of interest 43 43 pmFPAfile *file, ///< FPA file into which to read 44 pmConfig *config44 pmConfig *config 45 45 ); 46 46 … … 48 48 bool pmFPAviewWriteFitsImage(const pmFPAview *view, ///< View specifying level of interest 49 49 pmFPAfile *file, ///< FPA file to write 50 constpmConfig *config ///< Configuration50 pmConfig *config ///< Configuration 51 51 ); 52 52 … … 54 54 bool pmFPAviewWriteFitsMask(const pmFPAview *view, ///< View specifying level of interest 55 55 pmFPAfile *file, ///< FPA file to write 56 constpmConfig *config ///< Configuration56 pmConfig *config ///< Configuration 57 57 ); 58 58 … … 60 60 bool pmFPAviewWriteFitsWeight(const pmFPAview *view, ///< View specifying level of interest 61 61 pmFPAfile *file, ///< FPA file to write 62 constpmConfig *config ///< Configuration62 pmConfig *config ///< Configuration 63 63 ); 64 64 … … 66 66 bool pmFPAviewWriteFitsDark(const pmFPAview *view, ///< View specifying level of interest 67 67 pmFPAfile *file, ///< FPA file to write 68 constpmConfig *config ///< Configuration68 pmConfig *config ///< Configuration 69 69 ); 70 70 -
trunk/psModules/src/concepts/pmConcepts.c
r18104 r18163 10 10 #include <string.h> 11 11 12 #include "pmConfig.h" 12 13 #include "pmHDU.h" 13 14 #include "pmFPA.h" … … 195 196 unsigned int *read, // What's already been read 196 197 pmConceptSource source, // The source of the concepts to read 197 p sDB *db, // Database handle198 pmConfig *config, // Configuration 198 199 psMetadata *target // Place into which to read the concepts 199 200 ) … … 256 257 #ifdef HAVE_PSDB 257 258 if (source & PM_CONCEPT_SOURCE_DATABASE && !(*read & PM_CONCEPT_SOURCE_DATABASE)) { 258 if (p_pmConceptsReadFromDatabase(target, *specs, fpa, chip, cell, db)) {259 if (p_pmConceptsReadFromDatabase(target, *specs, fpa, chip, cell, config)) { 259 260 *read |= PM_CONCEPT_SOURCE_DATABASE; 260 261 } else { … … 276 277 const pmCell *cell, // The cell 277 278 pmConceptSource source, // The source of the concepts to write 278 p sDB *db, // Database handle279 pmConfig *config, // Configuration 279 280 const psMetadata *concepts // The concepts to write out 280 281 ) … … 299 300 } 300 301 if (source & PM_CONCEPT_SOURCE_DATABASE) { 301 p_pmConceptsWriteToDatabase(*specs, fpa, chip, cell, db, concepts);302 p_pmConceptsWriteToDatabase(*specs, fpa, chip, cell, config, concepts); 302 303 } 303 304 … … 306 307 307 308 308 bool pmConceptsRead(pmFPA *fpa, pmChip *chip, pmCell *cell, pmConceptSource source, p sDB *db)309 bool pmConceptsRead(pmFPA *fpa, pmChip *chip, pmCell *cell, pmConceptSource source, pmConfig *config) 309 310 { 310 311 PS_ASSERT_PTR_NON_NULL(fpa, false); 311 bool success = conceptsRead(&conceptsFPA, fpa, chip, cell, &fpa->conceptsRead, source, db, fpa->concepts); 312 bool success = conceptsRead(&conceptsFPA, fpa, chip, cell, &fpa->conceptsRead, source, 313 config, fpa->concepts); 312 314 if (chip) { 313 success &= conceptsRead(&conceptsChip, fpa, chip, cell, &chip->conceptsRead, source, db, chip->concepts); 315 success &= conceptsRead(&conceptsChip, fpa, chip, cell, &chip->conceptsRead, source, 316 config, chip->concepts); 314 317 } 315 318 if (cell) { 316 success &= conceptsRead(&conceptsCell, fpa, chip, cell, &cell->conceptsRead, source, db, cell->concepts); 319 success &= conceptsRead(&conceptsCell, fpa, chip, cell, &cell->conceptsRead, source, 320 config, cell->concepts); 317 321 } 318 322 … … 329 333 330 334 331 bool pmConceptsReadFPA(pmFPA *fpa, pmConceptSource source, bool propagateDown, p sDB *db)335 bool pmConceptsReadFPA(pmFPA *fpa, pmConceptSource source, bool propagateDown, pmConfig *config) 332 336 { 333 337 PS_ASSERT_PTR_NON_NULL(fpa, false); 334 338 psTrace("psModules.concepts", 5, "Reading FPA concepts: %p %p\n", conceptsFPA, fpa->concepts); 335 bool success = conceptsRead(&conceptsFPA, fpa, NULL, NULL, &fpa->conceptsRead, source, db, fpa->concepts); 339 bool success = conceptsRead(&conceptsFPA, fpa, NULL, NULL, &fpa->conceptsRead, source, 340 config, fpa->concepts); 336 341 if (propagateDown) { 337 342 psArray *chips = fpa->chips; // Array of chips … … 339 344 pmChip *chip = chips->data[i]; // Chip of interest 340 345 if (chip) { 341 success &= pmConceptsReadChip(chip, source, false, true, db);346 success &= pmConceptsReadChip(chip, source, false, true, config); 342 347 } 343 348 } … … 347 352 } 348 353 349 bool pmConceptsWriteFPA(const pmFPA *fpa, pmConceptSource source, bool propagateDown, p sDB *db)354 bool pmConceptsWriteFPA(const pmFPA *fpa, pmConceptSource source, bool propagateDown, pmConfig *config) 350 355 { 351 356 PS_ASSERT_PTR_NON_NULL(fpa, false); 352 357 psTrace("psModules.concepts", 5, "Writing FPA concepts: %p %p\n", conceptsFPA, fpa->concepts); 353 bool success = conceptsWrite(&conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts);358 bool success = conceptsWrite(&conceptsFPA, fpa, NULL, NULL, source, config, fpa->concepts); 354 359 if (propagateDown) { 355 360 psArray *chips = fpa->chips; // Array of chips … … 357 362 pmChip *chip = chips->data[i]; // Chip of interest 358 363 if (chip && !chip->hdu) { 359 success &= pmConceptsWriteChip(chip, source, false, true, db);364 success &= pmConceptsWriteChip(chip, source, false, true, config); 360 365 } 361 366 } … … 372 377 373 378 bool pmConceptsReadChip(pmChip *chip, pmConceptSource source, bool propagateUp, 374 bool propagateDown, p sDB *db)379 bool propagateDown, pmConfig *config) 375 380 { 376 381 PS_ASSERT_PTR_NON_NULL(chip, false); 377 382 psTrace("psModules.concepts", 5, "Reading chip concepts: %p %p\n", conceptsChip, chip->concepts); 378 383 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 379 bool success = conceptsRead(&conceptsChip, fpa, chip, NULL, &chip->conceptsRead, source, db,384 bool success = conceptsRead(&conceptsChip, fpa, chip, NULL, &chip->conceptsRead, source, config, 380 385 chip->concepts); 381 386 if (propagateUp) { 382 success &= conceptsRead(&conceptsFPA, fpa, chip, NULL, &fpa->conceptsRead, source, db, fpa->concepts); 387 success &= conceptsRead(&conceptsFPA, fpa, chip, NULL, &fpa->conceptsRead, source, 388 config, fpa->concepts); 383 389 } 384 390 if (propagateDown) { … … 387 393 pmCell *cell = cells->data[i]; // Cell of interest 388 394 if (cell) { 389 success &= pmConceptsReadCell(cell, source, false, db);395 success &= pmConceptsReadCell(cell, source, false, config); 390 396 } 391 397 } … … 395 401 396 402 bool pmConceptsWriteChip(const pmChip *chip, pmConceptSource source, bool propagateUp, 397 bool propagateDown, p sDB *db)403 bool propagateDown, pmConfig *config) 398 404 { 399 405 PS_ASSERT_PTR_NON_NULL(chip, false); 400 406 psTrace("psModules.concepts", 5, "Writing chip concepts: %p %p\n", conceptsChip, chip->concepts); 401 407 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 402 bool success = conceptsWrite(&conceptsChip, fpa, chip, NULL, source, db, chip->concepts);408 bool success = conceptsWrite(&conceptsChip, fpa, chip, NULL, source, config, chip->concepts); 403 409 if (propagateUp && !fpa->hdu) { 404 success &= conceptsWrite(&conceptsFPA, fpa, chip, NULL, source, db, fpa->concepts);410 success &= conceptsWrite(&conceptsFPA, fpa, chip, NULL, source, config, fpa->concepts); 405 411 } 406 412 if (propagateDown) { … … 409 415 pmCell *cell = cells->data[i]; // Cell of interest 410 416 if (cell && !cell->hdu) { 411 success &= pmConceptsWriteCell(cell, source, false, db);417 success &= pmConceptsWriteCell(cell, source, false, config); 412 418 } 413 419 } … … 423 429 } 424 430 425 bool pmConceptsReadCell(pmCell *cell, pmConceptSource source, bool propagateUp, p sDB *db)431 bool pmConceptsReadCell(pmCell *cell, pmConceptSource source, bool propagateUp, pmConfig *config) 426 432 { 427 433 PS_ASSERT_PTR_NON_NULL(cell, false); … … 430 436 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 431 437 432 bool success = conceptsRead(&conceptsCell, fpa, chip, cell, &cell->conceptsRead, source, db,438 bool success = conceptsRead(&conceptsCell, fpa, chip, cell, &cell->conceptsRead, source, config, 433 439 cell->concepts); 434 440 if (propagateUp) { 435 success &= conceptsRead(&conceptsChip, fpa, chip, cell, &chip->conceptsRead, source, db,441 success &= conceptsRead(&conceptsChip, fpa, chip, cell, &chip->conceptsRead, source, config, 436 442 chip->concepts); 437 success &= conceptsRead(&conceptsFPA, fpa, chip, cell, &fpa->conceptsRead, source, db,443 success &= conceptsRead(&conceptsFPA, fpa, chip, cell, &fpa->conceptsRead, source, config, 438 444 fpa->concepts); 439 445 } … … 442 448 } 443 449 444 bool pmConceptsWriteCell(const pmCell *cell, pmConceptSource source, bool propagateUp, p sDB *db)450 bool pmConceptsWriteCell(const pmCell *cell, pmConceptSource source, bool propagateUp, pmConfig *config) 445 451 { 446 452 PS_ASSERT_PTR_NON_NULL(cell, false); … … 449 455 pmFPA *fpa = chip->parent; // FPA to which the chip belongs 450 456 451 bool success = conceptsWrite(&conceptsCell, fpa, chip, cell, source, db, cell->concepts);457 bool success = conceptsWrite(&conceptsCell, fpa, chip, cell, source, config, cell->concepts); 452 458 if (propagateUp) { 453 459 if (!chip->hdu) { 454 success &= conceptsWrite(&conceptsChip, fpa, chip, cell, source, db, chip->concepts);460 success &= conceptsWrite(&conceptsChip, fpa, chip, cell, source, config, chip->concepts); 455 461 if (!fpa->hdu) { 456 success &= conceptsWrite(&conceptsFPA, fpa, chip, cell, source, db, fpa->concepts);462 success &= conceptsWrite(&conceptsFPA, fpa, chip, cell, source, config, fpa->concepts); 457 463 } 458 464 } -
trunk/psModules/src/concepts/pmConcepts.h
r17911 r18163 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06- 05 01:31:33$6 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 11 11 #ifndef PM_CONCEPTS_H 12 12 #define PM_CONCEPTS_H 13 14 #include <pmConfig.h> 13 15 14 16 /// @addtogroup Concepts Data Abstraction Concepts … … 105 107 pmCell *cell, ///< Cell for which to read concepts, or NULL 106 108 pmConceptSource source, ///< The source of the concepts to read 107 p sDB *db ///< Database handle109 pmConfig *config ///< Configuration 108 110 ); 109 111 … … 120 122 pmConceptSource source, ///< Source for concepts 121 123 bool propagateDown, ///< Propagate to lower levels? 122 p sDB *db ///< Database handle124 pmConfig *config ///< Configuration 123 125 ); 124 126 … … 130 132 pmConceptSource source, ///< Source for concepts 131 133 bool propagateDown, ///< Propagate to lower levels? 132 p sDB *db ///< Database handle134 pmConfig *config ///< Configuration 133 135 ); 134 136 … … 146 148 bool propagateUp, ///< Propagate to higher levels? 147 149 bool propagateDown, ///< Propagate to lower levels? 148 p sDB *db ///< Database handle150 pmConfig *config ///< Configuration 149 151 ); 150 152 … … 157 159 bool propagateUp,///< Propagate to higher levels? 158 160 bool propagateDown, ///< Propagate to lower levels? 159 p sDB *db ///< Database handle161 pmConfig *config ///< Configuration 160 162 ); 161 163 … … 172 174 pmConceptSource source, ///< Source for concepts 173 175 bool propagateUp, ///< Propagate to higher levels? 174 p sDB *db ///< Database handle176 pmConfig *config ///< Configuration 175 177 ); 176 178 … … 183 185 pmConceptSource source, ///< Source for concepts 184 186 bool propagateUp, ///< Propagate to higher levels? 185 p sDB *db ///< Database handle187 pmConfig *config ///< Configuration 186 188 ); 187 189 -
trunk/psModules/src/concepts/pmConceptsRead.c
r17911 r18163 9 9 #include <pslib.h> 10 10 11 #include "pmConfig.h" 11 12 #include "pmHDU.h" 12 13 #include "pmFPA.h" … … 363 364 } 364 365 365 psMetadataItem *p_pmConceptsReadSingleFromDatabase(const char *name, const psMetadata *database, psDB *db, 366 const pmFPA *fpa, const pmChip *chip, const pmCell *cell) 366 psMetadataItem *p_pmConceptsReadSingleFromDatabase(const char *name, const psMetadata *database, 367 pmConfig *config, const pmFPA *fpa, const pmChip *chip, 368 const pmCell *cell) 367 369 { 368 370 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 369 PS_ASSERT_METADATA_NON_NULL(database, NULL); 371 PS_ASSERT_PTR_NON_NULL(config, NULL); 372 373 psDB *db = pmConfigDB(config); // Database handle 374 if (!db) { 375 psErrorClear(); 376 psWarning("Unable to initialise database to write concepts."); 377 return NULL; 378 } 370 379 371 380 psMetadataItem *item = psMetadataLookup(database, name); // Item to return … … 384 393 385 394 psString sql = pmConceptsInterpolate(item->data.str, fpa, chip, cell); 386 if (!p_psDBRunQuery( db, sql)) {395 if (!p_psDBRunQuery(config->database, sql)) { 387 396 psWarning("Unable to query database for concept %s --- ignored.", name); 388 397 psFree(sql); … … 391 400 psFree(sql); 392 401 393 psArray *rows = p_psDBFetchResult( db); // Rows returned from the query402 psArray *rows = p_psDBFetchResult(config->database); // Rows returned from the query 394 403 if (rows->n == 0) { 395 404 psWarning("No rows returned from database query for concept %s --- ignored.", name); … … 408 417 409 418 bool p_pmConceptsReadFromDatabase(psMetadata *target, const psMetadata *specs, 410 const pmFPA *fpa, const pmChip *chip, const pmCell *cell, p sDB *db)419 const pmFPA *fpa, const pmChip *chip, const pmCell *cell, pmConfig *config) 411 420 { 412 421 PS_ASSERT_PTR_NON_NULL(specs, false); 413 422 PS_ASSERT_PTR_NON_NULL(target, false); 423 PS_ASSERT_PTR_NON_NULL(config, false); 414 424 415 425 #ifndef HAVE_PSDB … … 434 444 pmConceptSpec *spec = specItem->data.V; // The specification 435 445 psString name = specItem->name; // The concept name 436 psMetadataItem *conceptItem = p_pmConceptsReadSingleFromDatabase(name, dbSpec, db, fpa, chip, cell); 446 psMetadataItem *conceptItem = p_pmConceptsReadSingleFromDatabase(name, dbSpec, config, 447 fpa, chip, cell); 437 448 if (conceptItem && !conceptParse(spec, conceptItem, PM_CONCEPT_SOURCE_DATABASE, 438 449 cameraFormat, target, fpa, chip, cell)) { -
trunk/psModules/src/concepts/pmConceptsRead.h
r17911 r18163 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06- 05 01:31:33$6 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 62 62 const char *name, ///< Name of concept 63 63 const psMetadata *database, ///< DATABASE specification 64 p sDB *db, ///< Database handle64 pmConfig *config, ///< Configuration 65 65 const pmFPA *fpa, ///< The FPA 66 66 const pmChip *chip, ///< The chip, or NULL … … 72 72 /// Examines the DATABASE metadata in the camera format file 73 73 /// for concepts in the specs, and imports them into the target. 74 /// WARNING: This function has not been tested; use at your own risk!75 74 bool p_pmConceptsReadFromDatabase(psMetadata *target, // Place into which to read the concepts 76 75 const psMetadata *specs, // The concept specifications … … 78 77 const pmChip *chip, // The chip 79 78 const pmCell *cell, // The cell 80 p sDB *db // The database handle79 pmConfig *config // Configuration 81 80 ); 82 81 /// @} -
trunk/psModules/src/concepts/pmConceptsWrite.c
r17911 r18163 9 9 #include <pslib.h> 10 10 11 #include "pmConfig.h" 11 12 #include "pmHDU.h" 12 13 #include "pmFPA.h" … … 427 428 // XXX Warning: This code has not been tested at all 428 429 bool p_pmConceptsWriteToDatabase(const psMetadata *specs, const pmFPA *fpa, const pmChip *chip, 429 const pmCell *cell, p sDB *db, const psMetadata *concepts)430 const pmCell *cell, pmConfig *config, const psMetadata *concepts) 430 431 { 431 432 PS_ASSERT_PTR_NON_NULL(specs, false); 432 433 PS_ASSERT_PTR_NON_NULL(concepts, false); 433 434 if (!db) { 435 return false; 436 } 434 PS_ASSERT_PTR_NON_NULL(config, false); 437 435 438 436 #ifndef HAVE_PSDB … … 456 454 psString name = specItem->name; // The concept name 457 455 458 psMetadataItem *dbItem = p_pmConceptsReadSingleFromDatabase(name, database, db, fpa, chip, cell);456 psMetadataItem *dbItem = p_pmConceptsReadSingleFromDatabase(name, database, config, fpa, chip, cell); 459 457 if (!dbItem) { 460 458 continue; -
trunk/psModules/src/concepts/pmConceptsWrite.h
r12696 r18163 4 4 * @author Paul Price, IfA 5 5 * 6 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $7 * @date $Date: 200 7-03-30 21:12:56$6 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 9 9 */ … … 55 55 const pmChip *chip, ///< The chip 56 56 const pmCell *cell, ///< The cell 57 p sDB *db,///< The database handle57 pmConfig *config,///< Configuration 58 58 const psMetadata *concepts ///< The concepts 59 59 ); -
trunk/psModules/src/config/pmConfig.c
r18073 r18163 1297 1297 #else 1298 1298 1299 if (config->database) { 1300 return config->database; 1301 } 1302 1299 1303 psBool mdStatus01 = false; 1300 1304 psBool mdStatus02 = false; … … 1322 1326 } 1323 1327 1324 return psDBInit(dbServer, dbUsername, dbPassword, dbName, dbPort); 1328 config->database = psDBInit(dbServer, dbUsername, dbPassword, dbName, dbPort); 1329 return config->database; 1325 1330 #endif 1326 1331 } -
trunk/psModules/src/detrend/pmDark.c
r18132 r18163 25 25 // Look up the value of an ordinate in a readout 26 26 static bool ordinateLookup(float *value, // Value of ordinate, to return 27 bool *inRange, // is value within min : max range?27 bool *inRange, // is value within min : max range? 28 28 const char *name, // Name of ordinate (concept name) 29 29 bool scale, // Scale the value? … … 70 70 if (*value < min || *value > max) { 71 71 psWarning("Value of concept %s (%f) outside range (%f:%f)", name, *value, min, max); 72 *inRange = false;72 *inRange = false; 73 73 } 74 74 *value = 2.0 * (*value - min) / (max - min) - 1.0; … … 175 175 continue; 176 176 } 177 if (!inRange) {177 if (!inRange) { 178 178 roMask->data.U8[j] = 0xff; 179 179 val->data.F32[i] = NAN; … … 282 282 mask->data.PS_TYPE_MASK_DATA[r] = readout->mask->data.PS_TYPE_MASK_DATA[yIn][xIn]; 283 283 } 284 285 } 286 287 // XXX test288 if (0 && (i == 377) && (j == 80)) {289 FILE *f = fopen ("test.dat", "w"); 290 for (int r = 0; r < inputs->n; r++) { 291 fprintf (f, "%d %d %d ", i, j, mask->data.U8[r]);292 psVector *value = values->data[r];293 for (int tmpj = 0; tmpj < value->n; tmpj++) {294 fprintf (f, "%f ", value->data.F32[tmpj]);295 }296 fprintf (f, "%f\n", pixels->data.F32[r]);297 }298 fclose (f);299 }284 285 } 286 287 // XXX test 288 if (0 && (i == 377) && (j == 80)) { 289 FILE *f = fopen ("test.dat", "w"); 290 for (int r = 0; r < inputs->n; r++) { 291 fprintf (f, "%d %d %d ", i, j, mask->data.U8[r]); 292 psVector *value = values->data[r]; 293 for (int tmpj = 0; tmpj < value->n; tmpj++) { 294 fprintf (f, "%f ", value->data.F32[tmpj]); 295 } 296 fprintf (f, "%f\n", pixels->data.F32[r]); 297 } 298 fclose (f); 299 } 300 300 301 301 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, maskVal, values, iter, rej)) { … … 426 426 } 427 427 428 bool pmFPAWriteDark(pmFPA *fpa, psFits *fits, p sDB *db, bool blank, bool recurse)428 bool pmFPAWriteDark(pmFPA *fpa, psFits *fits, pmConfig *config, bool blank, bool recurse) 429 429 { 430 430 PS_ASSERT_PTR_NON_NULL(fpa, false); 431 431 PS_ASSERT_FITS_NON_NULL(fits, false); 432 432 433 if (!pmFPAWrite(fpa, fits, db, blank, recurse)) {433 if (!pmFPAWrite(fpa, fits, config, blank, recurse)) { 434 434 psError(PS_ERR_IO, false, "Unable to write FPA dark images"); 435 435 return false; … … 481 481 } 482 482 483 bool pmChipWriteDark(pmChip *chip, psFits *fits, p sDB *db, bool blank, bool recurse)483 bool pmChipWriteDark(pmChip *chip, psFits *fits, pmConfig *config, bool blank, bool recurse) 484 484 { 485 485 PS_ASSERT_PTR_NON_NULL(chip, false); 486 486 PS_ASSERT_FITS_NON_NULL(fits, false); 487 487 488 if (!pmChipWrite(chip, fits, db, blank, recurse)) {488 if (!pmChipWrite(chip, fits, config, blank, recurse)) { 489 489 psError(PS_ERR_IO, false, "Unable to write chip dark images"); 490 490 return false; … … 532 532 } 533 533 534 bool pmCellWriteDark(pmCell *cell, psFits *fits, p sDB *db, bool blank)534 bool pmCellWriteDark(pmCell *cell, psFits *fits, pmConfig *config, bool blank) 535 535 { 536 536 PS_ASSERT_PTR_NON_NULL(cell, false); … … 538 538 539 539 // Allow the usual pmFPAWrite functions to handle the heavy lifting for the images 540 if (!pmCellWrite(cell, fits, db, blank)) {540 if (!pmCellWrite(cell, fits, config, blank)) { 541 541 psError(PS_ERR_UNKNOWN, false, "Unable to write dark cell."); 542 542 return false; … … 623 623 624 624 625 bool pmFPAReadDark(pmFPA *fpa, psFits *fits, p sDB *db)625 bool pmFPAReadDark(pmFPA *fpa, psFits *fits, pmConfig *config) 626 626 { 627 627 PS_ASSERT_PTR_NON_NULL(fpa, false); 628 628 PS_ASSERT_FITS_NON_NULL(fits, false); 629 629 630 if (!pmFPARead(fpa, fits, db)) {630 if (!pmFPARead(fpa, fits, config)) { 631 631 psError(PS_ERR_UNKNOWN, false, "Unable to read dark FPA."); 632 632 return false; … … 658 658 } 659 659 660 bool pmChipReadDark(pmChip *chip, psFits *fits, p sDB *db)660 bool pmChipReadDark(pmChip *chip, psFits *fits, pmConfig *config) 661 661 { 662 662 PS_ASSERT_PTR_NON_NULL(chip, false); 663 663 PS_ASSERT_FITS_NON_NULL(fits, false); 664 664 665 if (!pmChipRead(chip, fits, db)) {665 if (!pmChipRead(chip, fits, config)) { 666 666 psError(PS_ERR_UNKNOWN, false, "Unable to read dark chip."); 667 667 return false; … … 690 690 691 691 692 bool pmCellReadDark(pmCell *cell, psFits *fits, p sDB *db)692 bool pmCellReadDark(pmCell *cell, psFits *fits, pmConfig *config) 693 693 { 694 694 PS_ASSERT_PTR_NON_NULL(cell, false); … … 696 696 697 697 // Allow the usual pmFPARead functions to handle the heavy lifting for the images 698 if (!pmCellRead(cell, fits, db)) {698 if (!pmCellRead(cell, fits, config)) { 699 699 psError(PS_ERR_UNKNOWN, false, "Unable to read dark cell."); 700 700 return false; -
trunk/psModules/src/detrend/pmDark.h
r16949 r18163 5 5 #include <pmHDU.h> 6 6 #include <pmFPA.h> 7 #include <pmConfig.h> 7 8 8 9 #define PM_DARK_ANALYSIS_ORDINATES "DARK.ORDINATES" // Name for dark ordinates in the cell analysis metadata … … 45 46 bool pmFPAWriteDark(pmFPA *fpa, // FPA to write 46 47 psFits *fits, // FITS file to which to write 47 p sDB *db, // Database, for concepts48 pmConfig *config, // Configuration 48 49 bool blank, // Write a blank only? 49 50 bool recurse // Recurse to lower levels? … … 53 54 bool pmChipWriteDark(pmChip *chip, // Chip to write 54 55 psFits *fits, // FITS file to which to write 55 p sDB *db, // Database, for concepts56 pmConfig *config, // Configuration 56 57 bool blank, // Write a blank only? 57 58 bool recurse // Recurse to lower levels? … … 61 62 bool pmCellWriteDark(pmCell *cell, // Cell containing dark information 62 63 psFits *fits, // FITS file to which to write 63 p sDB *db, // Database, for concepts64 pmConfig *config, // Configuration 64 65 bool blank // Write a blank only? 65 66 ); … … 68 69 bool pmFPAReadDark(pmFPA *fpa, // FPA for which to read 69 70 psFits *fits, // FITS file to read 70 p sDB *db // Database, for concepts71 pmConfig *config // Configuration 71 72 ); 72 73 … … 74 75 bool pmChipReadDark(pmChip *chip, // Chip for which to read 75 76 psFits *fits, // FITS file to read 76 p sDB *db // Database, for concepts77 pmConfig *config // Configuration 77 78 ); 78 79 … … 80 81 bool pmCellReadDark(pmCell *cell, // Cell for which to read 81 82 psFits *fits, // FITS file to read 82 p sDB *db // Database, for concepts83 pmConfig *config // Configuration 83 84 ); 84 85 -
trunk/psModules/src/imcombine/pmSubtraction.c
r18043 r18163 4 4 * @author GLG, MHPCC 5 5 * 6 * @version $Revision: 1.9 3$ $Name: not supported by cvs2svn $7 * @date $Date: 2008-06-1 0 02:43:01$6 * @version $Revision: 1.94 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2008-06-17 22:16:38 $ 8 8 * 9 9 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 627 627 } 628 628 629 630 float pmSubtractionVarianceFactor(const pmSubtractionKernels *kernels, float x, float y, bool wantDual) 631 { 632 PM_ASSERT_SUBTRACTION_KERNELS_NON_NULL(kernels, NAN); 633 PM_ASSERT_SUBTRACTION_KERNELS_SOLUTION(kernels, NAN); 634 PS_ASSERT_FLOAT_WITHIN_RANGE(x, -1.0, 1.0, NAN); 635 PS_ASSERT_FLOAT_WITHIN_RANGE(y, -1.0, 1.0, NAN); 636 637 // Precalulate polynomial values 638 psImage *polyValues = p_pmSubtractionPolynomial(NULL, kernels->spatialOrder, x, y); 639 640 psKernel *kernel = solvedKernel(NULL, kernels, polyValues, wantDual); // The appropriate kernel 641 psFree(polyValues); 642 643 double sumKernel2 = 0.0; // Sum of the kernel squared 644 for (int y = kernel->yMin; y <= kernel->yMax; y++) { 645 for (int x = kernel->xMin; x <= kernel->xMax; x++) { 646 sumKernel2 += PS_SQR(kernel->kernel[y][x]); 647 } 648 } 649 650 psFree(kernel); 651 652 return sumKernel2; 653 } 654 629 655 #if 0 630 656 psArray *pmSubtractionKernelSolutions(const pmSubtractionKernels *kernels, float x, float y, bool wantDual)
Note:
See TracChangeset
for help on using the changeset viewer.
