Exemplo n.º 1
0
    def __init__(self):

        self.id = Object3D.getObject3DId()

        self.uuid = _Math.generateUUID()

        self.name = ""
        self.type = "Object3D"

        self.parent = None
        self.children = []

        self.up = Object3D.DefaultUp.clone()

        self.position = vector3.Vector3()
        self.rotation = euler.Euler()
        self.quaternion = quaternion.Quaternion()
        self.scale = vector3.Vector3(1, 1, 1)

        def onRotationChange():

            self.quaternion.setFromEuler(self.rotation, False)

        def onQuaternionChange():

            self.rotation.setFromQuaternion(self.quaternion, None, False)

        self.rotation.onChange(onRotationChange)
        self.quaternion.onChange(onQuaternionChange)

        self.modelViewMatrix = matrix4.Matrix4()
        self.normalMatrix = matrix3.Matrix3()

        self.matrix = matrix4.Matrix4()
        self.matrixWorld = matrix4.Matrix4()

        self.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate
        self.matrixWorldNeedsUpdate = False

        self.layers = layers.Layers()
        self.visible = True

        self.castShadow = False
        self.receiveShadow = False

        self.frustumCulled = True
        self.renderOrder = 0

        self.userData = {}

        self.isObject3D = True

        self.onBeforeRender = lambda *args: None
        self.onAfterRender = lambda *args: None
Exemplo n.º 2
0
	def __init__(self, model_path, transfer):
		self.model_path = model_path
                self.transfer = transfer
		self.load_layers()
		self.layers = layers.Layers(self.weight_dict)
eta = 0.0
a0 = 0.0
a1 = 0.0
protocol = "LOCAL"
theta = .0
PERFECT_LAST_ROUND = False

p = 0.029
q = 0.029
iterations = 1
cycles = 1

# Initialize objects
fail_rate = 0
sc = surface_code.SurfaceCode(distance, topology)
lc = layers.Layers(sc)
# sc.init_error_obj(topology, ps, pm, pg, eta, a0, a1, theta, protocol)

# Choose a measurement protocol
# sc.select_measurement_protocol(0, 0, "single", 0.0)

# Perform measurements
for i in range(iterations):

    # Errors and measurements
    # Random errors
    if q != 0:
        for t in range(cycles):
            sc.apply_qubit_error(p, 0)
            sc.measure_all_stabilizers()
            sc._stabilizer_lie("S", q)