Skip to content

Commit

Permalink
ruff removing unnecessary or unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiannonlynne committed Sep 15, 2023
1 parent 0dd0c8b commit 91ba6a0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
1 change: 0 additions & 1 deletion rubin_sim/maf/batches/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"microlensing_summary",
)

import inspect

import rubin_sim.maf.metrics as metrics

Expand Down
32 changes: 16 additions & 16 deletions rubin_sim/maf/batches/moving_objects_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ def _setup_child_metrics(parentMetric):
def _configure_child_bundles(parentBundle):
dispDict = {
"group": f"{objtype}",
"subgroup": f"Completeness Over Time",
"subgroup": "Completeness Over Time",
"caption": "Time of discovery of objects",
"order": 0,
}
parentBundle.child_bundles["Time"].set_display_dict(dispDict)
dispDict = {
"group": f"{objtype}",
"subgroup": f"N Chances",
"subgroup": "N Chances",
"caption": "Number of chances for discovery of objects",
"order": 0,
}
Expand Down Expand Up @@ -326,14 +326,14 @@ def _setup_child_metrics(parentMetric):
def _configure_child_bundles(parentBundle):
dispDict = {
"group": f"{objtype}",
"subgroup": f"Completeness Over Time",
"subgroup": "Completeness Over Time",
"caption": "Time of discovery of objects",
"order": 0,
}
parentBundle.child_bundles["Time"].set_display_dict(dispDict)
dispDict = {
"group": f"{objtype}",
"subgroup": f"N Chances",
"subgroup": "N Chances",
"caption": "Number of chances for discovery of objects",
"order": 0,
}
Expand Down Expand Up @@ -734,7 +734,7 @@ def _compbundles(b, bundle, h_mark, results_db):
# Write the completeness bundles to disk, so we can re-read them later.
# (also set the display dict properties, for the results_db output).
for b, bundle in completeness.items():
bundle.display_dict["subgroup"] = f"Completeness"
bundle.display_dict["subgroup"] = "Completeness"
bundle.write(out_dir=out_dir, results_db=results_db)

