Changeset 23352 for branches/cnb_branches/cnb_branch_20090301/pswarp/src
- Timestamp:
- Mar 17, 2009, 12:08:50 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 8 edited
-
. (modified) (1 prop)
-
pswarp/src/Makefile.am (modified) (2 diffs)
-
pswarp/src/pswarp.c (modified) (1 diff)
-
pswarp/src/pswarp.h (modified) (1 diff)
-
pswarp/src/pswarpArguments.c (modified) (4 diffs)
-
pswarp/src/pswarpLoop.c (modified) (4 diffs)
-
pswarp/src/pswarpParseCamera.c (modified) (5 diffs)
-
pswarp/src/pswarpVersion.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk merged eligible /branches/eam_branches/eam_branch_20090303 23158-23228
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/cnb_branches/cnb_branch_20090301/pswarp/src/Makefile.am
r18839 r23352 1 1 bin_PROGRAMS = pswarp 2 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) 2 3 PSWARP_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PSWARP_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 PSWARP_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of pswarpVersion.c, since it gets the version information 8 pswarpVersion.c: FORCE 9 touch pswarpVersion.c 10 FORCE: ; 11 12 pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) -DPSWARP_VERSION=\"$(PSWARP_VERSION)\" -DPSWARP_BRANCH=\"$(PSWARP_BRANCH)\" -DPSWARP_SOURCE=\"$(PSWARP_SOURCE)\" 3 13 pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS) 4 14 … … 18 28 pswarpSetThreads.c \ 19 29 pswarpTransformReadout.c \ 20 pswarpTransformSources.c \30 pswarpTransformSources.c \ 21 31 pswarpTransformTile.c \ 22 32 pswarpVersion.c -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarp.c
r21442 r23352 39 39 if (!config) usage(); 40 40 41 pswarpVersionPrint(); 42 41 43 // load identify the data sources 42 44 if (!pswarpParseCamera(config)) { -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarp.h
r21368 r23352 112 112 */ 113 113 bool pswarpSetThreads (); 114 115 /// Return software version 116 psString pswarpVersion(void); 117 118 /// Return software souce 119 psString pswarpSource(void); 120 121 /// Return long software version information 122 psString pswarpVersionLong(void); 123 124 /// Populate header with version information 125 bool pswarpVersionHeader( 126 psMetadata *header ///< Header to populate 127 ); 128 129 /// Print version information 130 void pswarpVersionPrint(void); -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpArguments.c
r21368 r23352 41 41 if ((arg = psArgumentGet(argc, argv, "-psphot-visual"))) { 42 42 psArgumentRemove(arg, &argc, argv); 43 p sphotSetVisual(true);43 pmVisualSetVisual(true); 44 44 } 45 45 } … … 87 87 88 88 89 if (!pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list")) { 90 psError(PSWARP_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)"); 91 return NULL; 92 } 93 94 // the mask and variance entries are optional (build from gain?) 95 pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist"); 89 pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list"); 90 pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist"); 96 91 pmConfigFileSetsMD (config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist"); 97 92 … … 105 100 106 101 // output position is fixed 107 psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);102 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]); 108 103 109 104 // skycell position is fixed 110 105 array = psArrayAlloc(1); 111 array->data[0] = psStringCopy (argv[2]);112 status = psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array);113 psFree (array);106 array->data[0] = psStringCopy(argv[2]); 107 status = psMetadataAddPtr(config->arguments, PS_LIST_TAIL, "SKYCELL", PS_DATA_ARRAY, "", array); 108 psFree(array); 114 109 115 110 psTrace("pswarp", 1, "Done with pswarpArguments...\n"); 116 return (config);111 return config; 117 112 } 118 113 … … 204 199 psTrace("pswarp", 1, "Done with pswarpArguments...\n"); 205 200 206 // Dump configuration, now that's it's settled207 psString dump_file = psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG");208 if (dump_file) {209 const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,210 "SKYCELL.CAMERA"); ///< Name of camera for skycell211 pmConfigCamerasCull(config, skyCamera);212 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS");213 214 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file215 pmConfigDump(config, input->fpa, dump_file);216 }217 218 201 return (config); 219 202 } -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpLoop.c
r21468 r23352 76 76 bool status; 77 77 78 const char *skyCamera = psMetadataLookupStr(NULL, config->arguments, 79 "SKYCELL.CAMERA"); ///< Name of camera for skycell 80 pmConfigCamerasCull(config, skyCamera); 81 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,MASKS,JPEG"); 82 83 78 84 // load the recipe 79 85 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE); … … 81 87 psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE); 82 88 return false; 89 } 90 91 if (!pswarpSetMaskBits(config)) { 92 psError(PS_ERR_IO, false, "failed to set mask bits"); 93 return NULL; 83 94 } 84 95 … … 339 350 } 340 351 352 pswarpVersionHeader(hdu->header); 353 341 354 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) { 342 355 psError(PS_ERR_UNKNOWN, false, "Unable to generate WCS header."); … … 455 468 } 456 469 470 // Dump configuration 471 psString dump_file = psMetadataLookupStr(&status, config->arguments, "DUMP_CONFIG"); 472 if (dump_file) { 473 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT"); // Input file 474 pmConfigDump(config, input->fpa, dump_file); 475 } 476 457 477 return true; 458 478 } -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpParseCamera.c
r21368 r23352 11 11 */ 12 12 13 # include "pswarp.h" 13 #include "pswarp.h" 14 15 // Define an input file 16 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration 17 pmFPAfile *bind, // File to which to bind, or NULL 18 char *filerule, // Name of file rule 19 char *argname, // Argument name 20 pmFPAfileType fileType // Type of file 21 ) 22 { 23 bool status; 24 25 // look for the file on the RUN metadata 26 pmFPAfile *file = pmFPAfileDefineFromRun(&status, config, filerule); // File to return 27 if (!status) { 28 psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule); 29 return NULL; 30 } 31 if (!file) { 32 // look for the file on the argument list 33 if (bind) { 34 file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname); 35 } else { 36 file = pmFPAfileDefineFromArgs(&status, config, filerule, argname); 37 } 38 if (!status) { 39 psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule); 40 return false; 41 } 42 } 43 44 if (!file) { 45 return NULL; 46 } 47 48 if (file->type != fileType) { 49 psError(PSWARP_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType)); 50 return NULL; 51 } 52 53 return file; 54 } 55 56 57 14 58 15 59 bool pswarpParseCamera(pmConfig *config) 16 60 { 17 bool status; 18 bool mdok; ///< Status of MD lookup 19 pmFPAfile *skycell = NULL; 20 pmConfig *skyConfig = NULL; 61 psAssert(config, "Require configuration"); 21 62 22 // the input image(s) are required arguments; they define the camera 23 status = false; 24 pmFPAfile *input = pmFPAfileDefineFromArgs(&status, config, "PSWARP.INPUT", "INPUT"); 25 if (!input || !status) { 63 // The input image(s) is required: it defines the camera 64 pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE); 65 if (!input) { 26 66 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT"); 27 67 return false; 28 68 } 29 69 30 // the input image(s) are required arguments; they define the camera 31 status = false; 32 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 33 if (!status) { 34 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 35 return NULL; 36 } 37 if (astrom) { 38 psLogMsg ("pswarp", 3, "using supplied astrometry\n"); 39 } else { 40 psLogMsg ("pswarp", 3, "using header astrometry\n"); 70 pmFPAfile *astrom = defineInputFile(config, NULL, "PSWARP.ASTROM", "ASTROM", PM_FPA_FILE_CMF); 71 psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header"); 72 73 pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK); 74 if (!inMask) { 75 psLogMsg("pswarp", PS_LOG_INFO, "No mask supplied"); 41 76 } 42 77 43 // the mask is not required - but must conform to input camera 44 pmFPAfile *inMask = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.MASK", "MASK"); 45 if (!status) { 46 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 47 return NULL; 48 } 49 if (!inMask) { 50 psLogMsg ("pswarp", 3, "no mask supplied\n"); 78 pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE", 79 PM_FPA_FILE_VARIANCE); 80 if (!inVariance) { 81 psLogMsg("pswarp", PS_LOG_INFO, "No variance supplied"); 51 82 } 52 83 53 // loading the mask here should have invoked pmConfigMaskReadHeader() 54 if (!pswarpSetMaskBits (config)) { 55 psError(PS_ERR_IO, false, "failed to set mask bits"); 56 return NULL; 57 } 58 59 pmFPAfile *inVariance = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.VARIANCE", "VARIANCE"); 60 if (!status) { 61 psError (PS_ERR_UNKNOWN, false, "failed to load find definition"); 62 return NULL; 63 } 64 if (!inVariance) { 65 psLogMsg ("pswarp", 3, "no variance supplied\n"); 66 } 67 68 // the input skycell is a required argument: it defines the output image 84 // The input skycell is a required argument: it defines the output image 69 85 // XXX we may need a different skycell structure here 70 status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 86 pmFPAfile *skycell = NULL; 87 pmConfig *skyConfig = NULL; 88 bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 71 89 if (!status) { 72 90 psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL"); … … 81 99 return false; 82 100 } 101 output->save = true; 102 83 103 pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK"); 84 104 if (!outMask) { … … 86 106 return false; 87 107 } 88 89 output->save = true;90 108 outMask->save = true; 91 109 … … 108 126 } 109 127 128 bool mdok; // Status of MD lookup 110 129 if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) { 111 130 // This file, PSPHOT.INPUT, is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by … … 160 179 } 161 180 } 162 psFree (chips);181 psFree(chips); 163 182 } 164 183 -
branches/cnb_branches/cnb_branch_20090301/pswarp/src/pswarpVersion.c
r21323 r23352 18 18 #include <pslib.h> 19 19 #include <psmodules.h> 20 #include <psphot.h> 21 #include <ppStats.h> 20 22 #include "pswarp.h" 21 23 22 static const char *cvsTag = "$Name: not supported by cvs2svn $";///< CVS tag name23 24 24 25 psString pswarpVersion(void) 25 26 { 26 psString version = NULL; ///< Version, to return 27 psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION); 28 return version; 27 #ifndef PSWARP_VERSION 28 #error "PSWARP_VERSION is not set" 29 #endif 30 #ifndef PSWARP_BRANCH 31 #error "PSWARP_BRANCH is not set" 32 #endif 33 return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION); 34 } 35 36 psString pswarpSource(void) 37 { 38 #ifndef PSWARP_SOURCE 39 #error "PSWARP_SOURCE is not set" 40 #endif 41 return psStringCopy(PSWARP_SOURCE); 29 42 } 30 43 31 44 psString pswarpVersionLong(void) 32 45 { 33 psString version = pswarpVersion(); ///< Version, to return 34 psString tag = psStringStripCVS(cvsTag, "Name"); ///< CVS tag 35 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 36 psFree(tag); 46 psString version = pswarpVersion(); // Version, to return 47 psString source = pswarpSource(); // Source 48 49 psStringPrepend(&version, "pswarp "); 50 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 51 psFree(source); 52 53 #ifdef __OPTIMIZE__ 54 psStringAppend(&version, " optimised"); 55 #else 56 psStringAppend(&version, " unoptimised"); 57 #endif 58 37 59 return version; 60 }; 61 62 63 bool pswarpVersionHeader(psMetadata *header) 64 { 65 PS_ASSERT_METADATA_NON_NULL(header, false); 66 67 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 68 psString timeString = psTimeToISO(time); // The time in an ISO string 69 psFree(time); 70 psString history = NULL; // History string 71 psStringAppend(&history, "pswarp at %s", timeString); 72 psFree(timeString); 73 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history); 74 psFree(history); 75 76 psLibVersionHeader(header); 77 psModulesVersionHeader(header); 78 psphotVersionHeader(header); 79 ppStatsVersionHeader(header); 80 81 psString version = pswarpVersion(); // Software version 82 psString source = pswarpSource(); // Software source 83 84 psStringPrepend(&version, "pswarp version: "); 85 psStringPrepend(&source, "pswarp source: "); 86 87 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version); 88 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source); 89 90 psFree(version); 91 psFree(source); 92 93 return true; 38 94 } 39 95 96 void pswarpVersionPrint(void) 97 { 98 psTime *time = psTimeGetNow(PS_TIME_TAI); // The time now 99 psString timeString = psTimeToISO(time); // The time in an ISO string 100 psFree(time); 101 psLogMsg("pswarp", PS_LOG_INFO, "pswarp at %s", timeString); 102 psFree(timeString); 103 104 psString pslib = psLibVersionLong();// psLib version 105 psString psmodules = psModulesVersionLong(); // psModules version 106 psString psphot = psphotVersionLong(); // psphot version 107 psString ppStats = ppStatsVersionLong(); // ppStats version 108 psString pswarp = pswarpVersionLong(); // pswarp version 109 110 psLogMsg("pswarp", PS_LOG_INFO, "%s", pslib); 111 psLogMsg("pswarp", PS_LOG_INFO, "%s", psmodules); 112 psLogMsg("pswarp", PS_LOG_INFO, "%s", psphot); 113 psLogMsg("pswarp", PS_LOG_INFO, "%s", ppStats); 114 psLogMsg("pswarp", PS_LOG_INFO, "%s", pswarp); 115 116 psFree(pslib); 117 psFree(psmodules); 118 psFree(psphot); 119 psFree(ppStats); 120 psFree(pswarp); 121 122 return; 123 }
Note:
See TracChangeset
for help on using the changeset viewer.
