示例#1
0
文件: DSP_dp.py 项目: stjordanis/QTop
 #
 # QTop
 #
 # Copyright (c) 2016 Jacob Marks ([email protected])
 #
 # This file is part of QTop.
 #
 # QTop is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import dsp

################## Color Code Simulation ##################
path_to = str(sys.argv[1])
model = error_models.Depolarizing()
decoder = dsp.DSP_decoder()
L_vals = [9,11,13]
p_vals = np.linspace(0.05,0.13,15)
num_trials = 30000
d = 2
sim = simulation.simulation(d, '6-6-6 Color Code', [model, 'Depolarizing Channel'], [decoder, 'DSP'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)

示例#2
0
#
# QTop
#
# Copyright (c) 2016 Jacob Marks ([email protected])
#
# This file is part of QTop.
#
# QTop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
import numpy as np
import sys

sys.path.append('../')
from src import common, simulation, error_models

sys.path.append('../src')
from decoders import rg
################## Surface Code Simulation ##################

path_to = str(sys.argv[1])
model = error_models.BitFlip()
decoder = rg.HDRG_decoder()
L_vals = [9, 11, 13]
p_vals = np.linspace(0.09, 0.16, 15)
num_trials = 30000
d = 5
sim = simulation.simulation(d, 'Surface Code', [model, 'Bit Flip Channel'],
                            [decoder, 'RG'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)
示例#3
0
#
# QTop
#
# Copyright (c) 2016 Jacob Marks ([email protected])
#
# This file is part of QTop.
#
# QTop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import rg
################## Surface Code Simulation ##################

path_to = str(sys.argv[1])
model = error_models.Depolarizing()
decoder = rg.HDRG_decoder()
L_vals = [9, 11, 13]
p_vals = np.linspace(0.1, 0.17, 13)
num_trials = 30000
d = 100
sim = simulation.simulation(d, 'Surface Code', [model, 'Depolarizing Channel'],
                            [decoder, 'RG'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)
示例#4
0
        else:
            print(
                f'\033[1;36m[i]\033[0m Generating stairs with width {args.width} ' +\
                f'and height {args.height}.'
            )
            terrain = terrain_gen.stairs(ROWS, COLS, float(args.width),
                                         float(args.height))
            terrain_gen.save(terrain, terrain_file)

    else:
        terrain_file = args.predefined_terrain

    # Initialize simulation
    print('\033[1;36m[i]\033[0m Starting simulation')
    sim = simulation(args.spot_urdf, bullet_server=p, gui=args.gui)
    sim.reset(terrain_file, X_INIT, Y_INIT)

    # Run rosnode for spot-mini
    rospy.init_node('simulation', anonymous=True)

    # Thread that runs the simulation
    sim_th = Thread(target=run_simulation, args=(sim, ))
    sim_th.daemon = True
    sim_th.start()

    # Threads that constantly update each sensor
    sensores_ths = []
    update_functions = {
        (sim.update_position_orientation, 'position and orientation'),
        (sim.update_base_velocity, 'velocities'),
示例#5
0
 #
 # QTop
 #
 # Copyright (c) 2016 Jacob Marks ([email protected])
 #
 # This file is part of QTop.
 #
 # QTop is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import rg
################## Surface Code Simulation ##################

path_to = str(sys.argv[1])
model = error_models.BitFlip()
decoder = rg.HDRG_decoder()
L_vals = [9,11,13]
p_vals = np.linspace(0.06,0.12,15)
num_trials = 50000
d = 2
sim = simulation.simulation(d, 'Surface Code', [model, 'Bit Flip Channel'], [decoder, 'RG'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)

示例#6
0
#
# QTop
#
# Copyright (c) 2016 Jacob Marks ([email protected])
#
# This file is part of QTop.
#
# QTop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import gcc
################## Surface Code Simulation ##################
path_to = str(sys.argv[1])
model = error_models.BitFlip()
decoder = gcc.GCC_decoder()
L_vals = [9, 11, 13]
p_vals = np.linspace(0.05, 0.11, 15)
num_trials = 50000
d = 3
sim = simulation.simulation(d, '6-6-6 Color Code', [model, 'Bit Flip Channel'],
                            [decoder, 'GCC'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)
示例#7
0
 #
 # QTop
 #
 # Copyright (c) 2016 Jacob Marks ([email protected])
 #
 # This file is part of QTop.
 #
 # QTop is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import gcc
################## Surface Code Simulation ##################
path_to = str(sys.argv[1])
model = error_models.BitFlip()
decoder = gcc.GCC_decoder()
L_vals = [9,11,13]
p_vals = np.linspace(0.07,0.16,15)
num_trials = 30000
d = 25
sim = simulation.simulation(d, '6-6-6 Color Code', [model, 'Bit Flip Channel'], [decoder, 'GCC'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)

示例#8
0
 #
 # QTop
 #
 # Copyright (c) 2016 Jacob Marks ([email protected])
 #
 # This file is part of QTop.
 #
 # QTop is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
import numpy as np
import sys
sys.path.append('../')
from src import common, simulation, error_models
sys.path.append('../src')
from decoders import rg
################## Surface Code Simulation ##################

path_to = str(sys.argv[1])
model = error_models.Depolarizing()
decoder = rg.HDRG_decoder()
L_vals = [7,9,11,13]
p_vals = np.linspace(0.1,0.15,15)
num_trials = 30000
d = 2
sim = simulation.simulation(d, 'Surface Code', [model, 'Depolarizing Channel'], [decoder, 'RG'], path_to)
simulation.run(sim, L_vals, p_vals, num_trials)