def setBatches(opsdb, colmap, args): bdict = {} bdict.update( batches.glanceBatch(colmap, args.runName, sqlConstraint=args.sqlConstraint)) return bdict
def runGlance(dbfile, outDir='Glance', runName='runname', camera='LSST'): conn = db.Database(dbfile, defaultTable='observations') colmap = {'ra': 'RA', 'dec': 'dec', 'mjd': 'mjd', 'exptime': 'exptime', 'visittime': 'exptime', 'alt': 'alt', 'az': 'az', 'filter': 'filter', 'fiveSigmaDepth': 'fivesigmadepth', 'night': 'night', 'slewtime': 'slewtime', 'seeingGeom': 'FWHM_geometric', 'rotSkyPos': 'rotSkyPos', 'raDecDeg': True, 'slewdist': None, 'note': 'note'} gb = glanceBatch(colmap=colmap, slicer_camera=camera) resultsDb = db.ResultsDb(outDir=outDir) group = metricBundles.MetricBundleGroup(gb, conn, outDir=outDir, resultsDb=resultsDb) group.runAll() group.plotAll()
if args.db is None: if os.path.isfile('trackingDb_sqlite.db'): os.remove('trackingDb_sqlite.db') db_files = glob.glob('*.db') else: db_files = [args.db] run_names = [ os.path.basename(name).replace('.db', '') for name in db_files ] for filename, name in zip(db_files, run_names): if os.path.isdir(name + '_glance'): shutil.rmtree(name + '_glance') opsdb = db.OpsimDatabaseV4(filename) colmap = batches.ColMapDict() bdict = {} bdict.update(batches.glanceBatch(colmap, name)) bdict.update(batches.fOBatch(colmap, name)) resultsDb = db.ResultsDb(outDir=name + '_glance') group = mb.MetricBundleGroup(bdict, opsdb, outDir=name + '_glance', resultsDb=resultsDb, saveEarly=False) group.runAll(clearMemory=True, plotNow=True) resultsDb.close() opsdb.close() db.addRunToDatabase(name + '_glance', 'trackingDb_sqlite.db', None, name, '', '', name + '.db')
import lsst.sims.maf.metricBundles as mb if __name__ == "__main__": """ Run the glance batch on all .db files in a directory. """ db_files = glob.glob('*.db') run_names = [name.replace('.db', '') for name in db_files] if os.path.isfile('trackingDb_sqlite.db'): os.remove('trackingDb_sqlite.db') for name in run_names: if os.path.isdir(name): shutil.rmtree(name) opsdb = db.OpsimDatabaseV4(name + '.db') colmap = batches.ColMapDict('OpsimV4') bdict = {} bdict.update(batches.glanceBatch(colmap, name, slicer_camera='ComCam')) bdict.update(batches.fOBatch(colmap, name)) resultsDb = db.ResultsDb(outDir=name) group = mb.MetricBundleGroup(bdict, opsdb, outDir=name, resultsDb=resultsDb) group.runAll() group.plotAll() resultsDb.close() opsdb.close() db.addRunToDatabase(name, 'trackingDb_sqlite.db', None, name, '', '', name + '.db')
def setBatches(opsdb, colmap, args): bdict = {} bdict.update(batches.glanceBatch(colmap, args.runName, sqlConstraint=args.sqlConstraint)) bdict.update(batches.fOBatch(colmap, args.runName, extraSql=args.sqlConstraint)) return bdict
def setBatches(opsdb, colmap, args): bdict = {} bdict.update(batches.glanceBatch(colmap, args.runName)) return bdict
plotDict=plotDict, summaryMetrics=standardStats) bundleList.append(bundle) # Set the runName for all bundles and return the bundleDict. for b in bundleList: b.setRunName(runName) return mb.makeBundlesDictFromList(bundleList) colmap = batches.ColMapDict('barebones') colmap['ra'] = 'RA' colmap['seeingEff'] = 'FWHMeff' colmap['seeingGeom'] = 'FWHM_geometric' colmap['note'] = 'note' bd = batches.glanceBatch(colmap=colmap) cadence_batch = interNight(colmap=colmap) def run_glance(outDir, dbname): conn = db.Database(dbname, defaultTable='observations') resultsDb = db.ResultsDb(outDir=outDir) mbg = MetricBundleGroup(bd, conn, outDir=outDir, resultsDb=resultsDb) mbg.runAll() mbg.plotAll() conn.close() def run_cadence(outDir, dbname):