Skip to content

Commit 09397cd

Browse files
committed
Make interpolate work with MaskedArrays
1 parent 9004d8a commit 09397cd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Stoner/Analysis.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,8 @@ def extrapolate(self,new_x,xcol=None,ycol=None,yerr=None,overlap=20,kind='linear
964964
scalar_x=not isinstance(new_x,Iterable)
965965
if scalar_x:
966966
new_x=[new_x]
967+
if isinstance(new_x,ma.MaskedArray):
968+
new_x=new_x.compressed
967969
results=_np_.zeros((len(new_x),len(_.ycol)))
968970
for ix,x in enumerate(new_x):
969971
r=self.closest(x,xcol=_.xcol)
@@ -1077,6 +1079,10 @@ def interpolate(self, newX, kind='linear', xcol=None,replace=False):
10771079
xcol = self.setas._get_cols("xcol")
10781080
elif isinstance(xcol, bool) and not xcol:
10791081
xcol = None
1082+
1083+
if isinstance(newX,ma.MaskedArray):
1084+
newX=newX.compressed()
1085+
10801086
if xcol is not None: # We need to convert newX to row indices
10811087
xfunc = interp1d(self.column(xcol), index, kind, 0) # xfunc(x) returns partial index
10821088
newX = xfunc(newX)

0 commit comments

Comments
 (0)