Skip to content

Commit

Permalink
Upgrades (#123)
Browse files Browse the repository at this point in the history
* use np.float64 instead of np.float

* return fig and ax in PGM.render

* Revert "return fig and ax in PGM.render"

This reverts commit 92a61be.
  • Loading branch information
varunagrawal committed Mar 17, 2021
1 parent 329247e commit b5a03eb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions daft.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,14 @@ def get_max(maxsize, artist):
maxsize = np.maximum(
maxsize,
artist.center + np.array([artist.width, artist.height]) / 2,
dtype=np.float,
dtype=np.float64,
)
elif isinstance(artist, Rectangle):
maxsize = np.maximum(
maxsize,
np.array([artist._x0, artist._y0], dtype=np.float)
np.array([artist._x0, artist._y0], dtype=np.float64)
+ np.array([artist._width, artist._height]),
dtype=np.float,
dtype=np.float64,
)
return maxsize

Expand All @@ -378,10 +378,10 @@ def get_min(minsize, artist):
minsize = np.minimum(
minsize,
artist.center - np.array([artist.width, artist.height]) / 2,
dtype=np.float,
dtype=np.float64,
)
elif isinstance(artist, Rectangle):
minsize = np.minimum(minsize, np.array([artist._x0, artist._y0], dtype=np.float))
minsize = np.minimum(minsize, np.array([artist._x0, artist._y0], dtype=np.float64))
return minsize

# Auto-set shape
Expand Down Expand Up @@ -1028,7 +1028,7 @@ def render(self, ctx):
"""
ax = ctx.ax()

shift = np.array([0, self.shift], dtype=np.float)
shift = np.array([0, self.shift], dtype=np.float64)
rect = np.atleast_1d(self.rect)
bottom_left = ctx.convert(*(rect[:2] + shift))
top_right = ctx.convert(*(rect[:2] + rect[2:]))
Expand All @@ -1047,7 +1047,7 @@ def render(self, ctx):
ax.add_artist(rectangle)

if self.label is not None:
offset = np.array(self.label_offset, dtype=np.float)
offset = np.array(self.label_offset, dtype=np.float64)
if "left" in self.position:
position = rect[:2]
ha = "left"
Expand Down Expand Up @@ -1193,8 +1193,8 @@ def __init__(self, **kwargs):
self.padding = 0.1
self.shp_fig_scale = 2.54

self.shape = np.array(kwargs.get("shape", [1, 1]), dtype=np.float)
self.origin = np.array(kwargs.get("origin", [0, 0]), dtype=np.float)
self.shape = np.array(kwargs.get("shape", [1, 1]), dtype=np.float64)
self.origin = np.array(kwargs.get("origin", [0, 0]), dtype=np.float64)
self.grid_unit = kwargs.get("grid_unit", 2.0)
self.figsize = self.grid_unit * self.shape / self.shp_fig_scale

Expand Down

0 comments on commit b5a03eb

Please sign in to comment.