Changeset 12953 for fact/tools


Ignore:
Timestamp:
02/28/12 18:29:56 (13 years ago)
Author:
neise
Message:
implemented correcto handling for 2D data arrays ... 3D will still fail.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/fir_filter.py

    r12948 r12953  
    2323    def __call__(self, data):
    2424        length = max(len(self.a),len(self.b))-1
    25         initial = np.ones(length)
    26         initial *= data[0]
     25       
     26        #print data
     27        #print data.ndim
     28        #print data.shape
     29        if ( data.ndim == 1):
     30            initial = np.ones(length)
     31            initial *= data[0]
     32        elif ( data.ndim == 2):
     33            initial = np.ones( (data.shape[0], length) )
     34            for i in range(data.shape[0]):
     35                initial[i,:] *= data[i,0]
     36        else:
     37            print 'HELP.'
     38            pass
     39       
     40        #print 'initial:\n' , initial
    2741        filtered, zf = signal.lfilter(self.b, self.a, data, zi=initial)
     42        #filtered= signal.lfilter(self.b, self.a, data)
    2843        return filtered
    2944
Note: See TracChangeset for help on using the changeset viewer.