Esempio n. 1
0
 def rebase_to_fixed_dt(cls, original_trace, dt):
     print 'dt', dt
     from morphforge.core.quantities.wrappers import NpPqWrappers
     print original_trace
     time = NpPqWrappers.arange(start=original_trace.get_min_time(),
                                stop=original_trace.get_max_time(),
                                step=dt)
     data = original_trace.get_values(time)
     return TraceFixedDT(time,
                         data,
                         name=original_trace.name,
                         comment=original_trace.comment,
                         tags=original_trace.tags)
Esempio n. 2
0
 def do_div(cls, lhs, rhs):
     time_axis = cls.get_new_time_axis(lhs, rhs)
     return TraceFixedDT(
         time_axis,
         lhs.get_values(time_axis) / rhs.get_values(time_axis))
Esempio n. 3
0
def _clone_fixed(tr):
    tr_new = TraceFixedDT( 
            time = np.copy( tr.time_pts_np) * tr.time_units,
            data = np.copy( tr.data_pts_np) * tr.data_units )
    copy_trace_attrs(tr, tr_new, comment='+(cloned)')
    return tr_new
Esempio n. 4
0
 def do_sub(cls, lhs, rhs):
     assert type(rhs) == TraceFixedDT and type(lhs) == float
     assert isinstance(rhs.data_pts, pq.Dimensionless)
     return TraceFixedDT(rhs.time_pts, lhs - rhs.data_pts)
Esempio n. 5
0
 def do_div(cls, lhs, rhs):
     assert type(rhs) == TraceFixedDT and type(lhs) == float
     return TraceFixedDT(rhs.time_pts, lhs / rhs.data_pts)
Esempio n. 6
0
 def do_pow(cls, lhs, rhs):
     assert (type(lhs) == TraceFixedDT
             and (type(rhs) == float or type(rhs) == int))
     return TraceFixedDT(lhs.time_pts, lhs.data_pts**rhs)
Esempio n. 7
0
 def do_mul(cls, lhs, rhs):
     assert (type(lhs) == TraceFixedDT and type(rhs) == float)
     return TraceFixedDT(lhs.time_pts, lhs.data_pts * rhs)
Esempio n. 8
0
 def do_add(cls, lhs, rhs):
     assert (type(lhs) == TraceFixedDT and type(rhs) == float)
     assert isinstance(lhs.data_pts, pq.Dimensionless)
     return TraceFixedDT(lhs.time_pts, lhs.data_pts + rhs)
 def do_mul(cls, lhs, rhs):
     assert type(rhs) == TraceFixedDT and type(lhs) == pq.Quantity
     return TraceFixedDT(rhs.time_pts, lhs * rhs.data_pts)
Esempio n. 10
0
 def do_div(cls, lhs, rhs):
     assert (type(lhs) == TraceFixedDT and type(rhs) == pq.Quantity)
     return TraceFixedDT(lhs.time_pts, lhs.data_pts / rhs)