Skip to content

Commit c059937

Browse files
author
Julian Kates-Harbeck
committed
enforcing ordering for spatial interpolation, get NaN's otherwise
1 parent d55c75e commit c059937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plasma/primitives/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def load_data_from_txt_safe(self,prepath,shot,dtype='float32'):
7575
os.remove(file_path)
7676
return None, False
7777

78-
7978
return data,True
8079

8180
def load_data(self,prepath,shot,dtype='float32'):
@@ -224,7 +223,8 @@ def load_data(self,prepath,shot,dtype='float32'):
224223
timesteps = len(t)
225224
sig_interp = np.zeros((timesteps,self.num_channels))
226225
for i in range(timesteps):
227-
f = UnivariateSpline(mapping[i,:],sig[i,:],s=0,k=1,ext=0)
226+
_,order = np.unique(mapping[i,:],return_index=True) #make sure the mapping is ordered and unique
227+
f = UnivariateSpline(mapping[i,order],sig[i,order],s=0,k=1,ext=0)
228228
sig_interp[i,:] = f(remapping)
229229

230230
return t,sig_interp,True

0 commit comments

Comments
 (0)