Skip to content

Commit

Permalink
improve convolvable from file
Browse files Browse the repository at this point in the history
  • Loading branch information
brandondube committed Dec 15, 2018
1 parent 8eb84d3 commit 973258e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions prysm/convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import matplotlib as mpl

from prysm import mathops as m
from .conf import config
from .fttools import forward_ft_unit, pad2d
from .util import share_fig_ax

Expand Down Expand Up @@ -380,20 +381,17 @@ def from_file(path, scale):
Returns
-------
`Image`
`Convolvable`
a new image object
Notes
-----
TODO: proper handling of images with more than 8bpp.
'''
from imageio import imread
imgarr = imread(path, flatten=True, pilmode='F')
imgarr = imread(path)
s = imgarr.shape
extx, exty = s[0] * scale // 2, s[1] * scale // 2
ux, uy = m.arange(-extx, exty, scale), m.arange(-exty, exty, scale)
return Convolvable(data=m.flip(imgarr, axis=0) / 255, unit_x=ux, unit_y=uy, has_analytic_ft=False)
return Convolvable(data=m.flip(imgarr, axis=0).astype(config.precision),
unit_x=ux, unit_y=uy, has_analytic_ft=False)


def _conv(convolvable1, convolvable2):
Expand Down

0 comments on commit 973258e

Please sign in to comment.