Skip to content

Commit

Permalink
mypy consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
mlincett committed Nov 8, 2023
1 parent b453263 commit 160de30
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions skyreader/plot/contours.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from dataclasses import dataclass
import healpy
import healpy # type: ignore[import]
import numpy as np
from typing import ClassVar

Expand Down Expand Up @@ -54,8 +54,8 @@ class GaussianContour(CircularContour):
marker: str = "x"
marker_size: int = 20

CONTOUR_STYLES: ClassVar[dict[int, str]] = {50: "-", 90: "--"}
SCALE_FACTORS: ClassVar[dict[int, float]] = {50: 1.177, 90: 2.1459}
CONTOUR_STYLES: ClassVar[dict[float, str]] = {50.0: "-", 90.0: "--"}
SCALE_FACTORS: ClassVar[dict[float, float]] = {50.0: 1.177, 90.0: 2.1459}

@property
def dec_rad(self):
Expand All @@ -69,6 +69,10 @@ def ra_rad(self):
def sigma_deg(self):
return self.radius_50 / self.SCALE_FACTORS[50]

@property
def sigma_rad(self):
return np.rad2deg(self.sigma_deg)

def get_style(self, containment: float):
return self.CONTOUR_STYLES[containment]

Expand All @@ -84,6 +88,6 @@ def generate_contour(self, nside: int, containment: float):
expected in radians."""
radius_rad = self.sigma_rad * self.sigma2radius(containment=containment)
theta, phi = self.circular_contour(
ra_rad=self.ra_rad, dec_rad=self.dec_rad, radius_rad=radius_rad
ra_rad=self.ra_rad, dec_rad=self.dec_rad, radius_rad=radius_rad, nside=nside
)
return theta, phi

0 comments on commit 160de30

Please sign in to comment.