##// END OF EJS Templates
jroproc_voltage.py: Interpolate heights operation fixed
Julio Valdez -
r837:b6cce344e267
parent child
Show More
@@ -1,5 +1,6
1 import sys
1 import sys
2 import numpy
2 import numpy
3 from scipy import interpolate
3
4
4 from jroproc_base import ProcessingUnit, Operation
5 from jroproc_base import ProcessingUnit, Operation
5 from schainpy.model.data.jrodata import Voltage
6 from schainpy.model.data.jrodata import Voltage
@@ -299,12 +300,18 class VoltageProc(ProcessingUnit):
299 if len(numpy.shape(self.dataOut.data))==2:
300 if len(numpy.shape(self.dataOut.data))==2:
300 sampInterp = (self.dataOut.data[:,botLim-1] + self.dataOut.data[:,topLim+1])/2
301 sampInterp = (self.dataOut.data[:,botLim-1] + self.dataOut.data[:,topLim+1])/2
301 sampInterp = numpy.transpose(numpy.tile(sampInterp,(topLim-botLim + 1,1)))
302 sampInterp = numpy.transpose(numpy.tile(sampInterp,(topLim-botLim + 1,1)))
302 self.dataOut.data[:,botLim:limSup+1] = sampInterp
303 #self.dataOut.data[:,botLim:limSup+1] = sampInterp
304 self.dataOut.data[:,botLim:topLim+1] = sampInterp
303 else:
305 else:
304 sampInterp = (self.dataOut.data[:,:,botLim-1] + self.dataOut.data[:,:,topLim+1])/2
306 nHeights = self.dataOut.data.shape[2]
305 nInt = topLim - botLim + 1
307 x = numpy.hstack((numpy.arange(botLim),numpy.arange(topLim+1,nHeights)))
306 for i in range(nInt):
308 y = self.dataOut.data[:,:,range(botLim)+range(topLim+1,nHeights)]
307 self.dataOut.data[:,:,botLim+i] = sampInterp
309 f = interpolate.interp1d(x, y, axis = 2)
310 xnew = numpy.arange(botLim,topLim+1)
311 ynew = f(xnew)
312
313 self.dataOut.data[:,:,botLim:topLim+1] = ynew
314
308 # import collections
315 # import collections
309
316
310 class CohInt(Operation):
317 class CohInt(Operation):
General Comments 0
You need to be logged in to leave comments. Login now