# Calculate total number of objects - currently for NEOs and PHAs only
Expand Down Expand Up @@ -825,7 +825,7 @@ def _codePlot(key):
plt.grid(True, alpha=0.3)
# Make a PlotHandler to deal with savings/results_db, etc.
ph = plots.PlotHandler(fig_format=fig_format, results_db=results_db, out_dir=out_dir)
display_dict["subgroup"] = f"Completeness over time"
display_dict["subgroup"] = "Completeness over time"
display_dict["caption"] = "Completeness over time, for H values indicated in legend."
ph.save_fig(
fig.number,
Expand Down Expand Up @@ -881,7 +881,7 @@ def _codePlot(key):
"legendloc": (1.01, 0.1),
"color": None,
}
display_dict["subgroup"] = f"Completeness all criteria"
display_dict["subgroup"] = "Completeness all criteria"
display_dict["caption"] = "Plotting all of the cumulative completeness curves together."
ph.plot(
plot_func=plots.MetricVsH(),
Expand Down Expand Up @@ -949,7 +949,7 @@ def characterization_inner_batch(

# Number of observations.
md = info_label
display_dict["subgroup"] = f"N Obs"
display_dict["subgroup"] = "N Obs"
plotDict = {
"ylabel": "Number of observations (#)",
"title": "%s: Number of observations %s" % (run_name, md),
Expand All @@ -971,7 +971,7 @@ def characterization_inner_batch(

# Observational arc.
md = info_label
display_dict["subgroup"] = f"Obs Arc"
display_dict["subgroup"] = "Obs Arc"
plotDict = {
"ylabel": "Observational Arc (days)",
"title": "%s: Observational Arc Length %s" % (run_name, md),
Expand All @@ -992,7 +992,7 @@ def characterization_inner_batch(
bundleList.append(bundle)

# Activity detection.
display_dict["subgroup"] = f"Activity"
display_dict["subgroup"] = "Activity"
for w in windows:
md = info_label + " activity lasting %.0f days" % w
plotDict = {
Expand Down Expand Up @@ -1037,7 +1037,7 @@ def characterization_inner_batch(

# Lightcurve inversion.
md = info_label
display_dict["subgroup"] = f"Color/Inversion"
display_dict["subgroup"] = "Color/Inversion"
plotDict = {
"y_min": 0,
"y_max": 1,
Expand Down Expand Up @@ -1146,7 +1146,7 @@ def characterization_outer_batch(

# Number of observations.
md = info_label
display_dict["subgroup"] = f"N Obs"
display_dict["subgroup"] = "N Obs"
plotDict = {
"ylabel": "Number of observations (#)",
"title": "%s: Number of observations %s" % (run_name, md),
Expand All @@ -1168,7 +1168,7 @@ def characterization_outer_batch(

# Observational arc.
md = info_label
display_dict["subgroup"] = f"Obs Arc"
display_dict["subgroup"] = "Obs Arc"
plotDict = {
"ylabel": "Observational Arc (days)",
"title": "%s: Observational Arc Length %s" % (run_name, md),
Expand All @@ -1189,7 +1189,7 @@ def characterization_outer_batch(
bundleList.append(bundle)

# Activity detection.
display_dict["subgroup"] = f"Activity"
display_dict["subgroup"] = "Activity"
for w in windows:
md = info_label + " activity lasting %.0f days" % w
plotDict = {
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def characterization_outer_batch(

# Color determination.
md = info_label
display_dict["subgroup"] = f"Color/Inversion"
display_dict["subgroup"] = "Color/Inversion"
plotDict = {
"y_min": 0,
"y_max": 1,
Expand Down Expand Up @@ -1375,7 +1375,7 @@ def plot_fractions(
if figroot is None:
figroot = run_name
display_dict = deepcopy(first.display_dict)
display_dict["subgroup"] = f"Characterization Fraction"
display_dict["subgroup"] = "Characterization Fraction"

ph = plots.PlotHandler(fig_format=fig_format, results_db=results_db, out_dir=out_dir)
ph.set_metric_bundles(bdictFractions)
Expand Down
4 changes: 2 additions & 2 deletions rubin_sim/maf/batches/radar_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@ def radar_limited(
subgroupCount += 1
displayDict["subgroup"] = f"{subgroupCount}: WL"
displayDict["order"] = 0
sqlconstraint = f'note not like "DD%" and (filter="g" or filter="r" or filter="i")'
info_label = f"gri band non-DD"
sqlconstraint = 'note not like "DD%" and (filter="g" or filter="r" or filter="i")'
info_label = "gri band non-DD"
minExpTime = 15
m = metrics.WeakLensingNvisits(
lsst_filter=bandpass,
Expand Down
22 changes: 11 additions & 11 deletions rubin_sim/maf/batches/science_radar_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def science_radar_batch(
plotDict = {"n_ticks": 5}
# Have to include all filters in query, so that we check for all-band coverage.
# Galaxy numbers calculated using 'bandpass' images only though.
sqlconstraint = f'note not like "DD%"'
sqlconstraint = 'note not like "DD%"'
info_label = f"{bandpass} band galaxies non-DD"
metric = maf.DepthLimitedNumGalMetric(
nside=nside,
Expand Down Expand Up @@ -628,8 +628,8 @@ def science_radar_batch(
subgroupCount += 1
displayDict["subgroup"] = f"{subgroupCount}: WL"
displayDict["order"] = 0
sqlconstraint = f'note not like "DD%" and (filter="g" or filter="r" or filter="i")'
info_label = f"gri band non-DD"
sqlconstraint = 'note not like "DD%" and (filter="g" or filter="r" or filter="i")'
info_label = "gri band non-DD"
minExpTime = 15
m = metrics.WeakLensingNvisits(
lsst_filter=bandpass,
Expand Down Expand Up @@ -1457,9 +1457,9 @@ def science_radar_batch(
plotDict = {"color_min": 0, "color_max": 1500, "x_min": 0, "x_max": 2000}
displayDict["order"] = 0
displayDict["caption"] = (
f"Evaluate the distribution of filter pairs and time gaps at each point in "
f"the sky. The time gaps are evaluated on a logarithmic spacing "
f"from 0-100 days for pairs of filters, and 0-3650 days for same filters."
"Evaluate the distribution of filter pairs and time gaps at each point in "
"the sky. The time gaps are evaluated on a logarithmic spacing "
"from 0-100 days for pairs of filters, and 0-3650 days for same filters."
)
summarystats = [
metrics.MedianMetric(),
Expand Down Expand Up @@ -1881,8 +1881,8 @@ def science_radar_batch(
# galaxy counting uses dustmap
slicer = slicers.HealpixSlicer(nside=nside, use_cache=False)
displayDict["caption"] = (
f"Approximate number of resolvable galaxies in i band, scaled by the "
f"coadded depth and median seeing. A dust and magnitude cut has been applied."
"Approximate number of resolvable galaxies in i band, scaled by the "
"coadded depth and median seeing. A dust and magnitude cut has been applied."
)
bundle = mb.MetricBundle(
metric,
Expand All @@ -1901,9 +1901,9 @@ def science_radar_batch(
# NlcPoints metric uses star density maps
slicer = slicers.HealpixSlicer(nside=nside, use_cache=False)
displayDict["caption"] = (
f"Approximate number of expected stellar measurements (nstars * nobs) "
f"in all filters, where the limiting magnitude for at least 10 visits "
f"is fainter than 21st magnitude, using a TRILEGAL stellar density map."
"Approximate number of expected stellar measurements (nstars * nobs) "
"in all filters, where the limiting magnitude for at least 10 visits "
"is fainter than 21st magnitude, using a TRILEGAL stellar density map."
)
bundle = mb.MetricBundle(
metric,
Expand Down

0 comments on commit 91ba6a0

Please sign in to comment.