Changeset 433 for branches

Show
Ignore:
Timestamp:
08/28/09 22:47:46 (3 years ago)
Author:
lestebanez
Message:

spikes.py & analog.py : a better detection of numeric argument for 't_start' in the constructors of all Spike and Analog related objects

Location:
branches/interval/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/interval/src/nex/nex_wrapper.py

    r413 r433  
    145145  fragmentStarts = np.fromstring(bin_file.read(data['n']*4), np.int32) 
    146146  t0 = timestamps[0] - fragmentStarts[0]/float(data['WFrequency'])*1000. 
    147   output_dict['contvars'][data['name']] = AnalogSignal(np.fromstring(bin_file.read(data['NPointsWave']*2), np.int16)*data['ADtoMV'] + data['MVOffset'], 1/float(data['WFrequency']), t_start=t0); 
     147  output_dict['contvars'][data['name']] = AnalogSignal(np.fromstring(bin_file.read(data['NPointsWave']*2), np.int16)*data['ADtoMV'] + data['MVOffset'], 1/float(data['WFrequency']), t_start=t0) 
    148148  bin_file.seek(filePosition,0)       
    149149 
  • branches/interval/src/signals/analogs.py

    r432 r433  
    3131""" 
    3232 
    33 import os, re, numpy, copy, logging 
     33import os, re, numpy, copy, logging, operator 
    3434from NeuroTools import check_dependency, check_numpy_version, analysis 
    3535from NeuroTools.io import * 
     
    113113                interval_out = Interval([[t_start, t_stop]]) 
    114114            elif t_start is not None and t_stop is None: 
    115                 if type(t_start) == float or type(t_start) == int: 
     115                if operator.isNumberType(t_start): 
    116116                    interval_out = Interval([[t_start, t_start + len(self.signal)*self.dt]]) 
    117117                else : 
     
    497497                interval_out = Interval([[t_start, t_stop]]) 
    498498            elif t_start is not None and t_stop is None: 
    499                 if type(t_start) == float or type(t_start) == int: 
     499                if operator.isNumberType(t_start): 
    500500                    interval_out = Interval([[t_start, t_start + len(signal)*self.dt]]) 
    501501                else : 
  • branches/interval/src/signals/intervals.py

    r432 r433  
    3939            assert len(sub_intervals) == 1, "Interval package not present, interval must be (t_start, t_stop) !" 
    4040        for item in sub_intervals: 
     41 
    4142            assert (len(item) == 2), "Intervals must be a list of tuple (t_start, t_stop) !" 
    4243            assert item[1] >= item[0], "Intervals must have tuple with t_start < t_stop !" 
  • branches/interval/src/signals/spikes.py

    r431 r433  
    2525""" 
    2626 
    27 import os, re, numpy, copy, logging 
     27import os, re, numpy, copy, logging, operator 
    2828from NeuroTools import check_dependency, check_numpy_version, analysis 
    2929from NeuroTools.io import * 
     
    140140                interval_out = Interval([[t_start, t_stop]]) 
    141141            elif t_start is not None and t_stop is None: 
    142                 if type(t_start) == float or type(t_start) == int: 
     142                if operator.isNumberType(t_start): 
    143143                    try: 
    144144                        t_stop  = numpy.max(self.spike_times) 
     
    909909                interval_out = Interval([[t_start, t_stop]]) 
    910910            elif t_start is not None and t_stop is None: 
    911                 if type(t_start) == float or type(t_start) == int : 
     911                if operator.isNumberType(t_start): 
    912912                    try: 
    913913                        stop_times = numpy.array([self.spiketrains[idx].t_stop for idx in self.id_list()])