Skip to content

Commit

Permalink
Merge pull request #128 from lsst/tickets/DM-39726
Browse files Browse the repository at this point in the history
DM-39726: Use warnings instead of numpy.warnings
  • Loading branch information
timj committed Jun 20, 2023
2 parents 4f845fd + 33a7917 commit 25b4767
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/lsst/analysis/tools/actions/vector/vectorActions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
)

import logging
import warnings
from typing import Optional, cast

import numpy as np
Expand Down Expand Up @@ -144,9 +145,9 @@ def getInputSchema(self) -> KeyedDataSchema:
return ((self.vectorKey, Vector),)

def __call__(self, data: KeyedData, **kwargs) -> Vector:
with np.warnings.catch_warnings(): # type: ignore
np.warnings.filterwarnings("ignore", r"invalid value encountered") # type: ignore
np.warnings.filterwarnings("ignore", r"divide by zero") # type: ignore
with warnings.catch_warnings():
warnings.filterwarnings("ignore", r"invalid value encountered")
warnings.filterwarnings("ignore", r"divide by zero")
vec = cast(Vector, data[self.vectorKey.format(**kwargs)])
mags = (np.array(vec) * u.Unit(self.fluxUnit)).to(u.ABmag).value # type: ignore
if self.returnMillimags:
Expand Down

0 comments on commit 25b4767

Please sign in to comment.