def setBatches(opsdb, colmap, args): propids, proptags, sqls, metadata = setSQL( opsdb, sqlConstraint=args.sqlConstraint, extraMeta=None) bdict = {} for tag in ['All', 'WFD']: fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch( colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(rapidrevisit) 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' } #del colmap['note'] gb = glanceBatch(colmap=colmap, slicer_camera=camera, runName=runName) resultsDb = db.ResultsDb(outDir=outDir) group = metricBundles.MetricBundleGroup(gb, conn, outDir=outDir, resultsDb=resultsDb) group.runAll() group.plotAll() fb = fOBatch(colmap=colmap, runName=runName) group = metricBundles.MetricBundleGroup(fb, conn, outDir=outDir, resultsDb=resultsDb) group.runAll() group.plotAll()
def setBatches(opsdb, colmap, args): propids, proptags, sqls, metadata = setSQL(opsdb, sqlConstraint=args.sqlConstraint, extraMeta=None) bdict = {} for tag in ['All', 'WFD']: fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(rapidrevisit) return bdict
def setBatches(opsdb, colmap, args): propids, proptags, sqltags = setSQL(opsdb, sqlConstraint=args.sqlConstraint) bdict = {} for md, sql in zip([None, 'WFD'], [None, sqltags['WFD']]): fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md) bdict.update(rapidrevisit) return bdict
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')
def setBatches(opsdb, colmap, args): # Set up WFD sql constraint propids, proptags, sqls, metadata = setSQL(opsdb, sqlConstraint=args.sqlConstraint) # Set up appropriate metadata - need to combine args.sqlConstraint # Some of these metrics are reproduced in other scripts - srd and cadence bdict = {} plotbundles = [] for tag in ['All', 'WFD']: fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(rapidrevisit) # Intranight (pairs/time) intranight_all, plots = batches.intraNight(colmap, args.runName, extraSql=args.sqlConstraint, ditherStacker=args.ditherStacker) bdict.update(intranight_all) plotbundles.append(plots) sql = '(%s) or (%s)' % (sqls['WFD'], sqls['NES']) md = 'WFD+' + metadata['NES'] intranight_wfdnes, plots = batches.intraNight(colmap, args.runName, extraSql=sql, extraMetadata=md, ditherStacker=args.ditherStacker) bdict.update(intranight_wfdnes) plotbundles.append(plots) # Internight (nights between visits) for tag in ['All', 'WFD']: internight, plots = batches.interNight(colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(internight) plotbundles.append(plots) # Intraseason (length of season) for tag in ['All', 'WFD']: season, plots = batches.seasons(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(season) plotbundles.append(plots) # Run all metadata metrics, All and just WFD. for tag in ['All', 'WFD']: bdict.update(batches.allMetadata(colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) # Nvisits + m5 maps + Teff maps, All and just WFD. for tag in ['All', 'WFD']: bdict.update(batches.nvisitsM5Maps(colmap, args.runName, runLength=args.nyears, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) bdict.update(batches.tEffMetrics(colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) # Nvisits per proposal and per night. bdict.update(batches.nvisitsPerProp(opsdb, colmap, args.runName, extraSql=args.sqlConstraint)) # NVisits alt/az LambertSkyMap (all filters, per filter) bdict.update(batches.altazLambert(colmap, args.runName, extraSql=args.sqlConstraint)) # Slew metrics. bdict.update(batches.slewBasics(colmap, args.runName, sqlConstraint=args.sqlConstraint)) # Open shutter metrics. bdict.update(batches.openshutterFractions(colmap, args.runName, extraSql=args.sqlConstraint)) # Per night and whole survey filter changes. bdict.update(batches.filtersPerNight(colmap, args.runName, nights=1, extraSql=args.sqlConstraint)) bdict.update(batches.filtersWholeSurvey(colmap, args.runName, extraSql=args.sqlConstraint)) # Hourglass plots. bdict.update(batches.hourglassPlots(colmap, args.runName, nyears=args.nyears, extraSql=args.sqlConstraint)) return bdict
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): # Set up WFD sql constraint, if possible. propids, proptags, sqls, metadata = setSQL( opsdb, sqlConstraint=args.sqlConstraint) if 'WFD' in sqls: tags = ['All', 'WFD'] else: tags = ['All'] # Set up appropriate metadata - need to combine args.sqlConstraint # Some of these metrics are reproduced in other scripts - srd and cadence bdict = {} plotbundles = [] for tag in tags: fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch( colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(rapidrevisit) # Intranight (pairs/time) intranight_all, plots = batches.intraNight( colmap, args.runName, extraSql=args.sqlConstraint, ditherStacker=args.ditherStacker) bdict.update(intranight_all) plotbundles.append(plots) if ('WFD' in sqls) and ('NES' in sqls): sql = '(%s) or (%s)' % (sqls['WFD'], sqls['NES']) md = 'WFD+' + metadata['NES'] intranight_wfdnes, plots = batches.intraNight( colmap, args.runName, extraSql=sql, extraMetadata=md, ditherStacker=args.ditherStacker) bdict.update(intranight_wfdnes) plotbundles.append(plots) # Internight (nights between visits) for tag in tags: internight, plots = batches.interNight( colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(internight) plotbundles.append(plots) # Intraseason (length of season) for tag in tags: season, plots = batches.seasons(colmap=colmap, runName=args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker) bdict.update(season) plotbundles.append(plots) # Run all metadata metrics, All and just WFD. for tag in tags: bdict.update( batches.allMetadata(colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) # Nvisits + m5 maps + Teff maps, All and just WFD. for tag in tags: bdict.update( batches.nvisitsM5Maps(colmap, args.runName, runLength=args.nyears, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) bdict.update( batches.tEffMetrics(colmap, args.runName, extraSql=sqls[tag], extraMetadata=metadata[tag], ditherStacker=args.ditherStacker)) # Nvisits per proposal and per night. bdict.update( batches.nvisitsPerProp(opsdb, colmap, args.runName, extraSql=args.sqlConstraint)) # NVisits alt/az LambertSkyMap (all filters, per filter) bdict.update( batches.altazLambert(colmap, args.runName, extraSql=args.sqlConstraint)) # Slew metrics. bdict.update( batches.slewBasics(colmap, args.runName, sqlConstraint=args.sqlConstraint)) # Open shutter metrics. bdict.update( batches.openshutterFractions(colmap, args.runName, extraSql=args.sqlConstraint)) # Per night and whole survey filter changes. bdict.update( batches.filtersPerNight(colmap, args.runName, nights=1, extraSql=args.sqlConstraint)) bdict.update( batches.filtersWholeSurvey(colmap, args.runName, extraSql=args.sqlConstraint)) # Hourglass plots. bdict.update( batches.hourglassPlots(colmap, args.runName, nyears=args.nyears, extraSql=args.sqlConstraint)) return bdict