def runSlew(opsdb, colmap, args): resultsDb = db.ResultsDb(outDir=args.outDir) bdict = batches.slewBasics(colmap, args.runName) dbTable = None group = mb.MetricBundleGroup(bdict, opsdb, outDir=args.outDir, resultsDb=resultsDb, dbTable=dbTable) group.runAll() group.plotAll() if 'slewStatesTable' in colmap: bdict = batches.slewAngles(colmap, args.runName) dbTable = colmap['slewStatesTable'] group = mb.MetricBundleGroup(bdict, opsdb, outDir=args.outDir, resultsDb=resultsDb, dbTable=dbTable) group.runAll() group.plotAll() if 'slewSpeedsTable' in colmap: bdict = batches.slewSpeeds(colmap, args.runName) dbTable = colmap['slewSpeedsTable'] group = mb.MetricBundleGroup(bdict, opsdb, outDir=args.outDir, resultsDb=resultsDb, dbTable=dbTable) group.runAll() group.plotAll() if 'slewActivitiesTable' in colmap: nslews = opsdb.fetchTotalSlewN() bdict = batches.slewActivities(colmap, args.runName, totalSlewN=nslews) dbTable = colmap['slewActivitiesTable'] group = mb.MetricBundleGroup(bdict, opsdb, outDir=args.outDir, resultsDb=resultsDb, dbTable=dbTable) group.runAll() group.plotAll() resultsDb.close() mafUtils.writeConfigs(opsdb, args.outDir)
def replotSlew(opsdb, colmap, args): print('Only replots slew basics batch.') bdict = batches.slewBasics(colmap, args.runName) resultsDb = db.ResultsDb(outDir=args.outDir) group = mb.MetricBundleGroup(bdict, opsdb, outDir=args.outDir, resultsDb=resultsDb) group.readAll() group.plotAll() resultsDb.close()
def setBatches(opsdb, colmap, args): propids, proptags, sqltags = setSQL(opsdb, sqlConstraint=args.sqlConstraint) bdict = {} #bdict.update(batches.glanceBatch(colmap=colmap, runName=args.runName, sqlConstraint=args.sqlConstraint)) bdict.update( batches.intraNight(colmap, args.runName, extraSql=args.sqlConstraint)) bdict.update( batches.interNight(colmap, args.runName, extraSql=args.sqlConstraint)) # All metadata, all proposals. bdict.update( batches.allMetadata(colmap, args.runName, sqlConstraint=args.sqlConstraint, metadata='All props')) # WFD only. bdict.update( batches.allMetadata(colmap, args.runName, sqlConstraint=sqltags['WFD'], metadata='WFD')) # number of observations per proposal and per night. bdict.update( batches.nvisitsPerProp(opsdb, colmap, args.runName, sqlConstraint=args.sqlConstraint)) # add nvisits / teff maps. # All props bdict.update( batches.nvisitsM5Maps(colmap, args.runName, extraSql=args.sqlConstraint)) # WFD only bdict.update( batches.nvisitsM5Maps(colmap, args.runName, extraSql=sqltags['WFD'], extraMetadata='WFD')) # All props. bdict.update( batches.tEffMetrics(colmap, args.runName, extraSql=args.sqlConstraint)) # WFD only. bdict.update( batches.tEffMetrics(colmap, args.runName, extraSql=sqltags['WFD'], extraMetadata='WFD')) bdict.update(batches.slewBasics(colmap, args.runName)) # Per night and whole survey filter changes bdict.update(batches.filtersPerNightBatch(colmap, args.runName, nights=1)) bdict.update(batches.filtersWholeSurveyBatch(colmap, args.runName)) return bdict
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): # 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
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 bdict = {} # These metrics are reproduced in other scripts - srd and cadence """ for tag in ['All', 'WFD']: sql = sqls[tag] md = metadata[tag] fO = batches.fOBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md, ditherStacker=args.ditherStacker) bdict.update(fO) astrometry = batches.astrometryBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md, ditherStacker=args.ditherStacker) bdict.update(astrometry) rapidrevisit = batches.rapidRevisitBatch(colmap=colmap, runName=args.runName, extraSql=sql, extraMetadata=md, ditherStacker=args.ditherStacker) bdict.update(rapidrevisit) bdict.update(batches.glanceBatch(colmap=colmap, runName=args.runName, sqlConstraint=args.sqlConstraint)) bdict.update(batches.intraNight(colmap, args.runName, extraSql=args.sqlConstraint)) bdict.update(batches.interNight(colmap, args.runName, extraSql=args.sqlConstraint)) """ # 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