Changeset 30675
- Timestamp:
- Feb 17, 2011, 3:19:36 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213
- Files:
-
- 20 edited
- 2 copied
-
DataStore/scripts/dsgetfileset (modified) (2 diffs)
-
ippTools/share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
ippTools/share/disttool_pending_raw.sql (modified) (5 diffs)
-
ippTools/share/magicdstool_torevert_camera.sql (modified) (1 diff)
-
ippTools/share/magicdstool_torevert_chip.sql (modified) (1 diff)
-
ippTools/share/magicdstool_torevert_diff.sql (modified) (1 diff)
-
ippTools/share/magicdstool_torevert_raw.sql (modified) (1 diff)
-
ippTools/share/magicdstool_torevert_warp.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/magicdstool.c (modified) (9 diffs)
-
ippTools/src/magictool.c (modified) (1 prop)
-
ippTools/src/regtool.c (modified) (5 diffs)
-
ippTools/src/regtoolConfig.c (modified) (1 diff)
-
ppTranslate/src/ppMonet.c (modified) (1 diff)
-
ppTranslate/src/ppMopsDetections.c (modified) (1 diff)
-
ppTranslate/src/ppMopsMerge.c (modified) (2 diffs)
-
ppTranslate/src/ppMopsRead.c (modified) (4 diffs)
-
tools/examine_burntool_pcontrol.pl (modified) (5 diffs)
-
tools/log_parsing/nebulous_activity.py (copied) (copied from trunk/tools/log_parsing/nebulous_activity.py )
-
tools/log_parsing/parse_apache_log.py (modified) (4 diffs)
-
tools/regpeek.pl (copied) (copied from trunk/tools/regpeek.pl )
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/DataStore/scripts/dsgetfileset
r29128 r30675 113 113 exit $status; 114 114 } 115 } elsif (($file_type =~ /gzip/) and ($outfile =~ /tgz/) ){ 116 $command = "tar -x --directory $outdir -f $outfile"; 117 $rc = system $command; 118 if ($rc) { 119 my $status = $rc >> 8; 120 print STDERR "failed to extract $outfile: rc: $rc status: $status\n"; 121 exit $status; 122 } 115 123 } 116 124 } … … 158 166 =item * --unpack 159 167 160 Uncompress fits files if compressed .168 Uncompress fits files if compressed or extract files from gzipped tar (tgz) files. 161 169 162 170 =item * --first-file <fileid> -
branches/eam_branches/ipp-20110213/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/share/disttool_pending_raw.sql
r30387 r30675 12 12 TRIM(TRAILING '.fits' FROM rawImfile.uri) AS path_base, 13 13 CAST(NULL AS CHAR(255)) AS alt_path_base, 14 chipProcessedImfile.path_base as chip_path_base, 14 -- pass camera stage path base since we want the camera mask file. The script knows what to do 15 camProcessedExp.path_base as chip_path_base, 15 16 CAST(NULL AS CHAR(255)) AS state, 16 17 CAST(NULL AS CHAR(255)) AS data_state, … … 26 27 JOIN chipProcessedImfile 27 28 USING(chip_id, class_id) 29 JOIN camRun USING(chip_id) 30 JOIN camProcessedExp using(cam_id) 28 31 LEFT JOIN distComponent 29 32 ON distRun.dist_id = distComponent.dist_id … … 36 39 AND distComponent.dist_id IS NULL 37 40 AND (rawExp.magicked OR distRun.no_magic) 41 -- need to have magicked the chip image which makes the camera mask 42 AND chipProcessedImfile.magicked != 0 43 AND camRun.magicked > 0 38 44 AND (Label.active OR Label.active IS NULL) 39 45 UNION … … 52 58 TRIM(TRAILING '.fits' FROM rawImfile.uri) AS path_base, 53 59 magicDSFile.backup_path_base AS alt_path_base, 54 chipProcessedImfile.path_base AS chip_path_base, 60 -- pass camera stage path base since we want the camera mask file. The script knows what to do 61 camProcessedExp.path_base AS chip_path_base, 55 62 CAST('full' AS CHAR(255)) AS state, 56 63 CAST('full' AS CHAR(255)) AS data_state, … … 77 84 AND distRun.clean = 0 78 85 AND distComponent.dist_id IS NULL 79 AND chipProcessedImfile. data_state = 'full'80 AND c hipProcessedImfile.magicked > 086 AND chipProcessedImfile.magicked != 0 87 AND camRun.magicked > 0 81 88 AND (Label.active OR Label.active IS NULL) 82 89 UNION -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_camera.sql
r27945 r30675 11 11 camProcessedExp.path_base, 12 12 camProcessedExp.path_base AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_chip.sql
r29561 r30675 11 11 chipProcessedImfile.path_base, 12 12 camProcessedExp.path_base AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_diff.sql
r30256 r30675 13 13 magicDSFile.recovery_path_base, 14 14 "NULL" AS cam_path_base, 15 recovery_path_base, 15 16 CAST(diffRun.bothways AS SIGNED) AS bothways, 16 17 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_raw.sql
r27945 r30675 11 11 rawImfile.uri AS path_base, 12 12 CAST(NULL AS CHAR(255)) AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/magicdstool_torevert_warp.sql
r27945 r30675 11 11 warpSkyfile.path_base, 12 12 "NULL" AS cam_path_base, 13 recovery_path_base, 13 14 0 AS bothways, 14 15 0 AS bytes, -
branches/eam_branches/ipp-20110213/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src (added) merged: 30639,30652,30671
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110213/ippTools/src/magicdstool.c
r30548 r30675 709 709 710 710 711 // update the magicked column for the underlying component 712 // Note: Must be called inside a transaction 713 711 714 static bool 712 setMagicked(pxConfig *config, psS64 magic_ds_id, psString component )715 setMagicked(pxConfig *config, psS64 magic_ds_id, psString component, bool clearMagicked) 713 716 { 714 717 // first query the magicDSRun to find the stage and the stage_id … … 741 744 psS64 stage_id = psMetadataLookupS64(NULL, row, "stage_id"); 742 745 psS64 magic_id = psMetadataLookupS64(NULL, row, "magic_id"); 746 psFree(output); 747 748 psS64 newMagickedValue; 749 if (clearMagicked) { 750 newMagickedValue = 0; 751 } else { 752 newMagickedValue = magic_id; 753 } 743 754 744 755 ippStage stageNum = ippStringToStage(stage); 745 756 746 757 // chose the appropriate query based on the stage 758 char *clearRunQuery = NULL; 747 759 switch (stageNum) { 748 760 case IPP_STAGE_RAW: 749 761 query = "UPDATE rawImfile SET magicked = %" PRId64 " where exp_id = %" PRId64 " AND class_id = '%s'"; 762 clearRunQuery = "UPDATE rawExp SET magicked = 0 where exp_id = %" PRId64; 750 763 break; 751 764 case IPP_STAGE_CHIP: 752 765 query = "UPDATE chipProcessedImfile SET magicked = %" PRId64 " where chip_id = %" PRId64 " AND class_id = '%s'"; 766 clearRunQuery = "UPDATE chipRun set magicked = 0 where chip_id = %" PRId64; 753 767 break; 754 768 case IPP_STAGE_CHIP_BG: 755 769 query = "UPDATE chipBackgroundImfile SET magicked = %" PRId64 " where chip_bg_id = %" PRId64 " AND class_id = '%s'"; 770 clearRunQuery = "UPDATE chipBackgroundRun SET magicked = 0 where chip_bg_id = %" PRId64; 756 771 break; 757 772 case IPP_STAGE_CAMERA: 758 // no there is no magicked column in camProcessedExp so we have nothing to do 759 psFree(output); 760 return true; 773 psFree(query); 774 query = NULL; 775 clearRunQuery = "UPDATE chipBackgroundRun SET magicked = 0 where chip_bg_id = %" PRId64; 776 break; 761 777 case IPP_STAGE_WARP: 762 778 query = "UPDATE warpSkyfile SET magicked = %" PRId64 " where warp_id = %" PRId64 " AND skycell_id = '%s'"; 779 clearRunQuery = "UPDATE warpRun SET magicked = 0 where warp_id = %" PRId64; 763 780 break; 764 781 case IPP_STAGE_WARP_BG: 765 782 query = "UPDATE warpBackgroundSkyfile SET magicked = %" PRId64 " where warp_bg_id = %" PRId64 " AND skycell_id = '%s'"; 783 clearRunQuery = "UPDATE warpBackgroundRun SET magicked = 0 where warp_bg_id = %" PRId64; 766 784 break; 767 785 case IPP_STAGE_DIFF: 768 786 query = "UPDATE diffSkyfile SET magicked = %" PRId64 " where diff_id = %" PRId64 " AND skycell_id = '%s'"; 787 clearRunQuery = "UPDATE diffRun SET magicked = 0 where diff_id = %" PRId64; 769 788 break; 770 789 default: 771 790 psError(PS_ERR_UNKNOWN, true, "unexpected value for stage: %s found", stage); 772 psFree(output); 773 return false; 774 } 775 776 if (!p_psDBRunQueryF(config->dbh, query, magic_id, stage_id, component)) { 777 psError(PS_ERR_UNKNOWN, false, "database error"); 778 return false; 779 } 780 psFree(output); 781 782 psU64 affected = psDBAffectedRows(config->dbh); 783 if (affected != 1) { 784 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row"); 785 return false; 791 return false; 792 } 793 794 if (query) { 795 if (!p_psDBRunQueryF(config->dbh, query, newMagickedValue, stage_id, component)) { 796 psError(PS_ERR_UNKNOWN, false, "database error"); 797 return false; 798 } 799 } 800 801 if (clearMagicked && clearRunQuery) { 802 if (!p_psDBRunQueryF(config->dbh, clearRunQuery, stage_id)) { 803 psError(PS_ERR_UNKNOWN, false, "database error"); 804 return false; 805 } 786 806 } 787 807 … … 896 916 if (setmagicked) { 897 917 // set the image file's magicked flag 898 if (!setMagicked(config, magic_ds_id, component )) {918 if (!setMagicked(config, magic_ds_id, component, false)) { 899 919 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 900 920 if (!psDBRollback(config->dbh)) { … … 1111 1131 pxAddLabelSearchArgs (config, where, "-label", "label", "=="); 1112 1132 1133 PXOPT_LOOKUP_S64(magic_ds_id, config->args, "-magic_ds_id", true, false); 1134 PXOPT_LOOKUP_STR(component, config->args, "-component", true, false); 1113 1135 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 1114 1136 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); … … 1116 1138 psString queryFile = NULL; 1117 1139 bool stateIsUpdate = false; 1140 bool toRestored = !strcmp(state, "goto_restored"); 1118 1141 if (state) { 1119 if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) {1142 if (! strcmp(state, "new") || toRestored) { 1120 1143 queryFile = "magicdstool_revertdestreakedfile.sql"; 1121 1144 } else if (!strcmp(state, "update")) { … … 1153 1176 } 1154 1177 1178 if (!psDBTransaction(config->dbh)) { 1179 psError(PS_ERR_UNKNOWN, false, "database error"); 1180 return false; 1181 } 1155 1182 if (!p_psDBRunQuery(config->dbh, query)) { 1156 1183 psError(PS_ERR_UNKNOWN, false, "failed to revert"); … … 1159 1186 } 1160 1187 psFree(query); 1188 if (toRestored) { 1189 // clear the underlying component's magicked value 1190 if (!setMagicked(config, magic_ds_id, component, true)) { 1191 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 1192 if (!psDBRollback(config->dbh)) { 1193 psError(PS_ERR_UNKNOWN, false, "database error"); 1194 } 1195 return false; 1196 } 1197 } 1198 if (!psDBCommit(config->dbh)) { 1199 psError(PS_ERR_UNKNOWN, false, "database error"); 1200 return false; 1201 } 1161 1202 return true; 1162 1203 } … … 1661 1702 } 1662 1703 if (!strcmp(data_state, "full")) { 1663 // if -tofullfile optoinally set the magicked value for the component 1664 PXOPT_LOOKUP_BOOL(setmagicked, config->args, "-setmagicked", false); 1665 // set the image file's magicked flag 1666 if (!setMagicked(config, magic_ds_id, component)) { 1704 // set the component's magicked flag 1705 1706 if (!setMagicked(config, magic_ds_id, component, false)) { 1667 1707 psError(PS_ERR_UNKNOWN, false, "setMagicked failed"); 1668 1708 if (!psDBRollback(config->dbh)) { … … 1716 1756 return change_file_data_state(config, "full"); 1717 1757 } 1718 /*1719 static bool topurgedimfileMode(pxConfig *config)1720 {1721 return change_imfile_data_state(config, "purged", "goto_purged");1722 }1723 static bool toscrubbedfileMode(pxConfig *config)1724 {1725 return change_file_data_state(config, "scrubbed", "goto_scrubbed");1726 }1727 */1728 1758 1729 1759 // a very specfic function to queue a cleaned magicDSFile to be updated -
branches/eam_branches/ipp-20110213/ippTools/src/magictool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20110213/ippTools/src/regtool.c
r30594 r30675 259 259 continue; 260 260 } 261 char *is_ccim = strchr(psMetadataLookupStr(NULL,row,"exp_name"),'c'); 262 if (is_ccim) { // Is a camera commanded exposure 263 // fprintf(stderr,"IN camera commanded!\n"); 264 if ((strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DOMEFLAT") == 0)|| 265 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DARK") == 0) || 266 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"BIAS") == 0)) { 267 continue; 268 } 269 } 261 270 262 271 if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)|| … … 367 376 } 368 377 378 char *is_ccim = strchr(psMetadataLookupStr(NULL,row,"exp_name"),'c'); 379 if (is_ccim) { // Is a camera commanded exposure 380 // fprintf(stderr,"IN camera commanded!\n"); 381 if ((strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DOMEFLAT") == 0)|| 382 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"DARK") == 0) || 383 (strcasecmp(psMetadataLookupStr(NULL,row,"exp_type"),"BIAS") == 0)) { 384 continue; 385 } 386 } 387 369 388 bool status = false; 370 389 char *tmp_id = psMetadataLookupStr(&status,row,"summit_class_id"); … … 389 408 } 390 409 410 391 411 if (0 && !strcmp(this_class_id, "ota44")) { 392 412 printf("STAT 1: %s (%d %d) %d %d %d\n", … … 857 877 PXOPT_LOOKUP_STR(set_md5sum, config->args, "-set_md5sum", false, false); 858 878 PXOPT_LOOKUP_STR(set_state, config->args, "-set_state", false, false); 859 879 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 880 860 881 if ((fault == INT16_MAX) && (burntool_state == INT16_MAX) && !set_state) { 861 882 psError(PS_ERR_UNKNOWN, false, "one of -fault or -burntool_state or -set_state must be selected"); … … 905 926 psStringAppend(&setvalues,"rawImfile.data_state = '%s'",set_state); 906 927 } 907 928 if (hostname) { 929 if (setvalues) { 930 psStringAppend(&setvalues,","); 931 } 932 psStringAppend(&setvalues,"rawImfile.hostname = '%s'", hostname); 933 } 908 934 psString query = pxDataGet("regtool_updateprocessedimfile.sql"); 909 935 if (!query) { -
branches/eam_branches/ipp-20110213/ippTools/src/regtoolConfig.c
r30352 r30675 189 189 ADD_OPT(S16, updateprocessedimfileArgs, "-burntool_state", "set burntool state", INT16_MAX); 190 190 ADD_OPT(S16, updateprocessedimfileArgs, "-fault", "set fault code", INT16_MAX); 191 ADD_OPT(Str, updateprocessedimfileArgs, "-hostname", "set host name", NULL); 191 192 ADD_OPT(S32, updateprocessedimfileArgs, "-set_bytes", "set bytes", INT32_MAX); 192 193 ADD_OPT(Str, updateprocessedimfileArgs, "-set_md5sum", "set md5sum", NULL); -
branches/eam_branches/ipp-20110213/ppTranslate/src/ppMonet.c
r25925 r30675 146 146 psU32 flags = psMetadataLookupU32(NULL, row, "FLAGS"); 147 147 148 float width = 0.5 * (major + minor);148 float width = (float) (0.5 * (major + minor)); 149 149 150 150 gzprintf(gz, "%s , %.2f , %.2f , %.8lf , %.8lf , %.3f , %.3f , %.2f , %#08x\n", -
branches/eam_branches/ipp-20110213/ppTranslate/src/ppMopsDetections.c
r29556 r30675 183 183 det->apMagRadius = psVectorRealloc(det->apMagRadius, num); 184 184 det->apMagRaw = psVectorRealloc(det->apMagRadius, num); 185 det->apFlux = psVectorRealloc(det->ap MagRadius, num);186 det->apFluxSig = psVectorRealloc(det->ap MagRadius, num);185 det->apFlux = psVectorRealloc(det->apFlux, num); 186 det->apFluxSig = psVectorRealloc(det->apFluxSig, num); 187 187 det->peakFluxAsMag = psVectorRealloc(det->peakFluxAsMag, num); 188 188 det->calPsfMag = psVectorRealloc(det->calPsfMag, num); -
branches/eam_branches/ipp-20110213/ppTranslate/src/ppMopsMerge.c
r30532 r30675 22 22 ) 23 23 { 24 float dx = detections->x->data.F32[index] - detections->naxis1->data.S32[index] / 2.0;25 float dy = detections->y->data.F32[index] - detections->naxis2->data.S32[index] / 2.0;26 return PS_SQR(dx) + PS_SQR(dy);24 float dx = (float) (detections->x->data.F32[index] - detections->naxis1->data.S32[index] / 2.0); 25 float dy = (float) (detections->y->data.F32[index] - detections->naxis2->data.S32[index] / 2.0); 26 return PS_SQR(dx) + PS_SQR(dy); 27 27 } 28 28 … … 165 165 if (num == 0) { 166 166 //All detections were NULL?! 167 psTrace("ppMops.merge", 3, "All % d detections were NULL\n", detections->n);167 psTrace("ppMops.merge", 3, "All %ld detections were NULL\n", detections->n); 168 168 return NULL; 169 169 } 170 170 psTrace("ppMops.merge", 2, "%ld sources in merged detections list\n", merged->num); 171 171 172 merged->seeing /= num;172 merged->seeing /= (float) num; 173 173 174 174 return merged; -
branches/eam_branches/ipp-20110213/ppTranslate/src/ppMopsRead.c
r29565 r30675 45 45 if (args->version == 0) { 46 46 psTrace("ppMops.read", 1, "Changing args->version to %d\n", skyChipPsfVersion); 47 args->version = skyChipPsfVersion;47 args->version = (unsigned short) skyChipPsfVersion; 48 48 } 49 49 if (skyChipPsfVersion == 0) { … … 87 87 det->mjd = psMetadataLookupF64(NULL, header, "MJD-OBS") + det->exptime / 2.0 / 3600 / 24; 88 88 89 det->seeing = 0.5 * (psMetadataLookupF32(NULL, header, "FWHM_MAJ") +90 psMetadataLookupF32(NULL, header, "FWHM_MIN"));89 det->seeing = (float) 0.5 * (psMetadataLookupF32(NULL, header, "FWHM_MAJ") + 90 psMetadataLookupF32(NULL, header, "FWHM_MIN")); 91 91 92 92 int naxis1 = psMetadataLookupS32(NULL, header, "IMNAXIS1"); // Number of columns … … 145 145 //Values are set only if the version is 2 146 146 if (skyChipPsfVersion == 2) { 147 det->psfInstFlux->data.F32[numGood] = psMetadataLookup S32(NULL, row, "PSF_INST_FLUX");148 det->psfInstFluxSig->data.F32[numGood] = psMetadataLookup S32(NULL, row, "PSF_INST_FLUX_SIG");149 det->apMag->data.F32[numGood] = psMetadataLookup S32(NULL, row, "AP_MAG");150 det->apMagRaw->data.F32[numGood] = psMetadataLookup S32(NULL, row, "AP_MAG_RAW");151 det->apMagRadius->data.F32[numGood] = psMetadataLookup S32(NULL, row, "AP_MAG_RADIUS");152 det->apFlux->data.F32[numGood] = psMetadataLookup S32(NULL, row, "AP_FLUX");153 det->apFluxSig->data.F32[numGood] = psMetadataLookup S32(NULL, row, "AP_FLUX_SIG");154 det->peakFluxAsMag->data.F32[numGood] = psMetadataLookup S32(NULL, row, "PEAK_FLUX_AS_MAG");155 det->calPsfMag->data.F32[numGood] = psMetadataLookup S32(NULL, row, "CAL_PSF_MAG");156 det->calPsfMagSig->data.F32[numGood] = psMetadataLookup S32(NULL, row, "CAL_PSF_MAG_SIG");157 det->sky->data.F32[numGood] = psMetadataLookup S32(NULL, row, "SKY");158 det->skySig->data.F32[numGood] = psMetadataLookup S32(NULL, row, "SKY_SIGMA");147 det->psfInstFlux->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_INST_FLUX"); 148 det->psfInstFluxSig->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_INST_FLUX_SIG"); 149 det->apMag->data.F32[numGood] = psMetadataLookupF32(NULL, row, "AP_MAG"); 150 det->apMagRaw->data.F32[numGood] = psMetadataLookupF32(NULL, row, "AP_MAG_RAW"); 151 det->apMagRadius->data.F32[numGood] = psMetadataLookupF32(NULL, row, "AP_MAG_RADIUS"); 152 det->apFlux->data.F32[numGood] = psMetadataLookupF32(NULL, row, "AP_FLUX"); 153 det->apFluxSig->data.F32[numGood] = psMetadataLookupF32(NULL, row, "AP_FLUX_SIG"); 154 det->peakFluxAsMag->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PEAK_FLUX_AS_MAG"); 155 det->calPsfMag->data.F32[numGood] = psMetadataLookupF32(NULL, row, "CAL_PSF_MAG"); 156 det->calPsfMagSig->data.F32[numGood] = psMetadataLookupF32(NULL, row, "CAL_PSF_MAG_SIG"); 157 det->sky->data.F32[numGood] = psMetadataLookupF32(NULL, row, "SKY"); 158 det->skySig->data.F32[numGood] = psMetadataLookupF32(NULL, row, "SKY_SIGMA"); 159 159 det->qualityPerfect->data.F32[numGood] = psMetadataLookupF32(NULL, row, "PSF_QF_PERFECT"); 160 160 det->momentsR1->data.F32[numGood] = psMetadataLookupF32(NULL, row, "MOMENTS_R1"); … … 236 236 numGood++; 237 237 } 238 det->seeing *= plateScale / numGood;238 det->seeing *= ((float) plateScale) / ((float) numGood); 239 239 240 240 det->x->n = numGood; -
branches/eam_branches/ipp-20110213/tools/examine_burntool_pcontrol.pl
r28886 r30675 145 145 # Get the data. The limit is there to keep the database happy. I don't think you can observe that many 146 146 # images on a single night. 147 $sth = "SELECT exp_id, exp_name,obs_mode,dateobs,class_id,burntool_state,comment FROM rawImfile WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' order bydateobs limit 600000";147 $sth = "SELECT exp_id,rawImfile.exp_name,rawImfile.obs_mode,rawImfile.dateobs,class_id,burntool_state,rawImfile.comment,rawExp.state FROM rawImfile JOIN rawExp USING(exp_id) WHERE rawImfile.dateobs >= '${dmin}' AND rawImfile.dateobs <= '${dmax}' order by rawImfile.dateobs limit 600000"; 148 148 149 149 $data_ref = $db->selectall_arrayref( $sth ); … … 168 168 } 169 169 print "# 0 1 2 3 4 5 6 7 \n"; 170 print "#exp_i exp_name obs_mode dateobs nB 0123456701234567012345670123456701234567012345670123456701234567 comment\n";170 print "#exp_i exp_name obs_mode dateobs nB 0123456701234567012345670123456701234567012345670123456701234567 rawExp.state comment\n"; 171 171 172 172 # If the database returns no entries (because we have a mistake in pcontrol.pro perhaps), return a null entry. … … 180 180 181 181 foreach $row_ref (@{ $data_ref }) { 182 ($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$burntool_state,$comment ) = @{ $row_ref };182 ($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$burntool_state,$comment,$exp_state) = @{ $row_ref }; 183 183 184 184 # Correct for nulls in the database. … … 202 202 203 203 if ($cur_exp_id != -99) { 204 printf("%6d %11s %11s %19s %2d %64s % s\n",205 $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_ comment);204 printf("%6d %11s %11s %19s %2d %64s %15s %s\n", 205 $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_exp_state,$cur_comment); 206 206 207 207 if (($burncount != 60)&&(exists($opt{A}))) { … … 228 228 } 229 229 ($cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$cur_comment) = ($exp_id,$exp_name,$obs_mode,$dateobs,$comment); 230 $cur_exp_state = $exp_state; 230 231 class_to_vector($class_id,$burntool_state); 231 232 } 232 233 } 233 234 # Final entry needs a manual print to clear it out. Let's tack on a footer as well. 234 printf("%6d %11s %11s %19s %2d %64s % s\n",235 $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_ comment);235 printf("%6d %11s %11s %19s %2d %64s %15s %s\n", 236 $cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$burncount, $V,$cur_exp_state,$cur_comment); 236 237 print "# 0 1 2 3 4 5 6 7 \n"; 237 print "#exp_i exp_name obs_mode dateobs nB 0123456701234567012345670123456701234567012345670123456701234567 comment\n";238 print "#exp_i exp_name obs_mode dateobs nB 0123456701234567012345670123456701234567012345670123456701234567 rawExp.state comment\n"; 238 239 print"\n"; 239 240 -
branches/eam_branches/ipp-20110213/tools/log_parsing/parse_apache_log.py
r30522 r30675 4 4 import re 5 5 import datetime 6 import fileinput 6 7 7 8 nebulousPattern = re.compile('POST /nebulous HTTP/1.1') 9 errorPattern = re.compile('exit signal Segmentation fault') 10 8 11 # Resolution: 10 minutes of 60 seconds of 1000000 microseconds 9 12 datetime.resolution = 10*60*1000000 10 13 11 14 def message(size): 15 """ 16 Guess the message type according to the message size 17 """ 12 18 if size == 488: 13 19 # delete == 488 … … 34 40 35 41 def show_results(counts, output=sys.stderr): 42 """ 43 Display results 44 """ 36 45 output.write('# Epoch | Create | FindIn | Delete | FailSt | Stat | Unkn. | NonNeb\n') 37 46 for count in sorted(counts.iterkeys()): … … 45 54 counts[count][6])) 46 55 47 if __name__ == '__main__': 56 def process(linesInFile = None): 57 """ 58 Process Nebulous entries in apache2 log file 59 """ 48 60 counts = dict() 49 50 61 linesCount = 1 51 for line in sys.stdin: 52 if linesCount % 10000 == 0: 53 sys.stderr.write('Analyzed lines: %d\n' % linesCount) 54 if linesCount % 100000 == 0: 62 if linesInFile == None: 63 input = fileinput.input() 64 else: 65 input = linesInFile 66 for line in input: 67 if linesCount % 100000 == 0: 68 sys.stderr.write('\tAnalyzed lines: %d\n' % linesCount) 69 if linesCount % 500000 == 0: 55 70 show_results(counts) 56 71 linesCount += 1 … … 85 100 counts[dt.isoformat()] = [0, 0, 0, 0, 0, 0, 0] 86 101 counts[dt.isoformat()][6] += 1 102 return counts 87 103 88 show_results(counts, sys.stdout) 104 def show_errors(counts, output=sys.stderr): 105 """ 106 Display error results 107 """ 108 output.write('# Epoch | Errors\n') 109 for count in sorted(counts.iterkeys()): 110 output.write('%19s | %6d\n' % (count, counts[count])) 111 112 def processErrorLog(linesInFile = None): 113 """ 114 Process errors in apache2 error log file 115 """ 116 counts = dict() 117 linesCount = 1 118 if linesInFile == None: 119 input = fileinput.input() 120 else: 121 input = linesInFile 122 for line in input: 123 if linesCount % 100000 == 0: 124 sys.stderr.write('\tAnalyzed lines: %d\n' % linesCount) 125 if linesCount % 500000 == 0: 126 show_errors(counts) 127 linesCount += 1 128 if errorPattern.search(line): 129 elements = line.split(']') 130 date = elements[0] 131 date = date[1:] 132 # print '[%s]' % (date) 133 dt = datetime.datetime.strptime(date, 134 '%a %b %d %H:%M:%S %Y') 135 dt = dt.replace(minute = int(dt.minute/10)*10, 136 second = 0) 137 # print dt.isoformat() 138 try: 139 counts[dt.isoformat()] += 1 140 except KeyError: 141 counts[dt.isoformat()] = 1 142 return counts 143 144 def usage(): 145 sys.stderr.write(main.__doc__) 146 147 def main(arguments): 148 """ 149 Usage: parse_apache_log [-a <nebulous apache access_log file>] [-e <nebulous apache error_log file>] 150 """ 151 mainName = arguments.pop() 152 if len(arguments) == 0: 153 sys.stderr.write('Reading from /dev/stdin\n') 154 counts = process() 155 show_results(counts, sys.stdout) 156 elif len(arguments) % 2 != 0: 157 sys.stderr.write('Arguments length: %d\n' % (len(arguments))) 158 usage() 159 sys.exit(1) 160 else: 161 accessFilenames = [] 162 errorFilenames = [] 163 while len(arguments) != 0: 164 flag = arguments.pop() 165 filename = arguments.pop() 166 if flag == '-a': 167 accessFilenames.append(filename) 168 elif flag == '-e': 169 errorFilenames.append(filename) 170 else: 171 sys.stderr.write('Unknown flag: [%s]' % (flag)) 172 usage() 173 sys.exit(1) 174 for accessFilename in accessFilenames: 175 sys.stderr.write('Processing: [%s]' % (accessFilename)) 176 inFile = open(accessFilename) 177 counts = process(inFile) 178 show_results(counts, sys.stdout) 179 for errorFilename in errorFilenames: 180 counts = processErrorLog(errorFilename) 181 show_errors(counts, sys.stdout) 182 183 if __name__ == '__main__': 184 main(sys.argv)
Note:
See TracChangeset
for help on using the changeset viewer.
