Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSIM-1063: Ensure MAF imports without data and that all stackers run #349

Merged
merged 11 commits into from
Aug 24, 2023
2 changes: 1 addition & 1 deletion rubin_sim/maf/batches/altaz_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def basicSetup(metric_name, colmap=None, nside=64):
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()

slicer = slicers.HealpixSlicer(
nside=nside,
Expand Down
35 changes: 0 additions & 35 deletions rubin_sim/maf/batches/common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
__all__ = (
"combine_info_labels",
"filter_list",
"radec_cols",
"standard_summary",
"extended_summary",
"standard_metrics",
Expand All @@ -17,7 +16,6 @@
import inspect

import rubin_sim.maf.metrics as metrics
import rubin_sim.maf.stackers as stackers


def combine_info_labels(info1, info2):
Expand Down Expand Up @@ -86,39 +84,6 @@ def filter_list(all=True, extra_sql=None, extra_info_label=None):
return filterlist, colors, orders, sqls, info_labels


def radec_cols(dither_stacker, colmap, ditherkwargs=None):
degrees = colmap["raDecDeg"]
if dither_stacker is None:
raCol = colmap["ra"]
decCol = colmap["dec"]
stacker = None
ditherInfoLabel = None
else:
if isinstance(dither_stacker, stackers.BaseDitherStacker):
stacker = dither_stacker
else:
s = stackers.BaseStacker().registry[dither_stacker]
args = [f for f in inspect.getfullargspec(s).args if f.endswith("Col")]
# Set up default dither kwargs.
kwargs = {}
for a in args:
colmapCol = a.replace("Col", "")
if colmapCol in colmap:
kwargs[a] = colmap[colmapCol]
# Update with passed values, if any.
if ditherkwargs is not None:
kwargs.update(ditherkwargs)
stacker = s(degrees=degrees, **kwargs)
raCol = stacker.colsAdded[0]
decCol = stacker.colsAdded[1]
# Send back some info_label information.
ditherInfoLabel = stacker.__class__.__name__.replace("Stacker", "")
if ditherkwargs is not None:
for k, v in ditherkwargs.items():
ditherInfoLabel += " " + "%s:%s" % (k, v)
return raCol, decCol, degrees, stacker, ditherInfoLabel


def standard_summary(withCount=True):
"""A set of standard summary metrics, to calculate Mean, RMS, Median, #, Max/Min, and # 3-sigma outliers."""
standardSummary = [
Expand Down
4 changes: 2 additions & 2 deletions rubin_sim/maf/batches/filterchange_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def filtersPerNight(colmap=None, runName="opsim", nights=1, extraSql=None, extra
"""

if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

# Set up sql and info_label, if passed any additional information.
Expand Down Expand Up @@ -144,7 +144,7 @@ def filtersWholeSurvey(colmap=None, runName="opsim", extraSql=None, extraInfoLab
metric_bundleDict
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

# Set up sql and info_label, if passed any additional information.
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/batches/glance_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def glanceBatch(
raise ValueError("colmap must be a dictionary, not a string")

if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()

bundle_list = []

Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/batches/hourglass_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def hourglassPlots(colmap=None, runName="opsim", nyears=10, extraSql=None, extra
Add an extra piece of info_label before running metrics. Default None.
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

sql = ""
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/batches/info_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import rubin_sim.maf.batches as batches


def metadata_bundle_dicts(allsky_slicer, wfd_slicer, opsim="opsim", colmap=batches.col_map_dict("FBS")):
def metadata_bundle_dicts(allsky_slicer, wfd_slicer, opsim="opsim", colmap=batches.col_map_dict()):
# Set up the bundle dicts
# Some of these metrics are reproduced in other scripts - srd and cadence
bdict = {}
Expand Down
28 changes: 15 additions & 13 deletions rubin_sim/maf/batches/metadata_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import rubin_sim.maf.metric_bundles as mb
import rubin_sim.maf.metrics as metrics
import rubin_sim.maf.plots as plots
import rubin_sim.maf.slicers as slicers
import rubin_sim.maf.stackers as stackers

Expand All @@ -19,7 +18,6 @@
combine_info_labels,
extended_metrics,
filter_list,
radec_cols,
standard_angle_metrics,
standard_summary,
)
Expand Down Expand Up @@ -69,7 +67,7 @@ def metadataBasics(
metric_bundleDict
"""
if colmap is None:
colmap = col_map_dict("fbs")
colmap = col_map_dict()
bundleList = []

if valueName is None:
Expand All @@ -87,8 +85,10 @@ def metadataBasics(

displayDict = {"group": groupName, "subgroup": subgroup}

raCol, decCol, degrees, ditherStacker, ditherMeta = radec_cols(None, colmap, None)
extraInfoLabel = combine_info_labels(extraInfoLabel, ditherMeta)
raCol = colmap["ra"]
decCol = colmap["dec"]
degrees = colmap["raDecDeg"]

# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, info_label = filter_list(
all=True, extra_sql=extraSql, extra_info_label=extraInfoLabel
Expand Down Expand Up @@ -217,7 +217,7 @@ def metadataBasicsAngle(
metric_bundleDict
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

if valueName is None:
Expand All @@ -235,8 +235,9 @@ def metadataBasicsAngle(

displayDict = {"group": groupName, "subgroup": subgroup}

raCol, decCol, degrees, ditherStacker, ditherMeta = radec_cols(None, colmap, None)
extraInfoLabel = combine_info_labels(extraInfoLabel, ditherMeta)
raCol = colmap["ra"]
decCol = colmap["dec"]
degrees = colmap["raDecDeg"]
# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, info_label = filter_list(
all=True, extra_sql=extraSql, extra_info_label=extraInfoLabel
Expand Down Expand Up @@ -336,7 +337,7 @@ def allMetadata(colmap=None, runName="opsim", extraSql=None, extraInfoLabel=None
"""

if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()

bdict = {}

Expand Down Expand Up @@ -413,7 +414,7 @@ def metadataMaps(
metric_bundleDict
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

if valueName is None:
Expand All @@ -431,8 +432,9 @@ def metadataMaps(

displayDict = {"group": groupName, "subgroup": subgroup}

raCol, decCol, degrees, ditherStacker, ditherMeta = radec_cols(None, colmap, None)
extraInfoLabel = combine_info_labels(extraInfoLabel, ditherMeta)
raCol = colmap["ra"]
decCol = colmap["dec"]
degrees = colmap["raDecDeg"]
# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, info_label = filter_list(
all=True, extra_sql=extraSql, extra_info_label=extraInfoLabel
Expand Down Expand Up @@ -506,7 +508,7 @@ def firstYearMetadata(colmap=None, runName="opsim", extraSql=None, extraInfoLabe
"""

if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()

bdict = {}

Expand Down
8 changes: 4 additions & 4 deletions rubin_sim/maf/batches/moving_objects_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def quick_discovery_batch(
magtype="asteroid",
):
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

basicPlotDict = {
Expand Down Expand Up @@ -277,7 +277,7 @@ def discovery_batch(
magtype="asteroid",
):
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

basicPlotDict = {
Expand Down Expand Up @@ -906,7 +906,7 @@ def characterization_inner_batch(
):
"""Characterization metrics for inner solar system objects."""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

# Set up a dictionary to pass to each metric for the column names.
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def characterization_outer_batch(
):
"""Characterization metrics for outer solar system objects."""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

# Set up a dictionary to pass to each metric for the column names.
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/batches/openshutter_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def openshutterFractions(colmap=None, runName="opsim", extraSql=None, extraInfoL
Additional info_label to add before any below (i.e. "WFD"). Default is None.
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

group = "Open Shutter Fraction"
Expand Down
1 change: 1 addition & 0 deletions rubin_sim/maf/batches/science_radar_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ def science_radar_batch(

# Do the weak lensing per year
for year in np.arange(1, 10):
displayDict["order"] = year
sqlconstraint = (
'note not like "DD%"'
+ ' and (filter="g" or filter="r" or filter="i") and night < %i' % (year * 365.25)
Expand Down
4 changes: 2 additions & 2 deletions rubin_sim/maf/batches/skycoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def meanRADec(colmap=None, runName="opsim", extraSql=None, extraInfoLabel=None):
Additional info_label to add before any below (i.e. "WFD"). Default is None.
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

group = "RA Dec coverage"
Expand Down Expand Up @@ -90,7 +90,7 @@ def eastWestBias(colmap=None, runName="opsim", extraSql=None, extraInfoLabel=Non
Additional info_label to add before any below (i.e. "WFD"). Default is None.
"""
if colmap is None:
colmap = col_map_dict("opsimV4")
colmap = col_map_dict()
bundleList = []

group = "East vs West"
Expand Down
Loading
Loading