Skip to content

Commit

Permalink
Merge pull request #31 from barkls/master
Browse files Browse the repository at this point in the history
Fixed spacing for colour images
  • Loading branch information
tdimiduk committed May 13, 2016
2 parents 61a71cf + 90114e3 commit 882ca05
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions holopy/core/marray.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,24 @@ def __init__(self, shape=None, spacing=None, optics=None,
def size(self):
return self.shape[0]*self.shape[1]

@property
def spacing(self):
return getattr(self, '_spacing', None)

@spacing.setter
def spacing(self, spacing):
# if we change the spacing, we have to change our positions
# object to match
if getattr(self, 'spacing', None) is spacing or self.shape is None:
# Fast path, since there are a number of things that will
# set schema attributes to the same as they already are
return
else:
if np.isscalar(spacing):
spacing = np.repeat(spacing, 2)

self._spacing = spacing


@_describe_init_signature
class Image(RegularGrid, ImageSchema):
Expand Down

0 comments on commit 882ca05

Please sign in to comment.