Skip to content

Commit

Permalink
reduce default verbosity and fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yoachim committed Jan 4, 2024
1 parent 5bd45b7 commit 8e6004a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rubin_sim/maf/metrics/mo_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def run(self, sso_obs, orb, hval):
sso_obs[self.night_col][vis][good_idx] - sso_obs[self.night_col][vis][good_idx][sIdx]
<= self.t_window
)[0]
end_idxs[i] = np.array([in_window.max()])
end_idxs[i] = in_window.max()
# Convert back to index based on sso_obs[vis] (sorted by expMJD).
start_idxs = good_idx[start_idxs]
end_idxs = good_idx_ends[end_idxs]
Expand Down
12 changes: 9 additions & 3 deletions rubin_sim/maf/slicers/base_slicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BaseSlicer(metaclass=SlicerRegistry):
The value the Slicer uses to fill masked metric data values
"""

def __init__(self, verbose=True, badval=-666):
def __init__(self, verbose=False, badval=-666):
self.verbose = verbose
self.badval = badval
# Set the cache_size.
Expand Down Expand Up @@ -419,7 +419,10 @@ def read_data(self, infilename):
try:
slicer = getattr(slicers, slicer_name)(**slicer_init)
except TypeError:
warnings.warn(f"Cannot use saved slicer init values; falling back to defaults for {infilename}")
if self.verbose:
warnings.warn(
f"Cannot use saved slicer init values; falling back to defaults for {infilename}"
)
slicer = getattr(slicers, slicer_name)()
# Restore slice_point information.
slicer.nslice = slicer_nslice
Expand Down Expand Up @@ -489,7 +492,10 @@ def read_backwards_compatible(self, restored, infilename):
try:
slicer = getattr(slicers, slicer_name)(**slicer_init)
except TypeError:
warnings.warn(f"Cannot use saved slicer init values; falling back to defaults for {infilename}")
if self.verbose:
warnings.warn(
f"Cannot use saved slicer init values; falling back to defaults for {infilename}"
)
slicer = getattr(slicers, slicer_name)()
# Restore slice_point information.
slicer.nslice = slicer_nslice
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/maf/utils/obs2sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import healpy as hp
import numpy as np
import pandas as pd
from rubin_scheduler.utils import Site, _approx_ra_dec2_alt_az, m5_flat_sed, raDec2Hpid

import rubin_sim.skybrightness_pre as sb
from rubin_sim.skybrightness import SkyModel
from rubin_sim.utils import Site, _approx_ra_dec2_alt_az, m5_flat_sed, raDec2Hpid


def obs2sqlite(
Expand Down
2 changes: 1 addition & 1 deletion rubin_sim/moving_objects/direct_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(
obs_info="",
tstep=1.0,
rough_tol=10.0,
verbose=True,
verbose=False,
night_col="night",
filter_col="filter",
m5_col="fiveSigmaDepth",
Expand Down
4 changes: 4 additions & 0 deletions rubin_sim/moving_objects/make_lsst_obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def setup_args(parser=None):
default=None,
help="Send log output to log_file, instead of to console. (default = console)",
)
parser.add_argument("--verbose", dest="verbose", action="store_true", help="Print more output")
parser.set_defaults(verbose=False)

args = parser.parse_args()

if args.simulation_db is None:
Expand Down Expand Up @@ -244,6 +247,7 @@ def make_lsst_obs():
tstep=args.t_step,
rough_tol=args.rough_tol,
obs_info=args.obs_info,
verbose=args.verbose,
)
filterlist = np.unique(pointing_data["filter"])
d_obs.read_filters(filterlist=filterlist)
Expand Down

0 comments on commit 8e6004a

Please sign in to comment.