コード例 #1
0
def lu_iv_sum_stats(data):
    output = []
    for d in data.split_periodic(5330, adjust=True):
        d = d.trim(5030, 5330, adjust=True)
        peak_curr = max(d['ito.i_to'], key=abs)
        output = output + [peak_curr/max_peak]
    return output
コード例 #2
0
def yang_iv_sum_stats(data):
    out_pk = []
    for i, d in enumerate(data.split_periodic(5450, adjust=True)):
        d = d.trim(5000, 5450, adjust=True)
        peak_curr = np.max(d['ito.i_to'])
        out_pk = out_pk + [peak_curr] #/max_peak]
    return out_pk
コード例 #3
0
def xu_ta_sum_stats(data):
    output = []
    def single_exp(t, tau, A):
        return A*(1-np.exp(-t/tau))
    for d in data.split_periodic(19500, adjust=True):
        d = d.trim(15000, 19500, adjust=True)
        curr = d['ito.i_to']
        time = d['engine.time']

        # Get rising phase of current
        index = np.argmax(np.abs(curr))
        curr = curr[:index+1]
        time = time[:index+1]
        with warnings.catch_warnings():
            warnings.simplefilter('error', so.OptimizeWarning)
            warnings.simplefilter('error', RuntimeWarning)
            try:
                if len(time) <= 1 or len(curr) <= 1:
                    raise Exception('failed simulation')
                imax = max(curr, key=abs)
                curr = [c_/imax for c_ in curr]
                popt, _ = so.curve_fit(single_exp, time, curr,
                                       p0=[10., 1.],
                                       bounds=([0., -np.inf],
                                               [np.inf, np.inf]))
                taua = popt[0]
                output = output + [taua]#/max_taua]
            except:
                output = output + [float('inf')]
    return output
コード例 #4
0
def xu_inact_sum_stats(data):
    output = []
    for d in data.split_periodic(25000., adjust=True):
        d = d.trim(20000., 25000., adjust=True)
        current = d['ito.i_to']
        output = output + [max(current, key=abs)]
    for i in range(1, len(output)):
        output[i] = output[i]/output[0]
    output[0] = 1.
    return output