IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38365


Ignore:
Timestamp:
Jun 4, 2015, 3:18:38 PM (11 years ago)
Author:
heather
Message:

SAS38 ST, finally. this fixes the duplicates bug outlined in teh sas37 wiki.

Location:
trunk/ippToPsps/jython
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/dvo.py

    r38358 r38365  
    609609        #This is a terrible hack but I'm tired of it taking a decade to ingest the FW skycells.
    610610
    611         if self.batchType == "ST":
    612             dR_border = .4 / / math.cos(math.radians(boxDim['DEC']))
    613             dD_border = .4
    614         if self.batchType == "FW":
    615             dR_border = .4 / / math.cos(math.radians(boxDim['DEC']))
    616             dD_border = .4
     611        #if self.batchType == "ST":
     612        #    dR_border = .4 / math.cos(math.radians(boxDim['DEC']))
     613        #    dD_border = .4
     614        #if self.batchType == "FW":
     615        #    dR_border = .4 / math.cos(math.radians(boxDim['DEC']))
     616        #    dD_border = .4
    617617
    618618
  • trunk/ippToPsps/jython/stackbatch.py

    r38358 r38365  
    324324            sqlLine = sqlUtility("UPDATE StackObjectThin as a, " + self.scratchDb.dvoDetectionTable + " as b SET")
    325325
    326             sqlLine.group("a."+filter+"ippDetectID",   "b.ippDetectID") # eg, gippDetectID (from dvo.measure.detID)
     326#            sqlLine.group("a."+filter+"ippDetectID",   "b.ippDetectID") # eg, gippDetectID (from dvo.measure.detID)
    327327            sqlLine.group("a."+filter+"stackDetectID", "b.detectID")    # eg, gstackDetectID (from dvo.measure.extID)
    328328            sqlLine.group("a."+filter+"stackMetaID",    str(stackID))   # eg, gstackMetaID (from cmf.IMAGEID)
     
    345345
    346346            sqlLine.group("a."+filter+"infoFlag2",     "(b.flags << 13)")
    347             sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND b.imageID = " + str(imageID))
     347            sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND b.imageID = " + str(imageID) + " and a." + filter + "ippDetectID=b.ippDetectID")
    348348
    349349            try: self.scratchDb.execute(sql)
     
    870870
    871871        sql = sqlLine.makeEquals("")
    872 
     872       
    873873        try: self.scratchDb.execute(sql)
    874874        except:
     
    909909
    910910        for number in numbers:
    911             field = filter + prefix + "flxR" + number
     911            pspsNum  = str(int(number) + 2)
     912            field = filter + prefix + "flxR" + pspsNum
    912913            sqlLine.group(field,          "b.APER_FLUX_"       + number + " / " + exptime)
    913914            sqlLine.group(field + "Err",  "b.APER_FLUX_ERR_"   + number + " / " + exptime)
     
    916917           
    917918        sql = sqlLine.makeEquals("WHERE a." + filter + "ippDetectID = b.IPP_IDET AND  " + psfCondition)
    918 
     919       
    919920        try: self.scratchDb.execute(sql)
    920921        except:
     
    936937        sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET")
    937938        for number in numbers:
    938             field = filter + prefix + "flxR" + number
     939            pspsNum  = str(int(number) + 2)
     940            field = filter + prefix + "flxR" + pspsNum
    939941            sqlLine.group(field,               field         + " * POW(10, 3.56 - 0.4* b.zp)")
    940942            sqlLine.group(field + "Err",       field + "err" + " * POW(10, 3.56 - 0.4* b.zp)")
     
    10691071
    10701072        # we need a temporary column for each filter to identify empty rows
     1073        self.scratchDb.addColumn("StackObjectThin", "ippDetectID", "bigint")
    10711074        for filter in self.filters:
    10721075            self.scratchDb.addColumn("StackObjectThin", filter + "haveData", "tinyint")
    1073 
    1074         sqlLine = sqlUtility("INSERT INTO StackObjectThin (")
    1075        
    1076         sqlLine.group("objID",            "objID")
    1077         sqlLine.group("ippObjID",         "ippObjID")
    1078         sqlLine.group("surveyID",         "'" + str(self.surveyID) + "'")
    1079         sqlLine.group("tessID",           "'" + str(self.tessID) + "'")
    1080         sqlLine.group("projectionID",     "'" + str(self.projectionID) + "'")
    1081         sqlLine.group("skyCellID",        "'" + str(self.skycellID) + "'")
    1082         sqlLine.group("dataRelease",      "'" + str(self.skychunk.dataRelease) + "'")
     1076           
     1077
     1078 #       sqlLine = sqlUtility("INSERT INTO StackObjectThin (")
     1079 #       
     1080 #       sqlLine.group("objID",            "objID")
     1081 #       sqlLine.group("ippObjID",         "ippObjID")
     1082#        sqlLine.group("ippDetectID", "ippDetectID") # added ippDetectID
     1083 #       sqlLine.group("surveyID",         "'" + str(self.surveyID) + "'")
     1084 #       sqlLine.group("tessID",           "'" + str(self.tessID) + "'")
     1085 #       sqlLine.group("projectionID",     "'" + str(self.projectionID) + "'")
     1086 #       sqlLine.group("skyCellID",        "'" + str(self.skycellID) + "'")
     1087 #       sqlLine.group("dataRelease",      "'" + str(self.skychunk.dataRelease) + "'")
    10831088   #     sqlLine.group("randomStackObjID", "FLOOR(RAND()*9223372036854775807)")
     1089
     1090           
     1091
     1092
     1093
    10841094
    10851095        whereClause = " WHERE ("
     
    10961106        whereClause += ")"
    10971107
    1098         sql = sqlLine.makeRaw(") SELECT DISTINCT ", "FROM " + self.scratchDb.dvoDetectionTable + whereClause)
     1108        sql = "insert into StackObjectThin (objID, ippDetectID,ippObjID) select distinct objID, ippDetectID, ippObjID from dvoDetectionFull "+whereClause;
     1109
     1110  #      sql = sqlLine.makeRaw(") SELECT DISTINCT ", "FROM " + self.scratchDb.dvoDetectionTable + whereClause)
    10991111
    11001112        try: self.scratchDb.execute(sql)
     
    11021114            self.logger.errorPair('failed sql',sql)
    11031115            raise
     1116
     1117
     1118# ok, now add surveyID, tessID, projectionID, skycellID, dtaRelease
     1119
     1120        sql = "update StackObjectThin set surveyID = "+str(self.surveyID) +"\
     1121              , tessID = '" + str(self.tessID) + "'\
     1122              , projectionID = '" + str(self.projectionID) + "'\
     1123              , skycellID = '" + str(self.skycellID) + "'\
     1124              , dataRelease = '" + str(self.skychunk.dataRelease)  +"'"
     1125             
     1126        try: self.scratchDb.execute(sql)
     1127        except:
     1128            self.logger.errorPair('failed sql',sql)
     1129            raise
     1130
     1131 # ok, now fill g/r/i/z/yippDetectID using objID and detectID and imge ID
     1132
     1133
     1134        for filter in self.filters:
     1135            sql = "update StackObjectThin join "+self.scratchDb.dvoDetectionTable +" using (objID, ippDetectID) set "+filter+"ippDetectID = ippDetectID \
     1136                  where " + self.scratchDb.dvoDetectionTable + ".imageID = " + str(imageID)
     1137            try: self.scratchDb.execute(sql)
     1138            except:
     1139                self.logger.errorPair('failed sql',sql)
     1140                raise
     1141        self.scratchDb.dropColumn("StackObjectThin", "ippDetectID")
    11041142
    11051143    '''
Note: See TracChangeset for help on using the changeset viewer.