コード例 #1
0
        plot_now(experiment, theory, parameter_space, do_fit=False)

    # Close hardware
    dac.zero()
    
    # Normalize, save and return data
    #data=data/np.amax(data)
    experiment_filename, theory_filename, param_filename = get_filenames(heater_index)
    np.save(experiment_filename, experiment)
    np.save(theory_filename, theory)
    np.save(param_filename, parameter_space)
    return experiment_filename, theory_filename, param_filename

start_time=timestamp()    

device=lo.beamsplitter_network(json='cnot_mz.json')
simulator=lo.simulator(device, nphotons=2)
simulator.set_input_state([1,3])
simulator.set_visibility(0.95)
dac=dac.dac()
fpga=fpga()
fpga.read()
fpga.read()
fpga.read()
fpga.read()
table=calibration_table()

heater_index = 5
#hold_table=[[0,pi/2],[2,0], [6,pi/2]]
hold_table=list(enumerate([0,pi/2,0,0,0,0,0,pi/2]))
コード例 #2
0
    # Normalize, save and return data
    #data=data/np.amax(data)
    experiment_filename, theory_filename, param_filename, hold_table_filename = get_filenames(
        heater_index)
    file = open(hold_table_filename, "w")
    file.write(str(hold_table))
    file.close()
    np.save(experiment_filename, experiment)
    np.save(theory_filename, theory)
    np.save(param_filename, parameter_space)
    return experiment_filename, theory_filename, param_filename


start_time = timestamp()

device = lo.beamsplitter_network(json='cnot_mz.json')
simulator = lo.simulator(device, nphotons=2)
simulator.set_input_state([1, 3])
simulator.set_visibility(0.99)
dac = dac.dac()
fpga = fpga()
fpga.read()
fpga.read()
fpga.read()
fpga.read()
table = calibration_table()

heater_index = 6
#hold_table=[[0,pi/2],[2,0], [6,pi/2]]
hold_table = list(enumerate([pi, 0, 0, 0, 0, 0, 0, 0]))
コード例 #3
0
ファイル: hom_tests.py プロジェクト: callumwilkes/qy
import numpy as np
from qy.simulation import linear_optics as lo

'''
Test our code with some HOM dips
'''

# Build a BS and a two-photon basis
basis=lo.basis(2,2)
device=lo.beamsplitter_network(json='devices/beamsplitter.json')

# Draw it
device.draw('devices/beamsplitter.pdf')

# Start a simulator
simulator=lo.simulator(device, basis)

# Set the input state and get some probabilities
input_state=basis.get_state([0,1])
print 'INPUT:', input_state
simulator.set_input_state(input_state)
print simulator.get_probability_quantum([0,0])
print simulator.get_probability_quantum([0,1])
print simulator.get_probability_classical([0,1])


# Let's try a few different input states
for input_modes in [[0,1], [0,0], [1,1]]:
    input_state=basis.get_state(input_modes)
    simulator.set_input_state(input_state)
    print '\nINPUT:', str(input_state).strip()