switching.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Auspex 作者: BBN-Q 项目源码 文件源码
def load_switching_data(filename_or_fileobject, start_state=None, group="main", failure=False, threshold=None,
                        voltage_scale_factor=1.0, duration_scale_factor=1.0, data_name='voltage', data_filter=None, display=False):
    data, desc = load_from_HDF5(filename_or_fileobject, reshape=False)
    # Regular axes
    states = desc[group].axis("state").points
    reps   = desc[group].axis("attempt").points
    # Main data array, possibly unstructured
    dat = data[group][:].reshape((-1, reps.size, states.size))
    # Filter data if desired
    # e.g. filter_func = lambda dat: np.logical_and(dat['field'] == 0.04, dat['temperature'] == 4.0)
    if data_filter:
        dat = dat[np.where(data_filter(dat))]

    Vs     = dat[data_name]
    durs   = dat['pulse_duration'][:,0,0]
    amps   = dat['pulse_voltage'][:,0,0]
    points = np.array([durs, amps]).transpose()

    if failure:
        return points, reset_failure(Vs, start_state=start_state)
    else:
        return points, switching_phase(Vs, start_state=start_state, threshold=threshold, display=display)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号