Changeset 31501
- Timestamp:
- May 10, 2011, 8:49:04 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/gpc1db.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/gpc1db.py
r31400 r31501 29 29 self.logger.debug("Gpc1Db destructor") 30 30 31 32 ''' 33 TODO 34 ''' 35 def getIDsInThisDVODbForThisStageFudge(self): 36 37 sql = "SELECT staticskyRun.sky_id \ 38 FROM staticskyInput, staticskyRun, stackRun, staticskyResult \ 39 WHERE staticskyRun.sky_id = staticskyInput.sky_id \ 40 AND staticskyInput.stack_id = stackRun.stack_id \ 41 AND staticskyInput.sky_id = staticskyResult.sky_id \ 42 AND staticskyRun.label like 'MD04.staticsky' \ 43 AND stackRun.filter like 'i%'" 44 45 try: 46 rs = self.executeQuery(sql) 47 except: 48 self.logger.exception("Can't query for ids in DVO") 49 50 ids = [] 51 while (rs.next()): 52 ids.append(rs.getInt(1)) 53 54 rs.close() 55 56 self.logger.info("Found %d items in DVO database '" % (len(ids))) 57 58 return ids 59 31 60 ''' 32 61 Gets a list of ids in this DVO database for this stage, could be cam or staticsky (so far) … … 40 69 41 70 try: 42 rs = self. stmt.executeQuery(sql)71 rs = self.executeQuery(sql) 43 72 except: 44 73 self.logger.exception("Can't query for ids in DVO") … … 50 79 rs.close() 51 80 52 self.logger. debug("Found %d items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage))81 self.logger.info("Found %d items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage)) 53 82 54 83 return ids … … 73 102 74 103 try: 75 rs = self. stmt.executeQuery(sql)104 rs = self.executeQuery(sql) 76 105 except: 77 106 self.logger.exception("Can't query for imageIDs") … … 105 134 106 135 try: 107 rs = self. stmt.executeQuery(sql)136 rs = self.executeQuery(sql) 108 137 rs.first() 109 138 meta.append(rs.getInt(1)) … … 113 142 114 143 return meta 144 115 145 ''' 116 146 Gets some camera-stage meta data for this cam_id … … 127 157 128 158 try: 129 rs = self. stmt.executeQuery(sql)159 rs = self.executeQuery(sql) 130 160 rs.first() 131 161 meta.append(rs.getInt(1)) … … 150 180 151 181 try: 152 rs = self. stmt.executeQuery(sql)182 rs = self.executeQuery(sql) 153 183 rs.first() 154 184 except: … … 171 201 files = glob.glob(path + "/*.cmf") 172 202 203 if len(files) < 1: return "NULL" 204 173 205 return files[0] # TODO just returning first file - check 174 206 … … 186 218 187 219 try: 188 rs = self. stmt.executeQuery(sql)220 rs = self.executeQuery(sql) 189 221 rs.first() 190 222 except: … … 200 232 201 233 f=os.popen("neb-ls -p "+path+"%cmf") 202 print "neb-ls -p "+path+"%cmf"203 234 for i in f.readlines(): 204 235 files.append(i.rstrip()) 205 print i.rstrip()206 236 207 237 # or not a neb path … … 211 241 return files 212 242 243 244 ''' 245 TODO hack to get exposure time for a stack 246 ''' 247 def getStackExpTime(self, stackID): 248 249 self.logger.debug("Querying GPC1 for stack exposure time") 250 251 sql = "SELECT SUM(exp_time) * (COUNT(warp_id) - reject_images) / COUNT(warp_id) as EXPTIME \ 252 FROM staticskyRun JOIN staticskyInput using(sky_id) \ 253 JOIN stackRun using(stack_id) \ 254 JOIN stackSumSkyfile using(stack_id) \ 255 JOIN stackInputSkyfile using(stack_id) \ 256 JOIN warpRun using(warp_id) \ 257 JOIN fakeRun using(fake_id) \ 258 JOIN camRun using(cam_id) \ 259 JOIN chipRun using(chip_id) \ 260 JOIN rawExp using(exp_id) \ 261 WHERE stack_id = %d" % stackID 262 263 try: 264 rs = self.executeQuery(sql) 265 rs.first() 266 return rs.getInt(1) 267 except: 268 self.logger.exception("Can't query for exposure time") 269 270 return 0.0 271 272
Note:
See TracChangeset
for help on using the changeset viewer.
