Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#175)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](pre-commit/mirrors-mypy@v1.5.1...v1.6.0)

* Add unnecessary type ignores

Signed-off-by: nstarman <[email protected]>

---------

Signed-off-by: nstarman <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: nstarman <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and nstarman authored Oct 17, 2023
1 parent fd12860 commit 12d4c12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ repos:
- --fix

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.5.1"
rev: "v1.6.0"
hooks:
- id: mypy
additional_dependencies: ["numpy>=1.21,<1.24", typing_extensions>=4.4.0]
Expand Down
12 changes: 7 additions & 5 deletions src/stream_ml/core/builtin/_isochrone/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from stream_ml.core.typing import Array

if TYPE_CHECKING:
from stream_ml.core.params import Params
from stream_ml.core.typing import ArrayNamespace


Expand All @@ -31,18 +30,21 @@ class Parallax2DistMod(SupportsXP[Array]):
neg_clip_mu: float = 1e-30
array_namespace: ArrayNamespace[Array]

def __call__(self, pars: Params[Array], /) -> Params[Array]:
def __call__(
self, pars: dict[str, Array | dict[str, Array]], /
) -> dict[str, Array | dict[str, Array]]:
# Convert parallax (mas) to distance modulus
# .. math::
# distmod = 5 log10(d [pc]) - 5 = -5 log10(plx [arcsec]) - 5
# = -5 log10(plx [mas] / 1e3) - 5
# = 10 - 5 log10(plx [mas])
# dm = 10 - 5 * xp.log10(pars["photometric.parallax"]["mu"].reshape((-1, 1)))
mu = self.xp.clip(pars[self.astrometric_coord]["mu"], self.neg_clip_mu)
# dm = 10 - 5 * xp.log10(pars["photometric.parallax"]["mu"].reshape((-1,
# 1)))
mu = self.xp.clip(pars[self.astrometric_coord]["mu"], self.neg_clip_mu) # type: ignore[arg-type]
dm = 10 - 5 * self.xp.log10(mu)
ln_dm_sigma = self.xp.log(
_five_over_log10
* self.xp.exp(pars[self.astrometric_coord]["ln-sigma"])
* self.xp.exp(pars[self.astrometric_coord]["ln-sigma"]) # type: ignore[arg-type]
/ mu
)

Expand Down

0 comments on commit 12d4c12

Please sign in to comment.