Changeset 25158
- Timestamp:
- Aug 20, 2009, 12:42:13 PM (17 years ago)
- Location:
- branches/czw_branch/cleanup
- Files:
-
- 2 deleted
- 48 edited
-
. (modified) (1 prop)
-
Ohana/src/opihi/dvo/dbExtractMeasures.c (modified) (1 diff)
-
Ohana/src/opihi/dvo/dbFields.c (modified) (3 diffs)
-
Ohana/src/opihi/dvo/dbStackOps.c (modified) (1 diff)
-
Ohana/src/opihi/include/dvoshell.h (modified) (1 diff)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm (modified) (5 diffs)
-
doc/misc/docgen.pl (modified) (1 prop)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (1 prop)
-
ippScripts/scripts/publish_file.pl (modified) (5 diffs)
-
ippTasks/pstamp.pro (modified) (2 diffs)
-
ippTests/tap/mailTestResults.pl (modified) (1 diff)
-
ippTests/tap/proveParser.pl (modified) (1 diff)
-
ippTests/tap/tapTest.pl (modified) (2 diffs)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/difftool_skyfile.sql (modified) (1 diff)
-
ippTools/share/pstamptool_addjob_otherjob.sql (deleted)
-
ippTools/share/pstamptool_addjob_stampjob.sql (deleted)
-
ippTools/src/difftool.c (modified) (2 diffs)
-
ippTools/src/pstamptool.c (modified) (2 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (2 diffs)
-
magic/Makefile.in (modified) (1 diff)
-
magic/censorObjects/src/censorLoop.c (modified) (4 diffs)
-
magic/remove/src/Line.c (modified) (23 diffs)
-
magic/remove/src/Makefile.simple (modified) (1 diff)
-
magic/remove/src/isdestreaked.c (modified) (2 diffs)
-
magic/remove/src/streaksastrom.c (modified) (9 diffs)
-
magic/remove/src/streakscompare.c (modified) (4 diffs)
-
magic/remove/src/streaksextern.h (modified) (1 diff)
-
magic/remove/src/streaksio.c (modified) (8 diffs)
-
magic/remove/src/streaksrelease.c (modified) (5 diffs)
-
magic/remove/src/streaksremove.c (modified) (12 diffs)
-
magic/remove/src/streaksremove.h (modified) (1 diff)
-
magic/remove/src/streaksreplace.c (modified) (4 diffs)
-
magic/remove/src/streaksutil.c (modified) (1 diff)
-
magic/remove/src/warpedpixels.c (modified) (11 diffs)
-
ppMops/src/ppMops.c (modified) (4 diffs)
-
ppMops/src/ppMops.h (modified) (1 diff)
-
ppMops/src/ppMopsData.c (modified) (2 diffs)
-
ppStack/src/ppStackCombineFinal.c (modified) (1 diff)
-
psLib/src/fits/psFitsHeader.c (modified) (13 diffs)
-
psModules/src/imcombine/pmSubtractionAnalysis.c (modified) (1 diff)
-
psModules/src/imcombine/pmSubtractionAnalysis.h (modified) (1 diff)
-
psModules/src/imcombine/pmSubtractionMatch.c (modified) (13 diffs)
-
pstamp/scripts/pstamp_finish.pl (modified) (7 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (8 diffs)
-
pstamp/src/pstamp.h (modified) (3 diffs)
-
pstamp/src/pstampdump.c (modified) (4 diffs)
-
tools/diff_outputs.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/cleanup
- Property svn:mergeinfo changed
/trunk merged: 25052-25060,25063-25068,25070-25084,25087,25156
- Property svn:mergeinfo changed
-
branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbExtractMeasures.c
r25051 r25158 296 296 value.Flt = pow (10.0, measure[0].dt * 0.4); 297 297 break; 298 case MEAS_PHOTCODE : /* OK */299 value.Int = measure[0].photcode;298 case MEAS_PHOTCODE_EQUIV: /* OK */ 299 value.Int = GetPhotcodeEquivCodebyCode (measure[0].photcode); 300 300 break; 301 301 case MEAS_TIME: /* OK */ -
branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbFields.c
r25051 r25158 11 11 if (fields[i].photcode != NULL) { 12 12 if (fields[i].photcode[0].type == PHOT_MAG) { 13 free (fields[i].photcode);13 free (fields[i].photcode); 14 14 } 15 15 } … … 30 30 int GetMagMode (char *string) { 31 31 32 if (!strcasecmp (string, "inst")) return (MAG_INST);33 if (!strcasecmp (string, "cat")) return (MAG_CAT);34 if (!strcasecmp (string, "sys")) return (MAG_SYS);35 if (!strcasecmp (string, "rel")) return (MAG_REL);36 if (!strcasecmp (string, "cal")) return (MAG_CAL);37 if (!strcasecmp (string, "ave")) return (MAG_AVE);38 if (!strcasecmp (string, "ref")) return (MAG_REF);39 if (!strcasecmp (string, "ap")) return (MAG_APER);40 if (!strcasecmp (string, "aper")) return (MAG_APER);41 if (!strcasecmp (string, "err")) return (MAG_ERR);32 if (!strcasecmp (string, "inst")) return (MAG_INST); 33 if (!strcasecmp (string, "cat")) return (MAG_CAT); 34 if (!strcasecmp (string, "sys")) return (MAG_SYS); 35 if (!strcasecmp (string, "rel")) return (MAG_REL); 36 if (!strcasecmp (string, "cal")) return (MAG_CAL); 37 if (!strcasecmp (string, "ave")) return (MAG_AVE); 38 if (!strcasecmp (string, "ref")) return (MAG_REF); 39 if (!strcasecmp (string, "ap")) return (MAG_APER); 40 if (!strcasecmp (string, "aper")) return (MAG_APER); 41 if (!strcasecmp (string, "err")) return (MAG_ERR); 42 42 if (!strcasecmp (string, "photflags")) return (MAG_PHOT_FLAGS); 43 if (!strcasecmp (string, "chisq")) return (MAG_CHISQ);44 if (!strcasecmp (string, "ncode")) return (MAG_NCODE);45 if (!strcasecmp (string, "nphot")) return (MAG_NPHOT);43 if (!strcasecmp (string, "chisq")) return (MAG_CHISQ); 44 if (!strcasecmp (string, "ncode")) return (MAG_NCODE); 45 if (!strcasecmp (string, "nphot")) return (MAG_NPHOT); 46 46 return (MAG_NONE); 47 47 } … … 140 140 } 141 141 142 if (!strcasecmp (fieldName, "RA")) ESCAPE (MEAS_RA, MAG_NONE, OPIHI_FLT); 143 if (!strcasecmp (fieldName, "DEC")) ESCAPE (MEAS_DEC, MAG_NONE, OPIHI_FLT); 144 if (!strcasecmp (fieldName, "RA:AVE")) ESCAPE (MEAS_RA_AVE, MAG_NONE, OPIHI_FLT); 145 if (!strcasecmp (fieldName, "DEC:AVE")) ESCAPE (MEAS_DEC_AVE, MAG_NONE, OPIHI_FLT); 146 if (!strcasecmp (fieldName, "RA:ERR")) ESCAPE (MEAS_RA_AVE_ERR, MAG_NONE, OPIHI_FLT); 147 if (!strcasecmp (fieldName, "DEC:ERR")) ESCAPE (MEAS_DEC_AVE_ERR, MAG_NONE, OPIHI_FLT); 148 if (!strcasecmp (fieldName, "uRA")) ESCAPE (MEAS_U_RA, MAG_NONE, OPIHI_FLT); 149 if (!strcasecmp (fieldName, "uDEC")) ESCAPE (MEAS_U_DEC, MAG_NONE, OPIHI_FLT); 150 if (!strcasecmp (fieldName, "duRA")) ESCAPE (MEAS_U_RA_ERR, MAG_NONE, OPIHI_FLT); 151 if (!strcasecmp (fieldName, "duDEC")) ESCAPE (MEAS_U_DEC_ERR, MAG_NONE, OPIHI_FLT); 152 if (!strcasecmp (fieldName, "PAR")) ESCAPE (MEAS_PAR, MAG_NONE, OPIHI_FLT); 153 if (!strcasecmp (fieldName, "dPAR")) ESCAPE (MEAS_PAR_ERR, MAG_NONE, OPIHI_FLT); 154 if (!strcasecmp (fieldName, "dR")) ESCAPE (MEAS_RA_OFFSET, MAG_NONE, OPIHI_FLT); 155 if (!strcasecmp (fieldName, "dD")) ESCAPE (MEAS_DEC_OFFSET, MAG_NONE, OPIHI_FLT); 156 if (!strcasecmp (fieldName, "dR:FIT")) ESCAPE (MEAS_RA_FIT_OFFSET, MAG_NONE, OPIHI_FLT); 157 if (!strcasecmp (fieldName, "dD:FIT")) ESCAPE (MEAS_DEC_FIT_OFFSET, MAG_NONE, OPIHI_FLT); 158 if (!strcasecmp (fieldName, "dR:ERR")) ESCAPE (MEAS_RA_OFFSET_ERR, MAG_NONE, OPIHI_FLT); 159 if (!strcasecmp (fieldName, "dD:ERR")) ESCAPE (MEAS_DEC_OFFSET_ERR, MAG_NONE, OPIHI_FLT); 160 if (!strcasecmp (fieldName, "xp")) ESCAPE (MEAS_XP, MAG_NONE, OPIHI_FLT); 161 if (!strcasecmp (fieldName, "nmeas")) ESCAPE (MEAS_NMEAS, MAG_NONE, OPIHI_INT); 162 if (!strcasecmp (fieldName, "nmiss")) ESCAPE (MEAS_NMISS, MAG_NONE, OPIHI_INT); 163 if (!strcasecmp (fieldName, "objflags")) ESCAPE (MEAS_OBJFLAGS, MAG_NONE, OPIHI_INT); 164 if (!strcasecmp (fieldName, "AIRMASS")) ESCAPE (MEAS_AIRMASS, MAG_NONE, OPIHI_FLT); 165 if (!strcasecmp (fieldName, "ALT")) ESCAPE (MEAS_ALT, MAG_NONE, OPIHI_FLT); 166 if (!strcasecmp (fieldName, "AZ")) ESCAPE (MEAS_AZ, MAG_NONE, OPIHI_FLT); 167 if (!strcasecmp (fieldName, "EXPTIME")) ESCAPE (MEAS_EXPTIME, MAG_NONE, OPIHI_FLT); 168 if (!strcasecmp (fieldName, "PHOTCODE")) ESCAPE (MEAS_PHOTCODE, MAG_NONE, OPIHI_INT); 169 if (!strcasecmp (fieldName, "TIME")) ESCAPE (MEAS_TIME, MAG_NONE, OPIHI_FLT); 170 if (!strcasecmp (fieldName, "FWHM")) ESCAPE (MEAS_FWHM, MAG_NONE, OPIHI_FLT); 171 if (!strcasecmp (fieldName, "FWHM_MAJ")) ESCAPE (MEAS_FWHM_MAJ, MAG_NONE, OPIHI_FLT); 172 if (!strcasecmp (fieldName, "FWHM_MIN")) ESCAPE (MEAS_FWHM_MIN, MAG_NONE, OPIHI_FLT); 173 if (!strcasecmp (fieldName, "THETA")) ESCAPE (MEAS_THETA, MAG_NONE, OPIHI_FLT); 174 if (!strcasecmp (fieldName, "DOPHOT")) ESCAPE (MEAS_DOPHOT, MAG_NONE, OPIHI_INT); 175 if (!strcasecmp (fieldName, "DB_FLAGS")) ESCAPE (MEAS_DB_FLAGS, MAG_NONE, OPIHI_INT); 176 if (!strcasecmp (fieldName, "PHOT_FLAGS")) ESCAPE (MEAS_PHOT_FLAGS, MAG_NONE, OPIHI_INT); 177 if (!strcasecmp (fieldName, "XCCD")) ESCAPE (MEAS_XCCD, MAG_NONE, OPIHI_FLT); 178 if (!strcasecmp (fieldName, "YCCD")) ESCAPE (MEAS_YCCD, MAG_NONE, OPIHI_FLT); 179 if (!strcasecmp (fieldName, "XCCD:ERR")) ESCAPE (MEAS_XCCD_ERR, MAG_NONE, OPIHI_FLT); 180 if (!strcasecmp (fieldName, "YCCD:ERR")) ESCAPE (MEAS_YCCD_ERR, MAG_NONE, OPIHI_FLT); 181 if (!strcasecmp (fieldName, "XMOSAIC")) ESCAPE (MEAS_XMOSAIC, MAG_NONE, OPIHI_FLT); 182 if (!strcasecmp (fieldName, "YMOSAIC")) ESCAPE (MEAS_YMOSAIC, MAG_NONE, OPIHI_FLT); 183 if (!strcasecmp (fieldName, "XCHIP")) ESCAPE (MEAS_XCCD, MAG_NONE, OPIHI_FLT); 184 if (!strcasecmp (fieldName, "YCHIP")) ESCAPE (MEAS_YCCD, MAG_NONE, OPIHI_FLT); 185 if (!strcasecmp (fieldName, "XFPA")) ESCAPE (MEAS_XMOSAIC, MAG_NONE, OPIHI_FLT); 186 if (!strcasecmp (fieldName, "YFPA")) ESCAPE (MEAS_YMOSAIC, MAG_NONE, OPIHI_FLT); 187 if (!strcasecmp (fieldName, "DETID")) ESCAPE (MEAS_DET_ID, MAG_NONE, OPIHI_INT); 188 if (!strcasecmp (fieldName, "OBJID")) ESCAPE (MEAS_OBJ_ID, MAG_NONE, OPIHI_INT); 189 if (!strcasecmp (fieldName, "CATID")) ESCAPE (MEAS_CAT_ID, MAG_NONE, OPIHI_INT); 190 if (!strcasecmp (fieldName, "IMAGEID")) ESCAPE (MEAS_IMAGE_ID, MAG_NONE, OPIHI_INT); 191 if (!strcasecmp (fieldName, "PSF_QF")) ESCAPE (MEAS_PSF_QF, MAG_NONE, OPIHI_FLT); 192 if (!strcasecmp (fieldName, "PSF_CHISQ")) ESCAPE (MEAS_PSF_CHISQ, MAG_NONE, OPIHI_FLT); 193 if (!strcasecmp (fieldName, "CR_NSIGMA")) ESCAPE (MEAS_CR_NSIGMA, MAG_NONE, OPIHI_FLT); 194 if (!strcasecmp (fieldName, "EXT_NSIGMA")) ESCAPE (MEAS_EXT_NSIGMA, MAG_NONE, OPIHI_FLT); 195 if (!strcasecmp (fieldName, "SKY")) ESCAPE (MEAS_SKY, MAG_NONE, OPIHI_FLT); 196 if (!strcasecmp (fieldName, "SKY_ERR")) ESCAPE (MEAS_dSKY, MAG_NONE, OPIHI_FLT); 142 if (!strcasecmp (fieldName, "RA")) ESCAPE (MEAS_RA, MAG_NONE, OPIHI_FLT); 143 if (!strcasecmp (fieldName, "DEC")) ESCAPE (MEAS_DEC, MAG_NONE, OPIHI_FLT); 144 if (!strcasecmp (fieldName, "RA:AVE")) ESCAPE (MEAS_RA_AVE, MAG_NONE, OPIHI_FLT); 145 if (!strcasecmp (fieldName, "DEC:AVE")) ESCAPE (MEAS_DEC_AVE, MAG_NONE, OPIHI_FLT); 146 if (!strcasecmp (fieldName, "RA:ERR")) ESCAPE (MEAS_RA_AVE_ERR, MAG_NONE, OPIHI_FLT); 147 if (!strcasecmp (fieldName, "DEC:ERR")) ESCAPE (MEAS_DEC_AVE_ERR, MAG_NONE, OPIHI_FLT); 148 if (!strcasecmp (fieldName, "uRA")) ESCAPE (MEAS_U_RA, MAG_NONE, OPIHI_FLT); 149 if (!strcasecmp (fieldName, "uDEC")) ESCAPE (MEAS_U_DEC, MAG_NONE, OPIHI_FLT); 150 if (!strcasecmp (fieldName, "duRA")) ESCAPE (MEAS_U_RA_ERR, MAG_NONE, OPIHI_FLT); 151 if (!strcasecmp (fieldName, "duDEC")) ESCAPE (MEAS_U_DEC_ERR, MAG_NONE, OPIHI_FLT); 152 if (!strcasecmp (fieldName, "PAR")) ESCAPE (MEAS_PAR, MAG_NONE, OPIHI_FLT); 153 if (!strcasecmp (fieldName, "dPAR")) ESCAPE (MEAS_PAR_ERR, MAG_NONE, OPIHI_FLT); 154 if (!strcasecmp (fieldName, "dR")) ESCAPE (MEAS_RA_OFFSET, MAG_NONE, OPIHI_FLT); 155 if (!strcasecmp (fieldName, "dD")) ESCAPE (MEAS_DEC_OFFSET, MAG_NONE, OPIHI_FLT); 156 if (!strcasecmp (fieldName, "dR:FIT")) ESCAPE (MEAS_RA_FIT_OFFSET, MAG_NONE, OPIHI_FLT); 157 if (!strcasecmp (fieldName, "dD:FIT")) ESCAPE (MEAS_DEC_FIT_OFFSET, MAG_NONE, OPIHI_FLT); 158 if (!strcasecmp (fieldName, "dR:ERR")) ESCAPE (MEAS_RA_OFFSET_ERR, MAG_NONE, OPIHI_FLT); 159 if (!strcasecmp (fieldName, "dD:ERR")) ESCAPE (MEAS_DEC_OFFSET_ERR, MAG_NONE, OPIHI_FLT); 160 if (!strcasecmp (fieldName, "xp")) ESCAPE (MEAS_XP, MAG_NONE, OPIHI_FLT); 161 if (!strcasecmp (fieldName, "nmeas")) ESCAPE (MEAS_NMEAS, MAG_NONE, OPIHI_INT); 162 if (!strcasecmp (fieldName, "nmiss")) ESCAPE (MEAS_NMISS, MAG_NONE, OPIHI_INT); 163 if (!strcasecmp (fieldName, "objflags")) ESCAPE (MEAS_OBJFLAGS, MAG_NONE, OPIHI_INT); 164 if (!strcasecmp (fieldName, "AIRMASS")) ESCAPE (MEAS_AIRMASS, MAG_NONE, OPIHI_FLT); 165 if (!strcasecmp (fieldName, "ALT")) ESCAPE (MEAS_ALT, MAG_NONE, OPIHI_FLT); 166 if (!strcasecmp (fieldName, "AZ")) ESCAPE (MEAS_AZ, MAG_NONE, OPIHI_FLT); 167 if (!strcasecmp (fieldName, "EXPTIME")) ESCAPE (MEAS_EXPTIME, MAG_NONE, OPIHI_FLT); 168 if (!strcasecmp (fieldName, "PHOTCODE")) ESCAPE (MEAS_PHOTCODE, MAG_NONE, OPIHI_INT); 169 if (!strcasecmp (fieldName, "PHOTCODE:EQUIV")) ESCAPE (MEAS_PHOTCODE_EQUIV, MAG_NONE, OPIHI_INT); 170 if (!strcasecmp (fieldName, "TIME")) ESCAPE (MEAS_TIME, MAG_NONE, OPIHI_FLT); 171 if (!strcasecmp (fieldName, "FWHM")) ESCAPE (MEAS_FWHM, MAG_NONE, OPIHI_FLT); 172 if (!strcasecmp (fieldName, "FWHM_MAJ")) ESCAPE (MEAS_FWHM_MAJ, MAG_NONE, OPIHI_FLT); 173 if (!strcasecmp (fieldName, "FWHM_MIN")) ESCAPE (MEAS_FWHM_MIN, MAG_NONE, OPIHI_FLT); 174 if (!strcasecmp (fieldName, "THETA")) ESCAPE (MEAS_THETA, MAG_NONE, OPIHI_FLT); 175 if (!strcasecmp (fieldName, "DOPHOT")) ESCAPE (MEAS_DOPHOT, MAG_NONE, OPIHI_INT); 176 if (!strcasecmp (fieldName, "DB_FLAGS")) ESCAPE (MEAS_DB_FLAGS, MAG_NONE, OPIHI_INT); 177 if (!strcasecmp (fieldName, "PHOT_FLAGS")) ESCAPE (MEAS_PHOT_FLAGS, MAG_NONE, OPIHI_INT); 178 if (!strcasecmp (fieldName, "XCCD")) ESCAPE (MEAS_XCCD, MAG_NONE, OPIHI_FLT); 179 if (!strcasecmp (fieldName, "YCCD")) ESCAPE (MEAS_YCCD, MAG_NONE, OPIHI_FLT); 180 if (!strcasecmp (fieldName, "XCCD:ERR")) ESCAPE (MEAS_XCCD_ERR, MAG_NONE, OPIHI_FLT); 181 if (!strcasecmp (fieldName, "YCCD:ERR")) ESCAPE (MEAS_YCCD_ERR, MAG_NONE, OPIHI_FLT); 182 if (!strcasecmp (fieldName, "XMOSAIC")) ESCAPE (MEAS_XMOSAIC, MAG_NONE, OPIHI_FLT); 183 if (!strcasecmp (fieldName, "YMOSAIC")) ESCAPE (MEAS_YMOSAIC, MAG_NONE, OPIHI_FLT); 184 if (!strcasecmp (fieldName, "XCHIP")) ESCAPE (MEAS_XCCD, MAG_NONE, OPIHI_FLT); 185 if (!strcasecmp (fieldName, "YCHIP")) ESCAPE (MEAS_YCCD, MAG_NONE, OPIHI_FLT); 186 if (!strcasecmp (fieldName, "XFPA")) ESCAPE (MEAS_XMOSAIC, MAG_NONE, OPIHI_FLT); 187 if (!strcasecmp (fieldName, "YFPA")) ESCAPE (MEAS_YMOSAIC, MAG_NONE, OPIHI_FLT); 188 if (!strcasecmp (fieldName, "DETID")) ESCAPE (MEAS_DET_ID, MAG_NONE, OPIHI_INT); 189 if (!strcasecmp (fieldName, "OBJID")) ESCAPE (MEAS_OBJ_ID, MAG_NONE, OPIHI_INT); 190 if (!strcasecmp (fieldName, "CATID")) ESCAPE (MEAS_CAT_ID, MAG_NONE, OPIHI_INT); 191 if (!strcasecmp (fieldName, "IMAGEID")) ESCAPE (MEAS_IMAGE_ID, MAG_NONE, OPIHI_INT); 192 if (!strcasecmp (fieldName, "PSF_QF")) ESCAPE (MEAS_PSF_QF, MAG_NONE, OPIHI_FLT); 193 if (!strcasecmp (fieldName, "PSF_CHISQ")) ESCAPE (MEAS_PSF_CHISQ, MAG_NONE, OPIHI_FLT); 194 if (!strcasecmp (fieldName, "CR_NSIGMA")) ESCAPE (MEAS_CR_NSIGMA, MAG_NONE, OPIHI_FLT); 195 if (!strcasecmp (fieldName, "EXT_NSIGMA")) ESCAPE (MEAS_EXT_NSIGMA, MAG_NONE, OPIHI_FLT); 196 if (!strcasecmp (fieldName, "SKY")) ESCAPE (MEAS_SKY, MAG_NONE, OPIHI_FLT); 197 if (!strcasecmp (fieldName, "SKY_ERR")) ESCAPE (MEAS_dSKY, MAG_NONE, OPIHI_FLT); 197 198 198 199 // for words that don't parse, try a photcode -
branches/czw_branch/cleanup/Ohana/src/opihi/dvo/dbStackOps.c
r20936 r25158 4 4 stack[0].type = DB_STACK_NONE; 5 5 stack[0].name = NULL; 6 stack[0].field = 0; 7 stack[0].FltValue = 0.0; 8 stack[0].IntValue = 0; 6 9 } 7 10 -
branches/czw_branch/cleanup/Ohana/src/opihi/include/dvoshell.h
r25051 r25158 83 83 MEAS_AZ, 84 84 MEAS_PHOTCODE, 85 MEAS_PHOTCODE_EQUIV, 85 86 MEAS_TIME, 86 87 MEAS_FWHM, -
branches/czw_branch/cleanup/PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm
r25151 r25158 22 22 $PSTAMP_SELECT_MASK 23 23 $PSTAMP_SELECT_WEIGHT 24 $PSTAMP_SELECT_INVERSE25 24 $PSTAMP_SUCCESS 26 25 $PSTAMP_SYSTEM_ERROR … … 35 34 $PSTAMP_GONE 36 35 $PSTAMP_NO_JOBS_QUEUED 37 $PSTAMP_NO_OVERLAP38 36 ); 39 37 our %EXPORT_TAGS = (standard => [@EXPORT_OK]); … … 48 46 our $PSTAMP_SELECT_WEIGHT = 4; 49 47 50 our $PSTAMP_SELECT_INVERSE = 1024;51 52 48 # job and result codes 53 49 # NOTE: these must match the values in pstamp/src/pstamp.h … … 55 51 our $PSTAMP_SYSTEM_ERROR = 10; 56 52 our $PSTAMP_NOT_IMPLEMENTED = 11; 57 our $PSTAMP_UNKNOWN_ERROR = 12;53 our $PSTAMP_UNKNOWN_ERROR = 12; 58 54 59 55 our $PSTAMP_DUP_REQUEST = 20; … … 65 61 our $PSTAMP_GONE = 26; 66 62 our $PSTAMP_NO_JOBS_QUEUED = 27; 67 our $PSTAMP_NO_OVERLAP = 28;68 63 69 64 use IPC::Cmd 0.36 qw( can_run run ); -
branches/czw_branch/cleanup/doc/misc/docgen.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/czw_branch/cleanup/ippScripts/scripts/magic_destreak_revert.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/czw_branch/cleanup/ippScripts/scripts/publish_file.pl
r25150 r25158 83 83 my %exp_id; # Exposure identifiers 84 84 my %exp_name; # Exposure names 85 my %direction; # Direction of subtraction86 85 { 87 86 my $command; # Command to run … … 115 114 if ($stage eq 'diff') { 116 115 my $skycell_id = $comp->{skycell_id}; 117 118 # Positive direction119 116 $files{"$skycell_id.pos"} = $ipprc->filename( "PPSUB.OUTPUT.SOURCES", $path_base ); 117 $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base ) if 118 defined $comp->{bothways} and $comp->{bothways}; 120 119 $zp{"$skycell_id.pos"} = $zp; 120 $zp{"$skycell_id.neg"} = $zp if defined $comp->{bothways} and $comp->{bothways}; 121 121 $exp_id{"$skycell_id.pos"} = $comp->{exp_id_1}; 122 $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2} if defined $comp->{bothways} and $comp->{bothways}; 122 123 $exp_name{"$skycell_id.pos"} = $comp->{exp_name_1}; 123 $direction{"$skycell_id.pos"} = 1; 124 125 # Negative direction 126 if (defined $comp->{bothways} and $comp->{bothways}) { 127 $files{"$skycell_id.neg"} = $ipprc->filename( "PPSUB.INVERSE.SOURCES", $path_base ); 128 $zp{"$skycell_id.neg"} = $zp; 129 $exp_id{"$skycell_id.neg"} = $comp->{exp_id_2}; 130 $direction{"$skycell_id.neg"} = 0; 131 $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2}; 132 } 133 124 $exp_name{"$skycell_id.neg"} = $comp->{exp_name_2} if defined $comp->{bothways} and $comp->{bothways}; 134 125 } elsif ($stage eq 'camera') { 135 126 my $cam_id = $comp->{cam_id}; … … 138 129 $exp_id{$cam_id} = $comp->{exp_id}; 139 130 $exp_name{$cam_id} = $comp->{exp_name}; 140 $direction{$cam_id} = 1;141 131 } 142 132 } … … 155 145 my $exp_id = $exp_id{$comp}; 156 146 my $exp_name = $exp_name{$comp}; 157 my $direction = $direction{$comp};158 147 if ($product eq "IPP-MOPS") { 159 148 my $outuri = "$outroot.$comp.fits"; … … 161 150 &my_die( "Unable to resolve output file $outuri", $pub_id, $PS_EXIT_SYS_ERROR); 162 151 163 my $command = "$ppMops $file $zp $exp_id $exp_name $ direction $out";152 my $command = "$ppMops $file $zp $exp_id $exp_name $out"; 164 153 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 165 154 run(command => $command, verbose => $verbose); -
branches/czw_branch/cleanup/ippTasks/pstamp.pro
r25051 r25158 178 178 book getword pstampRequest $pageName ds_outProduct -var PRODUCT 179 179 180 host anyhost 181 180 182 $run = pstamp_parser_run.pl --req_id $REQ_ID --uri $URI --product $PRODUCT --redirect-output 181 183 … … 374 376 end 375 377 378 host anyhost 376 379 377 380 $run = pstamp_job_run.pl --job_id $JOB_ID --job_type $JOB_TYPE --rownum $ROWNUM --output_base $OUTPUT_BASE --redirect-output -
branches/czw_branch/cleanup/ippTests/tap/mailTestResults.pl
r25051 r25158 6 6 use Email::Send; 7 7 8 my $email=" giebink\@ifa.hawaii.edu";8 my $email="ps-ipp-dev\@ifa.hawaii.edu"; 9 9 10 10 my $today = `date -u +%Y%m%d`; -
branches/czw_branch/cleanup/ippTests/tap/proveParser.pl
r25051 r25158 13 13 while (<IF>) { 14 14 print $_; 15 if (/ Failed Test Stat Wstat Total Fail List of Failed/) {15 if (/^Failed Test/) { 16 16 $flag = 1; 17 17 } -
branches/czw_branch/cleanup/ippTests/tap/tapTest.pl
r25051 r25158 6 6 7 7 #delete modules with tap tests 8 system `rm -rf /data/ipp001.0/ippTests/tap/ipp/Nebulous /*`;8 system `rm -rf /data/ipp001.0/ippTests/tap/ipp/Nebulous`; 9 9 10 10 #delete Nebulous binaries … … 28 28 chdir "/data/ipp001.0/ippTests/tap/ipp/$dir/nebclient"; 29 29 system ("autogen.sh --prefix=/data/ipp001.0/ippTests/tap/usr"); 30 system (" make");30 system ("/usr/bin/make"); 31 31 chdir "/data/ipp001.0/ippTests/tap/ipp/$dir"; 32 32 system ("perl Build.PL --prefix=/data/ipp001.0/ippTests/tap/usr"); -
branches/czw_branch/cleanup/ippTools/share/Makefile.am
r25147 r25158 180 180 magicdstool_torevert_warp.sql \ 181 181 magicdstool_torevert_diff.sql \ 182 pstamptool_addjob_otherjob.sql \183 pstamptool_addjob_stampjob.sql \184 182 pstamptool_datastore.sql \ 185 183 pstamptool_pendingjob.sql \ -
branches/czw_branch/cleanup/ippTools/share/difftool_skyfile.sql
r24512 r25158 6 6 diffRun.workdir, 7 7 diffRun.bothways, 8 camProcessedExp.zpt_obs,9 camProcessedExp.zpt_stdev,10 camProcessedExp.zpt_lq,11 camProcessedExp.zpt_uq,12 rawExp.exp_time,13 rawExp.camera,14 8 warp1, 15 9 stack1, 16 10 warp2, 17 stack2 11 stack2, 12 -- The following are only valid for warps 13 -- XXX This needs to be more clever to handle diffs between stacks 14 camProcessedInput.zpt_obs, 15 camProcessedInput.zpt_stdev, 16 camProcessedInput.zpt_lq, 17 camProcessedInput.zpt_uq, 18 rawInput.exp_time, 19 rawInput.camera, 20 rawInput.exp_name AS exp_name_1, 21 rawTemplate.exp_name AS exp_name_2, 22 rawInput.exp_id AS exp_id_1, 23 rawTemplate.exp_id AS exp_id_2 18 24 FROM diffRun 19 25 JOIN diffSkyfile USING(diff_id) 20 26 JOIN diffInputSkyfile USING(diff_id, skycell_id) 21 JOIN warpRun 22 -- NOTE: joining input only! 23 -- This is so that we can get the correct zero point 24 -- XXX This needs to be more clever to handle diffs between stacks 25 ON warpRun.warp_id = diffInputSkyfile.warp1 26 JOIN fakeRun USING(fake_id) 27 JOIN camRun USING(cam_id) 28 JOIN camProcessedExp USING(cam_id) 29 JOIN chipRun USING(chip_id) 30 JOIN rawExp USING(exp_id) 27 LEFT JOIN warpRun AS warpInput 28 ON warpInput.warp_id = diffInputSkyfile.warp1 29 LEFT JOIN fakeRun AS fakeInput 30 ON fakeInput.fake_id = warpInput.fake_id 31 LEFT JOIN camRun AS camInput 32 ON camInput.cam_id = fakeInput.cam_id 33 LEFT JOIN camProcessedExp AS camProcessedInput 34 ON camProcessedInput.cam_id = camInput.cam_id 35 LEFT JOIN chipRun AS chipInput 36 ON chipInput.chip_id = camInput.chip_id 37 LEFT JOIN rawExp AS rawInput 38 ON rawInput.exp_id = chipInput.exp_id 39 LEFT JOIN warpRun AS warpTemplate 40 ON warpTemplate.warp_id = diffInputSkyfile.warp2 41 LEFT JOIN fakeRun AS fakeTemplate 42 ON fakeTemplate.fake_id = warpTemplate.fake_id 43 LEFT JOIN camRun AS camTemplate 44 ON camTemplate.cam_id = fakeTemplate.cam_id 45 LEFT JOIN chipRun AS chipTemplate 46 ON chipTemplate.chip_id = camTemplate.chip_id 47 LEFT JOIN rawExp AS rawTemplate 48 ON rawTemplate.exp_id = chipTemplate.exp_id -
branches/czw_branch/cleanup/ippTools/src/difftool.c
r25051 r25158 584 584 PXOPT_COPY_STR(config->args, where, "-tess_id", "diffRun.tess_id", "=="); 585 585 PXOPT_COPY_S16(config->args, where, "-fault", "diffSkyfile.fault", "=="); 586 PXOPT_COPY_S64(config->args, where, "-exp_id", "raw Exp.exp_id", "==");587 PXOPT_COPY_STR(config->args, where, "-exp_name", "raw Exp.exp_name", "==");588 PXOPT_COPY_STR(config->args, where, "-warp_id", "warp Run.warp_id", "==");586 PXOPT_COPY_S64(config->args, where, "-exp_id", "rawInput.exp_id", "=="); 587 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawInput.exp_name", "=="); 588 PXOPT_COPY_STR(config->args, where, "-warp_id", "warpInput.warp_id", "=="); 589 589 590 590 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 1179 1179 1180 1180 if (!available && (num != skycell_count)) { 1181 psTrace("difftool", PS_LOG_INFO, "%" PRId64 " skyfiles with stack found for warp_id %" 1182 PRId64 " need %" PRId64, num, skycell_count, warp_id);1181 psTrace("difftool", PS_LOG_INFO, "%" PRId64 " skyfiles with stack found for warp_id %" PRId64 1182 " need %" PRId64, num, warp_id, skycell_count); 1183 1183 continue; 1184 1184 } -
branches/czw_branch/cleanup/ippTools/src/pstamptool.c
r25149 r25158 315 315 PS_ASSERT_PTR_NON_NULL(config, false); 316 316 317 psMetadata *where = psMetadataAlloc(); 318 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); 319 PXOPT_COPY_STR(config->args, where, "-name", "name", "=="); 320 317 PXOPT_LOOKUP_S64(req_id, config->args, "-req_id", false, false); 318 PXOPT_LOOKUP_STR(name, config->args, "-name", false, false); 321 319 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 322 320 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 323 321 324 if (! psListLength(where->list)) {322 if (!req_id && !name) { 325 323 psError(PS_ERR_UNKNOWN, true, "-req_id or -name must be supplied"); 326 324 return false; 327 325 } 328 326 329 psString query = psStringCopy("SELECT * from pstampRequest"); 330 331 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 332 psStringAppend(&query, " WHERE %s", whereClause); 333 psFree(whereClause); 334 psFree(where); 327 psString query = NULL; 328 psStringAppend(&query, "SELECT * from pstampRequest WHERE req_id = %" PRId64, req_id); 335 329 336 330 // treat limit == 0 as "no limit" … … 529 523 530 524 // default value for job_type is defined in pstamptoolConfig.c 531 if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query") || !strcmp(job_type, "none")) {525 if (!strcmp(job_type, "get_image") || !strcmp(job_type, "detect_query")) { 532 526 stampJob = false; 533 527 } else if (!strcmp(job_type, "stamp")) { -
branches/czw_branch/cleanup/ippTools/src/pstamptoolConfig.c
r25051 r25158 75 75 // -listreq 76 76 psMetadata *listreqArgs = psMetadataAlloc(); 77 psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-req_id", 0, "define req_id (required)", 0); 77 psMetadataAddS64(listreqArgs, PS_LIST_TAIL, "-req_id", 0, "list by req_id", 0); 78 psMetadataAddStr(listreqArgs, PS_LIST_TAIL, "-name", 0, "list by name", NULL); 78 79 psMetadataAddU64(listreqArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 79 80 psMetadataAddBool(listreqArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); … … 106 107 psMetadataAddStr(addjobArgs, PS_LIST_TAIL, "-state", 0, "new state", "run"); 107 108 psMetadataAddS64(addjobArgs, PS_LIST_TAIL, "-exp_id", 0, "exposure id", 0); 108 psMetadataAddS tr(addjobArgs, PS_LIST_TAIL, "-fault", 0, "new result", NULL);109 psMetadataAddS16(addjobArgs, PS_LIST_TAIL, "-fault", 0, "new result", 0); 109 110 110 111 // -listjob -
branches/czw_branch/cleanup/magic/Makefile.in
r24951 r25158 12 12 13 13 update: 14 # get the source code (replace this with SVN interactions)14 # get the source code (replace this with SVN interactions) 15 15 tar xvzf ~/magic.tgz 16 16 tar xvzf ~/ssa-core-cpp.tgz -
branches/czw_branch/cleanup/magic/censorObjects/src/censorLoop.c
r24951 r25158 22 22 */ 23 23 bool censorLoop (pmConfig *config) { 24 25 24 pmChip *chip; 26 25 pmCell *cell; … … 28 27 29 28 psTimerStart ("censor"); 29 30 31 30 32 31 33 // select the current recipe … … 51 53 52 54 pmFPAview *view = pmFPAviewAlloc (0); 55 53 56 bool badMaskFile = false; 54 57 … … 59 62 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 60 63 64 // check PHU header to see if we are using mosaic-level or per-chip astrometry 65 bool bilevelAstrometry = false; 66 pmHDU *phu = pmFPAviewThisPHU (view, input->fpa); 67 if (phu) { 68 char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1"); 69 if (ctype) bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 70 } 71 if (bilevelAstrometry) { 72 pmAstromReadBilevelMosaic (input->fpa, phu->header); 73 } 74 61 75 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { 62 76 psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 63 77 if (!chip->process || !chip->file_exists) { continue; } 64 78 65 79 // check on the mask file at this level if possible 66 80 badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view); 67 81 68 82 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE; 83 84 // read WCS data from the corresponding header 85 86 pmHDU *hdu = pmFPAviewThisHDU (view, input->fpa); 87 88 if (bilevelAstrometry) { 89 if (!pmAstromReadBilevelChip (chip, hdu->header)) { 90 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip); 91 continue; 92 } 93 } else { 94 if (!pmAstromReadWCS(input->fpa, chip, hdu->header, 1.0)) { 95 psWarning( "Unable to read WCS astrometry from chip %d, skipping", view->chip); 96 continue; 97 } 98 } 69 99 70 100 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { -
branches/czw_branch/cleanup/magic/remove/src/Line.c
r25051 r25158 36 36 // If the current line is not vertical, check to see if the point 37 37 // is inside the two endpoints independent of direction 38 38 39 39 if (line->begin.x != line->end.x) 40 40 { … … 59 59 ux = line->end.x - line->begin.x; 60 60 uy = line->end.y - line->begin.y; 61 61 62 62 vx = x - line->begin.x; 63 63 vy = y - line->begin.y; 64 64 65 65 double u_u = ux * ux + uy * uy; // (u . u) 66 66 double u_v = ux * vx + uy * vy; // (u . v) 67 67 68 68 if (u_v <= 0) return vx * vx + vy * vy; // (v . v) 69 69 if (u_u <= u_v) … … 73 73 return wx * wx + wy * wy; // (w . w) 74 74 } 75 75 76 76 // Compute P(b) is the base of the perpendicular dropped from tuple to 77 77 // the line 78 78 79 79 b = u_v / u_u; 80 80 px = vx - b * ux; … … 109 109 double wx = first->begin.x - second->begin.x; 110 110 double wy = first->begin.y - second->begin.y; 111 111 112 112 // Calculate the perpendicular product, dt 113 113 114 114 double dt = dx1 * dy2 - dy1 * dx2; 115 115 116 116 // Are the lines parallel? 117 117 118 118 if (fabs (dt) <= 1e-8) 119 119 { 120 120 // Check to see if they are overlap 121 121 122 122 if (dx1 * wy - dy1 * wx != 0 || dx2 * wy - dy2 * wx != 0) return 0; 123 123 124 124 // The line are coplanar, so check to see if they are degenerate 125 125 126 126 len1 = dx1 * dx1 + dy1 * dy1; 127 127 len2 = dx2 * dx2 + dy2 * dy2; 128 128 129 129 // First, check to see if both lines are points and if they are 130 130 // distinct tuples 131 131 132 132 if (len1 == 0 && len2 == 0) 133 133 { … … 137 137 return 1; 138 138 } 139 139 140 140 // Check to see if the first line is a point and is inside the 141 141 // second line 142 142 143 143 if (len1 == 0) 144 144 { … … 148 148 return 0; 149 149 } 150 150 151 151 // Check to see if the second line is a point and is inside the 152 152 // first line 153 153 154 154 if (len2 == 0) 155 155 { … … 159 159 return 0; 160 160 } 161 161 162 162 // Since both lines are coplanar and have length, search for 163 163 // overlap tuples 164 164 165 165 w2x = first->end.x - second->begin.x; 166 166 w2y = first->end.y - second->begin.y; 167 167 168 168 t0 = (dx2 != 0) ? wx / dx2 : wy / dy2; 169 169 t1 = (dx2 != 0) ? w2x / dx2 : w2y / dy2; 170 170 171 171 if (t0 > t1) SwapDouble (&t0, &t1); 172 172 if ((inFirstSegment || inSecondSegment) && (t0 > 1 || t1 < 0)) … … 176 176 t0 = (t0 < 0) ? 0 : t0; // Clip to min 0 177 177 t1 = (t1 > 1) ? 1 : t1; // Clip to max 1 178 178 179 179 // Set the first tuple of intersection 180 180 181 181 tuple1->x = second->begin.x + t0 * dx2; 182 182 tuple1->y = second->begin.y + t0 * dy2; 183 183 184 184 // Check to see if the intersection is a single tuple 185 185 186 186 if (t0 == t1) return 1; 187 187 188 188 // Otherwise, set the second tuple of intersection as well 189 189 190 190 tuple2->x = second->begin.x + t1 * dx2; 191 191 tuple2->y = second->begin.y + t1 * dy2; 192 192 return 2; 193 193 } 194 194 195 195 // The segments are skew and may intersect in a tuple. 196 196 // Get the intersect parameter for the first line 197 197 198 198 double i1 = (dx2 * wy - dy2 * wx) / dt; 199 199 if (inFirstSegment && (i1 < 0 || i1 > 1)) return 0; 200 200 201 201 // Get the intersect parameter for the second line 202 202 … … 226 226 vertices[3].x = 0; vertices[3].y = numRows; 227 227 228 clipLine.begin.x = 0; 229 clipLine.begin.y = 0; 230 clipLine.end.x = 0; 231 clipLine.end.y = 0; 232 228 233 for (i = 0; i < 4 && found < 2; ++i) 229 234 { … … 237 242 ++found; 238 243 } 239 else if (tuple1.x != clipLine.begin.x || 244 else if (tuple1.x != clipLine.begin.x || 240 245 tuple1.y != clipLine.begin.y) 241 246 { … … 245 250 } 246 251 } 247 252 248 253 // If two endpoints are found, clip the line 249 254 250 255 if (found > 1) 251 256 { … … 283 288 vertices[3].x = minX; vertices[3].y = maxY; 284 289 290 clipLine.begin.x = 0; 291 clipLine.begin.y = 0; 292 clipLine.end.x = 0; 293 clipLine.end.y = 0; 294 285 295 for (i = 0; i < 4 && found < 2; ++i) 286 296 { … … 294 304 ++found; 295 305 } 296 else if (tuple1.x != clipLine.begin.x || 306 else if (tuple1.x != clipLine.begin.x || 297 307 tuple1.y != clipLine.begin.y) 298 308 { … … 302 312 } 303 313 } 304 314 305 315 // If two endpoints are found, clip the line 306 316 307 317 if (found > 1) 308 318 { … … 360 370 @param[out] pixels list of PixelPos pointers corresponding 361 371 based on the line settings 362 @param[in] line Line to map to pixels 372 @param[in] line Line to map to pixels 363 373 @param[in] numCols maximum X (columns) for the line 364 374 @param[in] numRows maximum Y (rows) for the line */ … … 367 377 { 368 378 Line offsetLine; 369 PixelPos *pixel;370 379 double slope, xOffset, yOffset, xMid, yMid; 371 380 int x, y, xBegin = numCols, yBegin = numRows, xEnd = 0, yEnd = 0; 372 381 373 382 // Extract the endpoints 374 383 375 384 double x1 = line->begin.x; 376 385 double y1 = line->begin.y; 377 386 double x2 = line->end.x; 378 387 double y2 = line->end.y; 379 388 380 389 // Determine the width and height of the line 381 390 382 391 double dx = x2 - x1; 383 392 double dy = y2 - y1; … … 403 412 404 413 // Step point by point based on the dominate axis 405 414 406 415 if (fabs (dx) > fabs (dy)) 407 416 { … … 411 420 // If line is back to front, reorder endpoints and recompute 412 421 // the line width and height 413 422 414 423 if (x1 > x2) 415 424 { … … 421 430 422 431 // Compute the slope of the line 423 432 424 433 slope = dy / dx; 425 434 426 435 // Compute the x and y offsets for the line width extent 427 436 428 if (xBegin > xEnd) 437 if (xBegin > xEnd) 429 438 SwapInt (&xBegin, &xEnd); 430 439 else … … 451 460 } 452 461 else 453 { 462 { 454 463 // ------------------- 455 464 // vertical(ish) lines … … 457 466 // If line is back to front, reorder endpoints and recompute 458 467 // the line width and height 459 468 460 469 if (y1 > y2) 461 470 { … … 465 474 dy = y2 - y1; 466 475 } 467 476 468 477 // Compute the slope of the line 469 478 470 479 slope = dx / dy; 471 480 472 481 // Compute the x and y offsets for the line width extent 473 482 … … 481 490 xMid = x1 + slope * (yBegin - y1); 482 491 xOffset = fabs (halfWidth * dr / dy); 483 492 484 493 for (y = yBegin; y != yEnd; ++y) 485 494 { -
branches/czw_branch/cleanup/magic/remove/src/Makefile.simple
r24951 r25158 36 36 37 37 STREAKSFLAGS=-DSTREAKS_COMPRESS_OUTPUT=1 38 OPTFLAGS= -g -O2 38 OPTFLAGS= -g -O2 -Wall -Werror 39 39 #OPTFLAGS= -g 40 CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS}41 #CFLAGS=`psmodules-config --cflags` -std=gnu99 ${OPTFLAGS}42 LDFLAGS=`psmodules-config --libs` 40 CFLAGS=`psmodules-config --cflags` `pslib-config --cflags` -std=gnu99 ${OPTFLAGS} ${STREAKSFLAGS} 41 #CFLAGS=`psmodules-config --cflags` `pslib-config --cflags` -std=gnu99 ${OPTFLAGS} 42 LDFLAGS=`psmodules-config --libs` `pslib-config --libs` 43 43 44 44 PROGRAMS= streaksremove streaksreplace streakscompare streaksrelease isdestreaked -
branches/czw_branch/cleanup/magic/remove/src/isdestreaked.c
r24951 r25158 18 18 psFits *fits = psFitsOpen(fileName, "r"); 19 19 if (!fits) { 20 psError(PS_ERR_UNKNOWN, false, "failed to open fits file: %s\n", fileName); 21 psErrorStackPrint(stderr, ""); 20 psErrorStackPrint(stderr, "failed to open fits file: %s\n", fileName); 22 21 exit(PS_EXIT_DATA_ERROR); 23 22 } … … 25 24 psMetadata *header = psFitsReadHeader(NULL, fits); 26 25 if (!header) { 27 psError(PS_ERR_IO, false, "failed to read header for: %s", fileName); 28 psErrorStackPrint(stderr, ""); 26 psErrorStackPrint(stderr, "failed to read header for: %s", fileName); 29 27 exit(PS_EXIT_DATA_ERROR); 30 28 } -
branches/czw_branch/cleanup/magic/remove/src/streaksastrom.c
r24951 r25158 93 93 // since the transform already accounts for the chip parity we just use the cell parity 94 94 astrom->xParity = (double) xParityCell; 95 astrom->yParity = (double) yParityCell; 95 astrom->yParity = (double) yParityCell; 96 96 97 97 astrom->numCols = numCols; … … 135 135 136 136 void 137 cellToChipInt( int *xChip,int *yChip, strkAstrom *astrom, int xCell, int yCell)137 cellToChipInt(unsigned int *xChip, unsigned int *yChip, strkAstrom *astrom, int xCell, int yCell) 138 138 { 139 139 if (astrom->xParity > 0) { … … 148 148 } 149 149 } 150 150 151 151 bool 152 152 SkyToLocal(strkPt *outPt, strkAstrom *astrom, double ra, double dec) … … 156 156 157 157 pmFPA *fpa = (pmFPA *) astrom->fpa; 158 pmChip *chip = (pmChip *) astrom->chip;159 158 160 159 // find the RA,DEC coords of the 0,0 pixel for this chip: … … 183 182 184 183 pmFPA *fpa = (pmFPA *) astrom->fpa; 185 pmChip *chip = (pmChip *) astrom->chip;186 184 187 185 // find the RA,DEC coords of the 0,0 pixel for this chip: … … 251 249 pmChip *chip = (pmChip *) astrom->chip; 252 250 pmAstromObj *pt = (pmAstromObj *) astrom->pt; 253 251 254 252 pt->sky->r = ra; 255 253 pt->sky->d = dec; … … 276 274 pmChip *chip = (pmChip *) astrom->chip; 277 275 pmAstromObj *pt = (pmAstromObj *) astrom->pt; 278 276 279 277 cellToChip(&pt->chip->x, &pt->chip->y, astrom, x, y); 280 278 … … 294 292 } 295 293 296 294 297 295 static bool 298 296 readAstrometry(streakFiles *sf) … … 362 360 break; 363 361 } 364 } 362 } 365 363 if (!sf->chip) { 366 364 psError(PS_ERR_UNKNOWN, true, "Failed to find chip with data."); -
branches/czw_branch/cleanup/magic/remove/src/streakscompare.c
r21156 r25158 5 5 int main(int argc, char *argv[]) 6 6 { 7 long i;8 7 bool status; 9 8 … … 35 34 int numErrors = 0; 36 35 for (int component = 0; component < ncomponents; component++) { 37 if (component && !(psFitsMoveExtNum(file1->fits, 1, true) 36 if (component && !(psFitsMoveExtNum(file1->fits, 1, true) 38 37 && psFitsMoveExtNum(file2->fits, 1, true))) { 39 38 streaksExit("failed to advance to next extesion\n", PS_EXIT_DATA_ERROR); … … 45 44 psImage *image2 = file2->image; 46 45 47 // TODO: do more sanity checking. For example check that extname's (if any) match 46 // TODO: do more sanity checking. For example check that extname's (if any) match 48 47 // check for matching image cubes 49 48 if (image1 && image2) { … … 68 67 error = ! isnan(value1) && isnan(value2); 69 68 } 70 69 71 70 if (error) { 72 71 numErrors++; -
branches/czw_branch/cleanup/magic/remove/src/streaksextern.h
r25051 r25158 54 54 pixels 55 55 */ 56 56 57 57 extern StreakPixels *streak_on_component(Streaks *streaks, strkAstrom *astrom, 58 58 int numCols, int numRows); -
branches/czw_branch/cleanup/magic/remove/src/streaksio.c
r24951 r25158 12 12 // Assumptions about the file structure of non-raw files 13 13 // The 'image' for each file (image, mask weight) is contained in the first 14 // extension. 14 // extension. 15 15 16 16 … … 625 625 streaksExit("", PS_EXIT_DATA_ERROR); 626 626 } 627 627 628 628 bool status; 629 629 in->extname = psMetadataLookupStr(&status, in->header, "EXTNAME"); … … 654 654 streaksExit("", PS_EXIT_DATA_ERROR); 655 655 } 656 psImage *image = (psImage *) (in->imagecube->data[0]);657 656 } 658 657 setDataExtent(stage, in, (stage == IPP_STAGE_RAW) && !isMask); … … 925 924 replicateOutputs(streakFiles *sfiles) 926 925 { 927 bool status = false;928 929 926 if (!replicate(sfiles->outImage, sfiles->inImage)) { 930 927 psError(PM_ERR_SYS, false, "failed to replicate outImage."); … … 973 970 974 971 if (!nebSwap(server, in->name, out->name)) { 975 psError(PM_ERR_SYS, true, "failed to swap files for : %s.",972 psError(PM_ERR_SYS, true, "failed to swap files for %s: %s.", 976 973 in->name, nebErr(server)); 977 974 return false; … … 1097 1094 setMaskedToNAN(streakFiles *sfiles, psU32 maskMask, bool printCounts) 1098 1095 { 1099 intmaskedPixels = 0;1100 intnandPixels = 0;1101 intnandWeights = 0;1096 long maskedPixels = 0; 1097 long nandPixels = 0; 1098 long nandWeights = 0; 1102 1099 1103 1100 psImage *image = sfiles->outImage->image; … … 1120 1117 psU32 maskVal; 1121 1118 if (sfiles->stage == IPP_STAGE_RAW) { 1122 int xChip, yChip;1119 unsigned int xChip, yChip; 1123 1120 cellToChipInt(&xChip, &yChip, sfiles->astrom, x, y); 1124 1121 maskVal = psImageGet(mask, xChip, yChip); … … 1144 1141 if (printCounts) { 1145 1142 psLogMsg(sfiles->program_name, PS_LOG_INFO, "time to NAN mask pixels: %f\n", psTimerClear("NAN_MASKED")); 1146 inttotalPixels = image->numRows * image->numCols;1143 long totalPixels = image->numRows * image->numCols; 1147 1144 psLogMsg(sfiles->program_name, PS_LOG_INFO, "pixels: %10ld\n", totalPixels); 1148 1145 psLogMsg(sfiles->program_name, PS_LOG_INFO, "masked pixels: %10ld %4.2f%%\n", maskedPixels, 100. * maskedPixels / totalPixels); -
branches/czw_branch/cleanup/magic/remove/src/streaksrelease.c
r24951 r25158 3 3 static pmConfig *parseArguments(int argc, char **argv); 4 4 static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll); 5 static StreakPixels * getStreakPixels(streakFiles *sfiles, Streaks *streaks);6 static void exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue);7 static bool warpedPixel(streakFiles *sfiles, PixelPos *cellCoord);8 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue);9 5 static void writeImages(streakFiles *sf, bool exciseImageCube); 10 6 … … 12 8 main(int argc, char *argv[]) 13 9 { 14 bool status;15 16 10 psLibInit(NULL); 17 11 psTimerStart("STREAKSREMOVE"); … … 25 19 // Values to set for masked pixels 26 20 psU32 maskStreak = 0; // for the image and weight (usually NAN, MAXINT for integer images) 27 psU32 maskMask = 0; // value looked up for MASK.STREAK 21 psU32 maskMask = 0; // value looked up for MASK.STREAK 28 22 29 23 // Does true work here? … … 216 210 // image data directly from psFits 217 211 readImage(sf->inImage, sf->extnum, sf->stage, false); 218 212 219 213 // astrom struct is only needed for raw stage, and only the chip to cell parameters are used 220 214 sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, NULL, NULL, false, … … 304 298 initValue = NAN; 305 299 } else { 306 // otherwise write it to the output 300 // otherwise write it to the output 307 301 writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum); 308 302 initValue = 0; -
branches/czw_branch/cleanup/magic/remove/src/streaksremove.c
r25051 r25158 35 35 // Values to set for masked pixels 36 36 psU32 maskStreak = 0; // for the image and weight (usually NAN, MAXINT for integer images) 37 psU32 maskMask = 0; // value looked up for MASK.STREAK 37 psU32 maskMask = 0; // value looked up for MASK.STREAK 38 38 39 39 psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS"); … … 42 42 Streaks *streaks = readStreaksFile(streaksFileName); 43 43 if (!streaks) { 44 psError(PS_ERR_UNKNOWN, "failed to read streaks file: %s", streaksFileName);44 psError(PS_ERR_UNKNOWN, false, "failed to read streaks file: %s", streaksFileName); 45 45 streaksExit("", PS_EXIT_PROG_ERROR); 46 46 } … … 83 83 psLogMsg("streaksremove", PS_LOG_INFO, "time to compute warped pixels: %f\n", cwp_t); 84 84 } 85 85 86 86 if (sfiles->stage == IPP_STAGE_RAW) { 87 87 // Except for raw stage, all of our (GPC1) files have one image extension. … … 97 97 } 98 98 99 inttotalPixels = 0;100 inttotalStreakPixels = 0;99 long totalPixels = 0; 100 long totalStreakPixels = 0; 101 101 102 102 // Iterate through each component of the input (except for raw images there is only one) … … 132 132 sfiles->inImage->numRows); 133 133 psLogMsg("streaksremove", PS_LOG_INFO, "time to get streak pixels: %f\n", psTimerClear("GET_STREAK_PIXELS")); 134 134 135 135 // if this extension contained an image, excise the streaked pixels. 136 136 // otherwise it contained an image cube (video cell) which is handled in the if block … … 172 172 } 173 173 174 } else { 174 } else { 175 175 // this component contains an image cube 176 176 // For now excise it completely … … 215 215 216 216 if (!replicateOutputs(sfiles)) { 217 psError (PS_ERR_UNKNOWN, false, "failed to replicate output files");217 psErrorStackPrint(stderr, "failed to replicate output files"); 218 218 deleteTemps(sfiles); 219 psErrorStackPrint(stderr, "");220 219 exit(PS_EXIT_UNKNOWN_ERROR); 221 220 } … … 247 246 pmConceptsDone(); 248 247 pmModelClassCleanup(); 249 streaksNebulousCleanup(); 248 streaksNebulousCleanup(); 250 249 pmConfigDone(); 251 250 psLogMsg("streaksremove", PS_LOG_INFO, "time to run streaksremove: %f\n", psTimerClear("STREAKSREMOVE")); … … 356 355 true); 357 356 } 358 357 359 358 if ((argnum = psArgumentGet(argc, argv, "-keepnonwarped"))) { 360 359 psArgumentRemove(argnum, &argc, argv); … … 374 373 psArgumentRemove(argnum, &argc, argv); 375 374 } 376 375 377 376 // if skycells are not provided then we have to execise all pixels unless -keepnonwarped 378 377 pmConfigFileSetsMD(config->arguments, &argc, argv, "SKYCELLS", "-skycell", "-skycelllist"); … … 628 627 initValue = NAN; 629 628 } else { 630 // otherwise write it to the output 629 // otherwise write it to the output 631 630 writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum); 632 631 initValue = 0; … … 799 798 sFile *out = sfiles->outSources; 800 799 801 in->header = psFitsReadHeader(NULL, in->fits); 802 if (!in->header) { 803 psError(PS_ERR_IO, false, "failed to read header from %s", in->resolved_name); 800 801 // Primary header, should be "something.hdr" 802 { 803 psMetadata *header = psFitsReadHeader(NULL, in->fits); 804 if (!header) { 805 psError(PS_ERR_IO, false, "failed to read header from %s", in->resolved_name); 806 streaksExit("", PS_EXIT_DATA_ERROR); 807 } 808 809 bool status; 810 psString extname = psMetadataLookupStr(&status, header, "EXTNAME"); 811 if (!extname) { 812 psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name); 813 streaksExit("", PS_EXIT_DATA_ERROR); 814 } 815 addDestreakKeyword(header); 816 817 if (!psFitsWriteBlank(out->fits, header, extname)) { 818 psError(PS_ERR_IO, false, "failed to write blank in header of %s", in->resolved_name); 819 streaksExit("", PS_EXIT_DATA_ERROR); 820 } 821 psFree(header); 822 } 823 824 // Extension with PSF fits, should be "something.psf" 825 { 826 if (!psFitsMoveExtNum(in->fits, 1, true)) { 827 psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name); 828 streaksExit("", PS_EXIT_DATA_ERROR); 829 } 830 831 psMetadata *header = psFitsReadHeader(NULL, in->fits); 832 if (!header) { 833 psErrorStackPrint(stderr, "failed to read header from %s", in->resolved_name); 834 streaksExit("", PS_EXIT_DATA_ERROR); 835 } 836 psString extname = psMetadataLookupStr(NULL, header, "EXTNAME"); 837 if (!extname) { 838 psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name); 839 streaksExit("", PS_EXIT_DATA_ERROR); 840 } 841 842 psArray *inTable = psFitsReadTable(in->fits); 843 if (!inTable->n) { 844 psErrorStackPrint(stderr, "table in %s is empty", in->resolved_name); 845 streaksExit("", PS_EXIT_DATA_ERROR); 846 } 847 848 psArray *outTable = psArrayAllocEmpty(inTable->n); 849 int j = 0; 850 int numCensored = 0; 851 for (int i = 0 ; i < inTable->n; i++) { 852 psMetadata *row = inTable->data[i]; 853 854 psF32 x = psMetadataLookupF32(NULL, row, "X_PSF"); 855 psF32 y = psMetadataLookupF32(NULL, row, "Y_PSF"); 856 857 psU32 mask = psImageGet(maskImage, x, y); 858 859 // Key the source if the center pixel is not masked with maskStreak 860 if (!(mask & maskStreak) ) { 861 psArraySet(outTable, j++, row); 862 } else { 863 numCensored++; 864 } 865 } 866 867 // get rid of unused elements (don't know if this is necessary) 868 psArrayRealloc(outTable, j); 869 870 addDestreakKeyword(header); 871 if (psArrayLength(outTable) > 0) { 872 printf("Censored %d sources\n", numCensored); 873 if (! psFitsWriteTable(out->fits, header, outTable, extname)) { 874 psErrorStackPrint(stderr, "failed to write table to %s", out->resolved_name); 875 streaksExit("", PS_EXIT_DATA_ERROR); 876 } 877 } else { 878 printf("Censored ALL %d sources\n", numCensored); 879 if (! psFitsWriteTableEmpty(out->fits, header, inTable->data[0], extname)) { 880 psErrorStackPrint(stderr, "failed to write empty table to %s", out->resolved_name); 881 streaksExit("", PS_EXIT_DATA_ERROR); 882 } 883 } 884 psFree(header); 885 psFree(outTable); 886 psFree(inTable); 887 } 888 889 // XXX Will need to update to handle extension with extended sources, etc. 890 891 if (!psFitsClose(out->fits)) { 892 psErrorStackPrint(stderr, "failed to close table %s", out->resolved_name); 804 893 streaksExit("", PS_EXIT_DATA_ERROR); 805 894 } 806 807 bool status; 808 psString extname = psMetadataLookupStr(&status, in->header, "EXTNAME"); 809 if (!extname) { 810 psError(PS_ERR_IO, false, "failed to find extname in header of %s", in->resolved_name); 811 streaksExit("", PS_EXIT_DATA_ERROR); 812 } 813 814 psArray *inTable = psFitsReadTable(in->fits); 815 if (!inTable->n) { 816 psError(PS_ERR_IO, false, "table in %s is empty", in->resolved_name); 817 streaksExit("", PS_EXIT_DATA_ERROR); 818 } 819 820 psArray *outTable = psArrayAllocEmpty(inTable->n); 821 int j = 0; 822 int numCensored = 0; 823 for (int i = 0 ; i < inTable->n; i++) { 824 psMetadata *row = inTable->data[i]; 825 826 psF32 x = psMetadataLookupF32 (&status, row, "X_PSF"); 827 psF32 y = psMetadataLookupF32 (&status, row, "Y_PSF"); 828 829 psU32 mask = psImageGet(maskImage, x, y); 830 831 // Key the source if the center pixel is not masked with maskStreak 832 if (! (mask & maskStreak) ) { 833 psArraySet(outTable, j++, row); 834 } else { 835 numCensored++; 836 } 837 } 838 839 // get rid of unused elements (don't know if this is necessary) 840 psArrayRealloc(outTable, j); 841 842 addDestreakKeyword(in->header); 843 if (psArrayLength(outTable) > 0) { 844 printf("Censored %d sources\n", numCensored); 845 if (! psFitsWriteTable(out->fits, in->header, outTable, extname)) { 846 psError(PS_ERR_IO, false, "failed to write table to %s", out->resolved_name); 847 streaksExit("", PS_EXIT_DATA_ERROR); 848 } 849 } else { 850 printf("Censored ALL %d sources\n", numCensored); 851 if (! psFitsWriteTableEmpty(out->fits, in->header, inTable->data[0], extname)) { 852 psError(PS_ERR_IO, false, "failed to write empty table to %s", out->resolved_name); 853 streaksExit("", PS_EXIT_DATA_ERROR); 854 } 855 } 856 857 if (!psFitsClose(out->fits)) { 858 psError(PS_ERR_IO, false, "failed to close table %s", out->resolved_name); 859 streaksExit("", PS_EXIT_DATA_ERROR); 860 } 861 } 895 } -
branches/czw_branch/cleanup/magic/remove/src/streaksremove.h
r24691 r25158 84 84 // can't declare this in streaksastrom due to header file ordering 85 85 extern void cellToChip(double *xChip, double *yChip, strkAstrom *astrom, double xCell, double yCell); 86 extern void cellToChipInt( int *xChip,int *yChip, strkAstrom *astrom, int xCell, int yCell);86 extern void cellToChipInt(unsigned int *xChip, unsigned int *yChip, strkAstrom *astrom, int xCell, int yCell); 87 87 88 88 extern bool computeWarpedPixels(streakFiles *sf); -
branches/czw_branch/cleanup/magic/remove/src/streaksreplace.c
r24556 r25158 8 8 int main(int argc, char *argv[]) 9 9 { 10 long i;11 10 bool status; 12 StreakPixels *pixels;13 PixelPos *pixelPos;14 11 15 12 psLibInit(NULL); … … 92 89 93 90 if (!replicateOutputs(sfiles)) { 94 psError(PS_ERR_UNKNOWN, false, "failed to replicate output files"); 95 psErrorStackPrint(stderr, ""); 91 psErrorStackPrint(stderr, "failed to replicate output files"); 96 92 exit(PS_EXIT_UNKNOWN_ERROR); 97 93 } … … 172 168 true); 173 169 } 174 170 175 171 bool gotMask = false; 176 172 if ((argnum = psArgumentGet(argc, argv, "-mask"))) { … … 353 349 // we have an image cube 354 350 double initValue; 355 // otherwise write it to the output 351 // otherwise write it to the output 356 352 writeImageCube(sf->outImage, sf->recImage->imagecube, extname, sf->extnum); 357 353 -
branches/czw_branch/cleanup/magic/remove/src/streaksutil.c
r24556 r25158 44 44 // we just bail out 45 45 void streaksExit(psString str, int exitCode) { 46 psErrorStackPrint(stderr, str);46 psErrorStackPrint(stderr, "%s", str); 47 47 if (ourStreakFiles) { 48 48 deleteTemps(ourStreakFiles); -
branches/czw_branch/cleanup/magic/remove/src/warpedpixels.c
r21438 r25158 23 23 24 24 psRegion *bounds = pmChipPixels(sf->chip); 25 25 26 26 int width = bounds->x1 - bounds->x0; 27 27 int height = bounds->y1 - bounds->y0; … … 83 83 84 84 /* now set up our wrapper to the chip astrometry to apply to the whole chip */ 85 sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, sf->inAstrom->fpa, sf->chip, false, NULL, 85 sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, sf->inAstrom->fpa, sf->chip, false, NULL, 86 86 sf->warpedPixels->numCols, sf->warpedPixels->numRows); 87 87 … … 106 106 // convert corner of skycell to sky coordinates 107 107 if (!pmAstromWCStoSky(&sky, wcs, &pt[i])) { 108 psError (PS_ERR_IO, false, "failed to convert pt %d of %s to sky coords: %s", fileName);108 psErrorStackPrint(stderr, "failed to convert pt %d of %s to sky coords", i, fileName); 109 109 streaksExit("", PS_EXIT_DATA_ERROR); 110 110 } … … 112 112 // convert to chip coordinates 113 113 if (!skyToCell(&p, sf->astrom, sky.r, sky.d)) { 114 psError (PS_ERR_IO, false, "failed to convert pt %d of %s to sky coords: %s", fileName);114 psErrorStackPrint(stderr, "failed to convert pt %d of %s to sky coords", i, fileName); 115 115 streaksExit("", PS_EXIT_DATA_ERROR); 116 116 } … … 171 171 } 172 172 173 // x as a function of y for the line between two points 173 // x as a function of y for the line between two points 174 174 // Note: the caller guarentees that the y's of the two points are different 175 175 static double xOfY(psPlane *pI, psPlane *pJ, int y) … … 212 212 * To compute the overlap of a quadrilateral with a set of 213 213 * points we transform the 4 corners to image coordinates 214 * and name the 4 points of the quad 214 * and name the 4 points of the quad 215 215 pt 0 is left most (bottom most corner) 216 216 pt 1 is bottom most (right most corner) … … 238 238 239 239 3 240 C 240 C 241 241 ---------------2 left boundary: line 0_1 y < pt0.y 242 242 B line 0_3 y >= pt0.y … … 249 249 C 250 250 0---------------- 251 B 251 B 252 252 ----------------2 253 253 A … … 258 258 259 259 3 2 260 260 261 261 B 262 262 … … 265 265 (region A and C are empty in the case where the points form a rectangle) 266 266 */ 267 267 268 268 /* 269 269 Name the corners 270 The following algorithm works for points that form a quadrilateral 270 The following algorithm works for points that form a quadrilateral 271 271 I think it also works for the situation where 3 points are co-linear 272 272 and we have a triangle, but that isn't important for our purposes … … 313 313 pt[i] = pt[i+1]; 314 314 } 315 315 316 316 // now find the right most (top most) of the remaining 2 points 317 317 if ((pt[0].x > pt[1].x) || -
branches/czw_branch/cleanup/ppMops/src/ppMops.c
r25154 r25158 6 6 int main(int argc, char *argv[]) 7 7 { 8 if (argc != 7) {8 if (argc != 6) { 9 9 fprintf(stderr, "Insufficient arguments.\n"); 10 fprintf(stderr, "Usage: %s DETECTIONS ZP EXP_ID EXP_NAME DIRECTIONOUTPUT\n", argv[0]);10 fprintf(stderr, "Usage: %s DETECTIONS ZP EXP_ID EXP_NAME OUTPUT\n", argv[0]); 11 11 exit(PS_EXIT_CONFIG_ERROR); 12 12 } … … 17 17 data->exp_id = atoll(argv[3]); 18 18 data->exp_name = psStringCopy(argv[4]); 19 data->direction = atoi(argv[5]); 20 data->output = psStringCopy(argv[6]); 19 data->output = psStringCopy(argv[5]); 21 20 22 21 if (!isfinite(data->zp)) { … … 129 128 psMetadataLookupF32(NULL, header, "FWHM_MIN")); 130 129 130 131 131 psMetadataAddStr(outHeader, PS_LIST_TAIL, "RA", 0, "Right ascension of boresight", ra); 132 132 psMetadataAddStr(outHeader, PS_LIST_TAIL, "DEC", 0, "Declination of boresight", dec); … … 141 141 psMetadataAddStr(outHeader, PS_LIST_TAIL, "FPA_ID", 0, "Exposure name", data->exp_name); 142 142 psMetadataAddS64(outHeader, PS_LIST_TAIL, "EXP_ID", 0, "Exposure identifier", data->exp_id); 143 psMetadataAddBool(outHeader, PS_LIST_TAIL, "POSITIVE", 0, "Positive subtraction?", data->direction);144 143 psMetadataAddStr(outHeader, PS_LIST_TAIL, "OBSCODE", 0, "IAU Observatory code", OBSERVATORY_CODE); 145 144 psMetadataAddF32(outHeader, PS_LIST_TAIL, "STARPSF", 0, "Stellar PSF (arcsec)", psf); 146 145 147 146 // These are completely fake 148 psMetadataAddF32(outHeader, PS_LIST_TAIL, "LIMITMAG", 0, "Limiting magnitude (FAKE)", 99.0);147 psMetadataAddF32(outHeader, PS_LIST_TAIL, "LIMITMAG", 0, "Limiting magnitude (FAKE)", 25.0); 149 148 psMetadataAddF32(outHeader, PS_LIST_TAIL, "DE1", 0, "Detection efficiency (FAKE)", 0.0); 150 149 psMetadataAddF32(outHeader, PS_LIST_TAIL, "DE2", 0, "Detection efficiency (FAKE)", 0.0); -
branches/czw_branch/cleanup/ppMops/src/ppMops.h
r25154 r25158 16 16 psString detections; // Detections filename 17 17 float zp; // Magnitude zero point 18 bool direction; // Direction of subtraction, 1=positive, 0=negative 18 psS64 exp_id; // Exposure identifier 19 psString exp_name; // Exposure name 19 20 psString output; // Output filename 20 21 } ppMopsData; -
branches/czw_branch/cleanup/ppMops/src/ppMopsData.c
r24242 r25158 11 11 { 12 12 psFree(data->detections); 13 psFree(data->exp_name); 13 14 psFree(data->output); 14 15 return; … … 22 23 data->detections = NULL; 23 24 data->zp = NAN; 25 data->exp_id = 0; 26 data->exp_name = NULL; 24 27 data->output = NULL; 25 28 -
branches/czw_branch/cleanup/ppStack/src/ppStackCombineFinal.c
r25152 r25158 56 56 } 57 57 psKernel *covar = options->covariances->data[i]; // Covariance matrix 58 if (!covar) { 59 continue; 60 } 58 61 float weight = options->weightings->data.F32[i]; // Weight to apply 59 62 psBinaryOp(covar->image, covar->image, "*", psScalarAlloc(weight, PS_TYPE_F32)); -
branches/czw_branch/cleanup/psLib/src/fits/psFitsHeader.c
r25051 r25158 50 50 51 51 // List of the start of FITS header keys not to write (handled by cfitsio); NULL-terminated 52 static const char *noWriteFitsKeyStarts[] = { "NAXIS", "TTYPE", "TFORM", NULL };52 static const char *noWriteFitsKeyStarts[] = { "NAXIS", "TTYPE", "TFORM", "TZERO", "TSCAL", NULL }; 53 53 54 54 // List of compressed FITS header keys not to write (handled by cfitsio); NULL-terminated … … 305 305 keyType = 'C'; 306 306 } 307 psTrace("psLib.fits", 3, "Reading keyword %s, type %c\n", keyName, keyType); 307 308 if (status != 0) { 308 309 break; … … 327 328 -INFINITY); 328 329 } else { 329 success = psMetadataAddS32(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment, 330 atoi(keyValue)); 330 long long value = atoll(keyValue); // Value 331 if (value > PS_MIN_S32 && value < PS_MAX_S32) { 332 success = psMetadataAddS32(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment, 333 value); 334 } else { 335 success = psMetadataAddS64(header, PS_LIST_TAIL, keyNameTrans, dupFlag, keyComment, 336 value); 337 } 331 338 } 332 339 break; … … 509 516 psMetadataItem *simpleItem = psMetadataLookup(output, "SIMPLE"); // SIMPLE in the header 510 517 if (simpleItem) { 511 if (simpleItem->type != PS_DATA_BOOL) { 512 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "SIMPLE in a FITS header must be of boolean type: " 513 "not %x --- assuming FALSE.\n", simpleItem->type); 518 if (simpleItem->type != PS_DATA_BOOL || !simpleItem->data.B) { 514 519 int value = false; // Temporary holder for boolean 520 psWarning("Writing SIMPLE=F to FITS header by request"); 515 521 fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value, 516 522 "File does not conform to FITS standard", &status); 517 523 simple = false; 518 } else if (!simpleItem->data.B) {519 simple = false;520 int value = false; // Temporary holder for boolean521 fits_update_key(fits->fd, TLOGICAL, "SIMPLE", &value,522 "File does not conform to FITS standard", &status);523 524 } 524 525 // Uncompressed SIMPLE = T is taken care of by cfitsio. … … 546 547 char comment[FLEN_CARD]; // Comment for ZIMAGE; unused 547 548 int value; // Value for ZIMAGE; unused 549 psTrace("psLib.fits", 3, "Writing header ZSIMPLE to preserve PHU"); 548 550 fits_read_key(fits->fd, TLOGICAL, "ZIMAGE", &value, comment, &status); 549 551 fits_insert_key_log(fits->fd, "ZSIMPLE", simple, "Uncompressed file's conforms to FITS", &status); … … 575 577 if (keywordInList(name, noWriteCompressedKeys) || 576 578 (keyStarts && keywordStartsWith(name, noWriteCompressedKeyStarts))) { 579 psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name); 577 580 continue; 578 581 } 579 582 } else if (keywordInList(name, noWriteCompressedKeys) || 580 583 (keyStarts && keywordStartsWith(name, noWriteCompressedKeyStarts))) { 584 psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name); 581 585 continue; 582 586 } … … 584 588 if (keywordInList(name, noWriteFitsKeys) || 585 589 (keyStarts && keywordStartsWith(name, noWriteFitsKeyStarts))) { 590 psTrace("psLib.fits", 3, "Not writing FITS keyword %s", name); 586 591 continue; 587 592 } … … 592 597 psWarning("COMMENT header is not of type STRING (%x) --- ignored.", item->type); 593 598 } else { 599 psTrace("psLib.fits", 5, "Writing header COMMENT: %s", item->data.str); 594 600 fits_write_comment(fits->fd, item->data.str, &status); 595 601 } … … 598 604 psWarning("COMMENT header is not of type STRING (%x) --- ignored.", item->type); 599 605 } else { 606 psTrace("psLib.fits", 5, "Writing header HISTORY: %s", item->data.str); 600 607 fits_write_history(fits->fd, item->data.str, &status); 601 608 } … … 605 612 case PS_DATA_BOOL: { 606 613 int value = item->data.B; 614 psTrace("psLib.fits", 5, "Writing BOOL header %s: %d", name, value); 607 615 fits_update_key(fits->fd, TLOGICAL, name, &value, item->comment, &status); 608 616 break; 609 617 } 610 618 case PS_DATA_S8: 619 psTrace("psLib.fits", 5, "Writing S8 header %s: %d", name, (int)item->data.S8); 611 620 fits_update_key(fits->fd, TBYTE, name, &item->data.S8, item->comment, &status); 612 621 break; 613 622 case PS_DATA_S16: 623 psTrace("psLib.fits", 5, "Writing S16 header %s: %d", name, (int)item->data.S16); 614 624 fits_update_key(fits->fd, TSHORT, name, &item->data.S16, item->comment, &status); 615 625 break; 616 626 case PS_DATA_S32: 627 psTrace("psLib.fits", 5, "Writing S32 header %s: %d", name, (int)item->data.S32); 617 628 fits_update_key(fits->fd, TINT, name, &item->data.S32, item->comment, &status); 618 629 break; 619 630 case PS_DATA_S64: 631 psTrace("psLib.fits", 5, "Writing S64 header %s: %" PRId64, name, item->data.S64); 620 632 fits_update_key(fits->fd, TLONGLONG, name, &item->data.S64, item->comment, &status); 621 633 break; 622 634 case PS_DATA_U8: { 623 635 unsigned short int temp = item->data.U8; 636 psTrace("psLib.fits", 5, "Writing U8 header %s: %d", name, (int)item->data.U8); 624 637 fits_update_key(fits->fd, TUSHORT, name, &temp, item->comment, &status); 625 638 break; 626 639 } 627 640 case PS_DATA_U16: 641 psTrace("psLib.fits", 5, "Writing U16 header %s: %d", name, (int)item->data.U16); 628 642 fits_update_key(fits->fd, TUSHORT, name, &item->data.U16, item->comment, &status); 629 643 break; 630 644 case PS_DATA_U32: 645 psTrace("psLib.fits", 5, "Writing U32 header %s: %d", name, (unsigned int)item->data.U32); 631 646 fits_update_key(fits->fd, TUINT, name, &item->data.U32, item->comment, &status); 632 647 break; … … 639 654 } 640 655 psS64 temp = item->data.U64; // Signed version 656 psTrace("psLib.fits", 5, "Writing U64 header %s: %" PRIu64, name, item->data.U64); 641 657 fits_update_key(fits->fd, TLONGLONG, name, &temp, item->comment, &status); 642 658 break; 643 659 case PS_DATA_F32: { 644 660 int infCheck = 0; // Result of isinf() 661 psTrace("psLib.fits", 5, "Writing F32 header %s: %f", name, item->data.F32); 645 662 if (isnan(item->data.F32)) { 646 663 fits_update_key(fits->fd, TSTRING, name, "NaN", item->comment, &status); … … 659 676 case PS_DATA_F64: { 660 677 int infCheck = 0; // Result of isinf() 678 psTrace("psLib.fits", 5, "Writing F32 header %s: %lf", name, item->data.F64); 661 679 if (isnan(item->data.F64)) { 662 680 fits_update_key(fits->fd, TSTRING, name, "NaN", item->comment, &status); … … 674 692 } 675 693 case PS_DATA_STRING: 694 psTrace("psLib.fits", 5, "Writing STR header %s: %s", name, item->data.str); 676 695 fits_update_key(fits->fd, TSTRING, name, item->data.V, item->comment, &status); 677 696 break; -
branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionAnalysis.c
r25148 r25158 42 42 psFree(subRegion); 43 43 44 psMetadataAddStr(header, PS_LIST_TAIL, PM_SUBTRACTION_ANALYSIS_REGION, PS_META_DUPLICATE_OK, 44 psMetadataAddPtr(header, PS_LIST_TAIL, PM_SUBTRACTION_ANALYSIS_REGION, 45 PS_DATA_REGION | PS_META_DUPLICATE_OK, 45 46 "Region over which subtraction was performed", string); 46 47 psFree(string); -
branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionAnalysis.h
r21149 r25158 27 27 bool pmSubtractionAnalysis( 28 28 psMetadata *analysis, ///< Metadata container for QA information 29 psMetadata *header, ///< Metadata container for QA information to put in header 29 30 pmSubtractionKernels *kernels, ///< Kernels 30 31 psRegion *region, ///< Region for subtraction -
branches/czw_branch/cleanup/psModules/src/imcombine/pmSubtractionMatch.c
r25148 r25158 10 10 #include "pmHDU.h" 11 11 #include "pmFPA.h" 12 #include "pmHDUUtils.h" 12 13 #include "pmSubtractionParams.h" 13 14 #include "pmSubtractionKernels.h" … … 58 59 59 60 60 static bool getStamps(pmSubtractionStampList **stamps, // Stamps to read61 const pmReadout *ro1, // Readout 162 const pmReadout *ro2, // Readout 263 const psImage *subMask, // Mask for subtraction, or NULL64 psImage *variance, // Variance map65 const psRegion *region, // Region of interest, or NULL66 float thresh1, // Threshold for stamp finding on readout 167 float thresh2, // Threshold for stamp finding on readout 268 float stampSpacing, // Spacing between stamps69 int size, // Kernel half-size70 int footprint, // Convolution footprint for stamps71 pmSubtractionMode mode // Mode for subtraction61 static bool subtractionGetStamps(pmSubtractionStampList **stamps, // Stamps to read 62 const pmReadout *ro1, // Readout 1 63 const pmReadout *ro2, // Readout 2 64 const psImage *subMask, // Mask for subtraction, or NULL 65 psImage *variance, // Variance map 66 const psRegion *region, // Region of interest, or NULL 67 float thresh1, // Threshold for stamp finding on readout 1 68 float thresh2, // Threshold for stamp finding on readout 2 69 float stampSpacing, // Spacing between stamps 70 int size, // Kernel half-size 71 int footprint, // Convolution footprint for stamps 72 pmSubtractionMode mode // Mode for subtraction 72 73 ) 73 74 { … … 163 164 } 164 165 166 static void subtractionAnalysisUpdate(pmReadout *conv1, pmReadout *conv2, // Convolved images 167 const psMetadata *analysis, // Analysis metadata 168 const psMetadata *header // Header metadata 169 ) 170 { 171 if (conv1) { 172 conv1->analysis = psMetadataCopy(conv1->analysis, analysis); 173 } 174 if (conv2) { 175 conv2->analysis = psMetadataCopy(conv2->analysis, analysis); 176 } 177 178 if (conv1 && conv1->parent) { 179 pmHDU *hdu = pmHDUFromCell(conv1->parent); 180 if (hdu) { 181 hdu->header = psMetadataCopy(hdu->header, header); 182 } 183 } 184 if (conv2 && conv2->parent) { 185 pmHDU *hdu = pmHDUFromCell(conv2->parent); 186 if (hdu) { 187 hdu->header = psMetadataCopy(hdu->header, header); 188 } 189 } 190 191 return; 192 } 165 193 166 194 … … 253 281 254 282 psMetadata *outAnalysis = psMetadataAlloc(); // Output analysis values 283 psMetadata *outHeader = psMetadataAlloc(); // Output header values 255 284 256 285 psTrace("psModules.imcombine", 2, "Convolving...\n"); … … 259 288 psRegion *region = regions->data[i]; // Region of interest 260 289 261 if (!pmSubtractionAnalysis(outAnalysis, kernel, region, ro1->image->numCols, ro1->image->numRows)) { 290 if (!pmSubtractionAnalysis(outAnalysis, outHeader, kernel, region, 291 ro1->image->numCols, ro1->image->numRows)) { 262 292 psError(PS_ERR_UNKNOWN, false, "Unable to generate QA data"); 263 293 psFree(outAnalysis); 294 psFree(outHeader); 264 295 psFree(subMask); 265 296 psFree(kernels); … … 272 303 psError(PS_ERR_UNKNOWN, false, "Unable to convolve image."); 273 304 psFree(outAnalysis); 305 psFree(outHeader); 274 306 psFree(subMask); 275 307 psFree(kernels); … … 283 315 psFree(regions); 284 316 285 if (conv1) { 286 psMetadataCopy(conv1->analysis, outAnalysis); 287 } 288 if (conv2) { 289 psMetadataCopy(conv2->analysis, outAnalysis); 290 } 317 subtractionAnalysisUpdate(conv1, conv2, outAnalysis, outHeader); 291 318 psFree(outAnalysis); 319 psFree(outHeader); 292 320 293 321 return true; … … 369 397 pmSubtractionKernels *kernels = NULL; // Kernel basis functions 370 398 psMetadata *analysis = psMetadataAlloc(); // QA data 399 psMetadata *header = psMetadataAlloc(); // QA data for header 371 400 372 401 int numCols = ro1->image->numCols, numRows = ro1->image->numRows; // Image dimensions … … 442 471 // We get the stamps here; we will also attempt to get stamps at the first iteration, but it 443 472 // doesn't matter. 444 if (! getStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2,473 if (!subtractionGetStamps(&stamps, ro1, ro2, subMask, variance, NULL, stampThresh1, stampThresh2, 445 474 stampSpacing, size, footprint, subMode)) { 446 475 goto MATCH_ERROR; … … 508 537 psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k); 509 538 510 if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2, 511 stampSpacing, size, footprint, subMode)) { 539 if (!subtractionGetStamps(&stamps, ro1, ro2, subMask, variance, region, 540 stampThresh1, stampThresh2, stampSpacing, 541 size, footprint, subMode)) { 512 542 goto MATCH_ERROR; 513 543 } … … 569 599 memCheck("solution"); 570 600 571 if (!pmSubtractionAnalysis(analysis, kernels, region, numCols, numRows)) {601 if (!pmSubtractionAnalysis(analysis, header, kernels, region, numCols, numRows)) { 572 602 psError(PS_ERR_UNKNOWN, false, "Unable to generate QA data"); 573 603 goto MATCH_ERROR; … … 605 635 memCheck("convolution"); 606 636 607 if (conv1) { 608 psMetadataCopy(conv1->analysis, analysis); 609 } 610 if (conv2) { 611 psMetadataCopy(conv2->analysis, analysis); 612 } 637 subtractionAnalysisUpdate(conv1, conv2, analysis, header); 613 638 psFree(analysis); 639 psFree(header); 614 640 615 641 #ifdef TESTING … … 633 659 MATCH_ERROR: 634 660 psFree(analysis); 661 psFree(header); 635 662 psFree(region); 636 663 psFree(regionString); -
branches/czw_branch/cleanup/pstamp/scripts/pstamp_finish.pl
r25143 r25158 94 94 if (!mkdir $out_dir) { 95 95 print STDERR "cannot create output directory $out_dir"; 96 stop_request _and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);96 stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR); 97 97 } 98 98 … … 102 102 # request 103 103 print STDERR "output directory $out_dir exists but is not a directory"; 104 stop_request _and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);104 stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR); 105 105 } 106 106 107 107 if (! -e $req_file ) { 108 108 print STDERR "request file $req_file is missing\n"; 109 stop_request _and_exit($req_id, $PS_EXIT_CONFIG_ERROR);109 stop_request($req_id, $PS_EXIT_CONFIG_ERROR); 110 110 } 111 111 … … 117 117 # point 118 118 print STDERR "failed to read request_file $req_file" ; 119 stop_request _and_exit($req_id, $PS_EXIT_CONFIG_ERROR);119 stop_request($req_id, $PS_EXIT_CONFIG_ERROR); 120 120 } 121 121 … … 154 154 print STDERR "Request $req_id produced no jobs.\n" 155 155 } 156 # This should not happen. A fake job should be queued 157 stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR); 156 # No Jobs. 157 # XXXX Ouch. We need results for each rownum (each request specification) in the request file 158 # including those that produced no jobs. 159 # for now add an entry for rownum 1 and a phony error code. 160 # we've included parse_error.txt to the fileset if it exists 161 # 162 my $rownum = 0; 163 my $fault = 42; # get a real error code 164 print $tdf "$rownum|$fault|0|0|"; 165 print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n"; 158 166 } else { 159 167 my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc"); … … 174 182 my $exp_id = $job->{exp_id}; 175 183 176 if ($fault eq $PSTAMP_DUP_REQUEST) {177 # this request had a duplicate request name. We can't put the results178 # on the data store since the product name is already used179 # maybe we could be more clever about this and choose a fileset name180 stop_request_and_exit($req_id, $fault);181 }182 183 184 my ($row, $req_info, $project) = get_request_info($rows, $rownum); 184 185 … … 188 189 carp("failed to find imagedb for project: $project"); 189 190 if (!$fault) { 190 stop_request _and_exit($req_id, $PS_EXIT_CONFIG_ERROR);191 stop_request($req_id, $PS_EXIT_CONFIG_ERROR); 191 192 } 192 193 } … … 279 280 } 280 281 281 sub stop_request _and_exit{282 sub stop_request { 282 283 my $req_id = shift; 283 284 my $fault = shift; -
branches/czw_branch/cleanup/pstamp/scripts/pstamp_job_run.pl
r25143 r25158 11 11 use Sys::Hostname; 12 12 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 13 use Carp; 13 14 use File::Basename; 14 15 use Digest::MD5::File qw( file_md5_hex ); … … 137 138 } 138 139 } elsif ($jobType eq "get_image") { 139 my_die( "get_image jobs not working right now", $job_id, $PS_EXIT_ CONFIG_ERROR);140 my_die( "get_image jobs not working right now", $job_id, $PS_EXIT_PROG_ERROR); 140 141 141 142 my $uri = ""; -
branches/czw_branch/cleanup/pstamp/scripts/pstamp_parser_run.pl
r25051 r25158 200 200 unlink $error_file_name if (-e $error_file_name); 201 201 202 # Run the parser 203 202 204 my $command = "$parse_cmd"; 203 205 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = -
branches/czw_branch/cleanup/pstamp/scripts/pstampparse.pl
r25143 r25158 14 14 use PS::IPP::PStamp::Job qw( :standard ); 15 15 use File::Temp qw(tempfile); 16 use Carp;17 16 18 17 my $verbose; … … 97 96 my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1"); 98 97 99 # check for duplicate request name 100 if (!$no_update) { 98 { 101 99 my $command = "$pstamptool -listreq -name $req_name"; 102 100 $command .= " -dbname $dbname" if $dbname; 103 101 $command .= " -dbserver $dbserver" if $dbserver; 104 # no verbose so that error message about request not found doesn't appear in parse_error.txt105 102 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 106 run(command => $command, verbose => 0);103 run(command => $command, verbose => $verbose); 107 104 my $exitStatus = $error_code >> 8; 108 105 if ($success) { … … 186 183 187 184 my $option_mask= $row->{OPTION_MASK}; 188 my $inverse = ($option_mask & $PSTAMP_SELECT_INVERSE) ? 1 : 0;189 $row->{inverse} = $inverse;190 185 191 186 my $skycenter = $row->{skycenter} = ! ($row->{COORD_MASK} & $PSTAMP_CENTER_IN_PIXELS); … … 252 247 next; 253 248 } else { 254 # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this249 # Call PS::IPP::PStamp::Job's locate_images subroutine to get the parameters for this 255 250 # request specification. An array reference is returned. 256 251 my ($x, $y); 257 258 252 $imageList = locate_images($ipprc, $image_db, $req_type, $stage, $id, $search_component, 259 $inverse, $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose); 260 253 $skycenter, $x, $y, $mjd_min, $mjd_max, $filter, $verbose); 261 254 if (!$imageList or !@$imageList) { 262 255 print STDERR "no matching images found for row $rownum\n" if $verbose; … … 289 282 my $have_skycells = shift; 290 283 my $need_magic = shift; 291 my $num_jobs = 0;292 284 293 285 my $rownum = $row->{ROWNUM}; 294 286 295 287 my $components = $row->{components}; 288 my $numComponents = scalar keys %$components; 289 if ( $numComponents == 0 ) { 290 print STDERR "no jobs for row $rownum\n" if $verbose; 291 insertFakeJobForRow($row, 1, $PSTAMP_NO_JOBS_QUEUED); 292 return 1; 293 } 296 294 297 295 my $roi_string; … … 374 372 my $fault = 0; 375 373 376 if (($stage ne 'stack') and ($stage ne 'raw')) { 377 if (($image->{state} eq 'goto_purged') or ($image->{data_state} eq 'purged')) { 378 $newState = 'stop'; 379 $fault = $PSTAMP_GONE; 380 } elsif (($image->{data_state} ne 'full') or ($image->{state} ne 'full' )) { 381 # XXX here is where we need to queue an update job 382 # for now just say that the image is not available 383 $newState = 'stop'; 384 $fault = $PSTAMP_NOT_AVAILABLE; 385 } 386 } 374 if (0) { 375 # XXX this doesn't work because not all ippTools outputs include data_state 376 # fix chipTool also need to not make this test for raw stage 377 if ((($stage ne 'stack') and ($image->{data_state} ne 'full')) or $image->{state} ne 'full' ){ 378 # XXX here is where we need to queue an update job 379 # for now just say that the image is not available 380 $newState = 'stop'; 381 $fault = 49; 382 } 383 } 387 384 388 385 $num_jobs++; … … 412 409 print "skipping command: $command\n"; 413 410 } 414 }415 if ( $num_jobs == 0 ) {416 print STDERR "no jobs for row $rownum\n" if $verbose;417 insertFakeJobForRow($row, 1, $PSTAMP_NO_OVERLAP);418 $num_jobs = 1;419 411 } 420 412 return $num_jobs; … … 624 616 return 0 if ($r1->{IMG_TYPE} ne $r2->{IMG_TYPE}); 625 617 return 0 if ($r1->{ID} ne $r2->{ID}); 626 return 0 if ($r1->{inverse} ne $r2->{inverse});627 618 628 619 if (defined($r1->{COMPONENT})) { -
branches/czw_branch/cleanup/pstamp/src/pstamp.h
r18243 r25158 8 8 #include "pslib.h" 9 9 #include "psmodules.h" 10 // #include "psphot.h"11 // #include "psastro.h"12 // #include "ppStats.h"13 10 #include "pstampErrorCodes.h" 14 11 … … 31 28 } pspMode; 32 29 30 // error codes returned to users in results flie 31 // These must match the values in PS-IPP-PStamp/lib/PS/IPP/PStamp/RequestFile.pm 32 typedef enum { 33 PSTAMP_SUCCESS = 0, 34 PSTAMP_SYSTEM_ERROR = 10, 35 PSTAMP_NOT_IMPLEMENTED = 11, 36 PSTAMP_UNKNOWN_ERROR = 12, 37 PSTAMP_DUP_REQUEST = 20, 38 PSTAMP_INVALID_REQUEST = 21, 39 PSTAMP_UNKNOWN_PRODUCT = 22, 40 PSTAMP_NO_IMAGE_MATCH = 23, 41 PSTAMP_NOT_DESTREAKED = 24, 42 PSTAMP_NOT_AVAILABLE = 25, 43 PSTAMP_GONE = 26, 44 PSTAMP_NO_JOBS_QUEUED = 27 45 } pstampJobErrors; 46 47 33 48 #define PSTAMP_SELECT_IMAGE 1 34 49 #define PSTAMP_SELECT_MASK 2 … … 44 59 #define STAMP_RESULTS_VERSION "1" 45 60 61 62 46 63 #endif -
branches/czw_branch/cleanup/pstamp/src/pstampdump.c
r21404 r25158 1 // pstampdump - read a fits table describing a postage stamp request or response file and1 // pstampdump - read a fits file containing a postage stamp request or response table and 2 2 // print the contents to stdout 3 3 // 4 // Actually should work for any kind of fits table, but I'm not sure what will5 // happen for binary data.4 // Actually this should work fine for dumping the rows of any of any kind of fits table 5 // The -header option is pstamp table specific 6 6 7 7 #include <pslib.h> … … 9 9 #include <string.h> 10 10 11 static psArray *readRequestTable(psString fileName)11 static bool readFitsFile(psString fileName, psMetadata **pHeader, psArray **pTable) 12 12 { 13 psFits *fits File= psFitsOpen(fileName, "r");14 if (fits File== NULL) {13 psFits *fits = psFitsOpen(fileName, "r"); 14 if (fits == NULL) { 15 15 psError(PS_ERR_IO, false, "failed to open %s for output", fileName); 16 return NULL; 16 return false; 17 } 18 if (!psFitsMoveExtNum(fits, 1, true)) { 19 psError(PS_ERR_IO, false, "failed to move to first extension from %s", fileName); 20 return false; 17 21 } 18 22 19 psArray *array = psFitsReadTable(fitsFile); 23 if (pHeader) { 24 *pHeader = psFitsReadHeader(NULL, fits); 25 if (!*pHeader) { 26 psError(PS_ERR_IO, false, "failed to header from %s", fileName); 27 return false; 28 } 29 } 20 30 21 psFitsClose(fitsFile); 31 if (pTable) { 32 *pTable = psFitsReadTable(fits); 33 if (*pTable == NULL) { 34 psError(PS_ERR_IO, false, "psFitsReadTable failed for %s", fileName); 35 return false; 36 } 37 } 22 38 23 if (array == NULL) { 24 psError(PS_ERR_IO, false, "psFitsReadTable failed for %s", fileName); 25 return NULL; 26 } 39 psFitsClose(fits); 27 40 28 return array;41 return true; 29 42 } 30 43 … … 32 45 usage(char *program_name) 33 46 { 34 fprintf(stderr, "usage: %s filename\n", program_name);47 fprintf(stderr, "usage: %s [-header] [-simple] filename\n", program_name); 35 48 exit(1); 36 49 } 50 37 51 int main(int argc, char *argv[]) 38 52 { 53 bool dumpHeader = false; 54 bool simple = false; 55 bool dumpTable = true; 56 int argnum; 57 if ((argnum = psArgumentGet(argc, argv, "-header"))) { 58 dumpHeader = true; 59 psArgumentRemove(argnum, &argc, argv); 60 } 61 if ((argnum = psArgumentGet(argc, argv, "-simple"))) { 62 simple = true; 63 psArgumentRemove(argnum, &argc, argv); 64 } 65 if ((argnum = psArgumentGet(argc, argv, "-headeronly"))) { 66 dumpTable = false; 67 dumpHeader = true; 68 psArgumentRemove(argnum, &argc, argv); 69 } 70 39 71 if (argc != 2) { 40 72 usage(argv[0]); … … 43 75 psString fileName = argv[1]; 44 76 45 psArray *array = readRequestTable(fileName); 46 if (array == NULL) { 47 psErrorStackPrint(stderr, "failed to read fits table: %s\n", fileName); 77 psMetadata *header; 78 psArray *array; 79 if (!readFitsFile(fileName, dumpHeader ? &header : NULL, dumpTable ? &array : NULL)) { 80 psErrorStackPrint(stderr, "failed to process fits table from: %s\n", fileName); 81 return 1; 82 } 83 if (dumpHeader) { 84 psString extname = psMetadataLookupStr(NULL, header, "EXTNAME"); 85 if (!extname) { 86 psErrorStackPrint(stderr, "failed to find EXTNAME in fits header of: %s\n", fileName); 87 return 1; 88 } 89 psString req_name = psMetadataLookupStr(NULL, header, "REQ_NAME"); 90 if (!req_name) { 91 psErrorStackPrint(stderr, "failed to find REQ_NAME in fits header of: %s\n", fileName); 92 return 1; 93 } 94 if (!strcmp(extname, "PS1_PS_REQUEST")) { 95 psString extver = psMetadataLookupStr(NULL, header, "EXTVER"); 96 if (!extver) { 97 psErrorStackPrint(stderr, "failed to find EXTVER in fits header of: %s\n", fileName); 98 return 1; 99 } 100 printf("%s %s %s\n", extname, extver, req_name); 101 } else if (!strcmp(extname, "PS1_PS_RESULTS")) { 102 psS64 req_id = psMetadataLookupS64(NULL, header, "REQ_ID"); 103 printf("%s %s %" PRId64 "\n", extname, req_name, req_id); 104 } else { 105 psErrorStackPrint(stderr, "do not recognize extname: %s in %s\n", extname, fileName); 106 return 1; 107 } 108 } 109 if (!dumpTable) { 110 // done 111 return 0; 112 } 113 114 if (!psArrayLength(array)) { 115 fprintf(stderr, "%s contains an empty table\n", fileName); 48 116 return 1; 49 117 } 50 118 51 if (!psArrayLength(array)) {52 fprintf(stderr, "%s is an empty table\n", fileName);53 exit(1);54 }55 56 // printf("FITS_TABLE METADATA\n");57 119 for (int i=0; i<psArrayLength(array); i++) { 58 printf("ROW_%d METADATA\n", i);59 // psMetadataPrint(stderr, array->data[i], 0);60 // psMetadataConfigWrite(array->data[i], "-");61 120 psString str = psMetadataConfigFormat(array->data[i]); 62 121 if (!str) { 63 psErrorStackPrint(stderr, " Can't write to STDOUT\n");64 exit(PS_EXIT_SYS_ERROR);122 psErrorStackPrint(stderr, "failed to format metadata item\n"); 123 return (PS_EXIT_SYS_ERROR); 65 124 } 66 printf("%s", str); 67 printf("END\n"); 125 if (!simple) { 126 printf("ROW_%d METADATA\n", i); 127 printf("%s", str); 128 printf("END\n"); 129 } else { 130 // simple output format space separated values one line per row 131 char *p = str; 132 char *pnl; 133 while ((pnl = strchr(p, '\n'))) { 134 // terminate the string for this line 135 *pnl = 0; 136 bool blank = (p == pnl); 137 if (blank) { 138 p = pnl + 1; 139 continue; 140 } 141 // split line into space separated tokens 142 char *name = strtok(p, " "); 143 char *type = strtok(NULL, " "); 144 char *val = strtok(NULL, " "); 145 146 // avoid unused variables warning/error 147 (void) name; (void) type; 148 149 if (val) { 150 printf("%s ", val); 151 } 152 // next line 153 p = pnl + 1; 154 } 155 printf("\n"); 156 } 68 157 } 69 // printf("END\n");70 158 71 159 return 0; -
branches/czw_branch/cleanup/tools/diff_outputs.pl
r24224 r25158 16 16 'SOURCES', 'JPEG1', 'JPEG2', 17 17 'KERNEL' ], 18 'ALL' => [ 'IMAGE', 'MASK', 'VARIANCE', 19 ' SOURCES', 'JPEG1', 'JPEG2',20 ' KERNEL', 'INVERSE.IMAGE',21 ' INVERSE.MASK', 'INVERSE.VARIANCE',22 'INVERSE.SOURCES'],18 'ALL' => [ 'IMAGE', 'MASK', 'VARIANCE', 'SOURCES', 'JPEG1', 'JPEG2', 'KERNEL', 19 'INVERSE.IMAGE', 'INVERSE.MASK', 'INVERSE.VARIANCE', 'INVERSE.SOURCES', 20 'INCONV.IMAGE', 'INCONV.MASK', 'INCONV.VARIANCE', 21 'REFCONV.IMAGE', 'REFCONV.MASK', 'REFCONV.VARIANCE', 22 ], 23 23 'INVERSE' => [ 'INVERSE.IMAGE', 'INVERSE.MASK', 24 24 'INVERSE.VARIANCE', … … 38 38 'INVERSE.VARIANCE' => '.inv.wt.fits', # Variance 39 39 'INVERSE.SOURCES' => '.inv.cmf', # Sources 40 'INCONV.IMAGE' => '.inConv.fits', # Convolved input image 41 'INCONV.MASK' => '.inConv.mk.fits', # Convolved input mask 42 'INCONV.VARIANCE' => '.inConv.wt.fits', # Convolved input variance 43 'REFCONV.IMAGE' => '.refConv.fits', # Convolved reference image 44 'REFCONV.MASK' => '.refConv.mk.fits', # Convolved reference mask 45 'REFCONV.VARIANCE' => '.refConv.wt.fits', # Convolved reference variance 40 46 }; 41 47
Note:
See TracChangeset
for help on using the changeset viewer.
