Beispiel #1
0
def build_waveforms(seqs, shapeLib):
	# apply amplitude, phase, and modulation and add the resulting waveforms to the library
	wfLib = {wf_sig(padding_entry(0)) : TAZShape}
	for wf in flatten(seqs):
		if isinstance(wf, Compiler.Waveform) and wf_sig(wf) not in wfLib:
			shape = np.exp(1j*wf.phase) * wf.amp * shapeLib[wf.key]
			if wf.frequency != 0 and wf.amp != 0:
				shape *= np.exp(-1j*2*np.pi*wf.frequency*np.arange(wf.length)/SAMPLING_RATE) #minus from negative frequency qubits
			wfLib[wf_sig(wf)] = shape
	return wfLib
Beispiel #2
0
def build_waveforms(seqs, shapeLib):
    # apply amplitude, phase, and modulation and add the resulting waveforms to the library
    wfLib = {wf_sig(padding_entry(0)): TAZShape}
    for wf in flatten(seqs):
        if isinstance(wf, APSWaveform) and wf_sig(wf) not in wfLib:
            shape = np.exp(1j * wf.phase) * wf.amp * shapeLib[wf.key]
            if wf.frequency != 0 and wf.amp != 0:
                shape *= np.exp(
                    -1j * 2 * np.pi * wf.frequency * np.arange(len(shape)) /
                    SAMPLING_RATE)  #minus from negative frequency qubits
            wfLib[wf_sig(wf)] = shape
    return wfLib
Beispiel #3
0
def flattenSeqs(seq):
    hasList = False
    for el in seq:
        if isinstance(el, collections.Iterable) and not isinstance(
                el, (str, Pulse, CompositePulse)):
            hasList = True
            break
    if hasList:
        newS = []
        for el in flatten(seq):
            newS.append(el)
        return newS
    else:
        return seq