Changeset 356 for trunk/src/stgen.py

Show
Ignore:
Timestamp:
11/19/08 15:41:48 (3 years ago)
Author:
apdavison
Message:

Changed the behaviour of the AnalogSignal constructor. Before, t_start and t_stop were used to throw away data, on the assumption that the signal always started at t=0 - see [45]. Now, these arguments are used as metadata, and we check that they are consistent with the number of elements in the signal array.

Also added some checks that all the AnalogSignals in an AnalogSignalList are consistent in terms of length, dt, etc.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/stgen.py

    r352 r356  
    700700            return (y,t) 
    701701 
    702         result = AnalogSignal(y,dt,t_start=0,t_stop=t_stop-t_start) 
    703         result.time_offset(t_start) 
     702        result = AnalogSignal(y, dt, t_start, t_stop) 
    704703        return result 
    705704         
     
    755754            return (y,t) 
    756755 
    757         result = AnalogSignal(y,dt,t_start=0,t_stop=t_stop-t_start) 
    758         result.time_offset(t_start) 
     756        result = AnalogSignal(y, dt, t_start, t_stop) 
    759757        return result 
    760758         
     
    829827            return (y,t) 
    830828 
    831         result = AnalogSignal(y,dt,t_start=0,t_stop=t_stop-t_start) 
    832         result.time_offset(t_start) 
     829        result = AnalogSignal(y,dt,t_start,t_stop) 
    833830        return result 
    834831 
     
    881878    st = spike_train 
    882879 
    883     assert t_stop>t_start 
     880    if t_start is not None and t_stop is not None: 
     881        assert t_stop>t_start 
    884882 
    885883    # time of vanishing significance