APS2Pattern.py 文件源码

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

项目:QGL 作者: BBN-Q 项目源码 文件源码
def update_wf_library(filename, pulses, offsets):
    """
    Update a H5 waveform library in place give an iterable of (pulseName, pulse)
    tuples and offsets into the waveform library.
    """
    assert USE_PHASE_OFFSET_INSTRUCTION == False
    #load the h5 file
    with h5py.File(filename) as FID:
        for label, pulse in pulses.items():
            #create a new waveform
            if pulse.isTimeAmp:
                shape = np.repeat(pulse.amp * np.exp(1j * pulse.phase), 4)
            else:
                shape = pulse.amp * np.exp(1j * pulse.phase) * pulse.shape
            try:
                length = offsets[label][1]
            except KeyError:
                print("\t{} not found in offsets so skipping".format(pulse))
                continue
            for offset in offsets[label][0]:
                print("\tUpdating {} at offset {}".format(pulse, offset))
                FID['/chan_1/waveforms'][offset:offset + length] = np.int16(
                    MAX_WAVEFORM_VALUE * shape.real)
                FID['/chan_2/waveforms'][offset:offset + length] = np.int16(
                    MAX_WAVEFORM_VALUE * shape.imag)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号