Skip to content

Commit

Permalink
Black
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiannonlynne committed Mar 4, 2024
1 parent d339cc2 commit b263fb5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,23 @@ def _gal_count(self, apparent_mag, coaddm5):
# calculate the change in the power law constant based on the band
# colors assumed here: (u-g)=(g-r)=(r-i)=(i-z)= (z-y)=0.4
factor = 0.4
band_correction_dict = {'u': -3.0 * factor,
'g': -2.0 * factor,
'r': -1.0 * factor,
'i': 0.0,
'z': factor,
'y': 2.0 * factor}
band_correction_dict = {

Check warning on line 130 in rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py

View check run for this annotation

Codecov / codecov/patch

rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py#L129-L130

Added lines #L129 - L130 were not covered by tests
"u": -3.0 * factor,
"g": -2.0 * factor,
"r": -1.0 * factor,
"i": 0.0,
"z": factor,
"y": 2.0 * factor,
}
if self.filter_band not in band_correction_dict:
warnings.warn("Invalid band in GalaxyCountsMetricExtended. "
"Assuming i-band instead.")
warnings.warn("Invalid band in GalaxyCountsMetricExtended. " "Assuming i-band instead.")
band_correction = band_correction_dict.get(self.filter_band, 0.0)

Check warning on line 140 in rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py

View check run for this annotation

Codecov / codecov/patch

rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py#L139-L140

Added lines #L139 - L140 were not covered by tests

# check to make sure that the z-bin assigned is valid.
if (self.redshift_bin != "all") and (self.redshift_bin not in list(self.power_law_const_a.keys())):
warnings.warn("Invalid redshift bin in GalaxyCountsMetricExtended. "
"Defaulting to all redshifts.")
warnings.warn(

Check warning on line 144 in rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py

View check run for this annotation

Codecov / codecov/patch

rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py#L144

Added line #L144 was not covered by tests
"Invalid redshift bin in GalaxyCountsMetricExtended. " "Defaulting to all redshifts."
)
self.redshift_bin = "all"

# consider the power laws
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/metric_bundles/metric_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class MetricBundle:
* constraint (an optional definition of a large subset of data)
Together these define a unique combination of an opsim benchmark,
or "metric bundle".
or "metric bundle".
An example would be:
a CountMetric, a HealpixSlicer, and a constraint of 'filter="r"'.
Expand Down
2 changes: 2 additions & 0 deletions rubin_sim/maf/metric_bundles/mo_metric_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class MoMetricBundle(MetricBundle):
opsim run name, and relevant stackers and maps
to apply when calculating the metric values.
"""

def __init__(
self,
metric,
Expand Down Expand Up @@ -373,6 +374,7 @@ class MoMetricBundleGroup:
verbose : `bool`, opt
Flag to turn on/off verbose feedback.
"""

def __init__(self, bundle_dict, out_dir=".", results_db=None, verbose=True):
self.verbose = verbose
self.bundle_dict = bundle_dict
Expand Down
5 changes: 5 additions & 0 deletions rubin_sim/maf/metrics/mo_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class NObsNoSinglesMetric(BaseMoMetric):
determined using the _calcVis method (completeness calculation).
If not None, the snr is calculated and used as a flat cutoff instead.
"""

def __init__(self, snr_limit=None, **kwargs):
super().__init__(**kwargs)
self.snr_limit = snr_limit
Expand All @@ -291,6 +292,7 @@ class NNightsMetric(BaseMoMetric):
determined using the _calcVis method (completeness calculation).
If not None, the snr is calculated and used as a flat cutoff instead.
"""

def __init__(self, snr_limit=None, **kwargs):
super().__init__(**kwargs)
self.snr_limit = snr_limit
Expand All @@ -314,6 +316,7 @@ class ObsArcMetric(BaseMoMetric):
determined using the _calcVis method (completeness calculation).
If not None, the snr is calculated and used as a flat cutoff instead.
"""

def __init__(self, snr_limit=None, **kwargs):
super().__init__(**kwargs)
self.snr_limit = snr_limit
Expand Down Expand Up @@ -487,6 +490,7 @@ class DiscoveryNChancesMetric(BaseChildMetric):
badval : `float`, opt
Value to return when metric cannot be calculated.
"""

def __init__(
self,
parent_discovery_metric,
Expand Down Expand Up @@ -524,6 +528,7 @@ class DiscoveryNObsMetric(BaseChildMetric):
badval : `float`, opt
Value to return when metric cannot be calculated.
"""

def __init__(self, parent_discovery_metric, badval=0, **kwargs):
super().__init__(parent_discovery_metric, badval=badval, **kwargs)
# The number of the discovery chance to use.
Expand Down

0 comments on commit b263fb5

Please sign in to comment.