Skip to content

Commit

Permalink
Suppress unnecessary .dustmapsrc log message
Browse files Browse the repository at this point in the history
  • Loading branch information
leeskelvin committed May 10, 2024
1 parent 19fef19 commit c0fb7b0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/lsst/faro/utils/extinction_corr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import logging
import os
from contextlib import redirect_stdout

from astropy.coordinates import SkyCoord

log = logging.getLogger(__name__)

try:
from dustmaps.sfd import SFDQuery
# Suppress unnecessary .dustmapsrc log message on import.
with open(os.devnull, "w") as devnull:
with redirect_stdout(devnull):
from dustmaps.sfd import SFDQuery
except ModuleNotFoundError as e:
log.debug(
"The extinction_corr method is not available without first installing the dustmaps module:\n"
Expand Down

0 comments on commit c0fb7b0

Please sign in to comment.