requsim.quantum_objects package

Classes:

WorldObject(world[, label])

Abstract base class for objects that exist within a World.

Qubit(world[, unresolved_noises, info, label])

A Qubit.

Station(world, position[, memory_noise, ...])

A repeater station.

Pair(world, qubits, initial_state[, label])

A Pair of two qubits with its associated quantum state.

Source(world, position, target_stations[, label])

A source of entangled pairs.

SchedulingSource(world, position, ...[, label])

A Source that schedules its next event according to a distribution.

class requsim.quantum_objects.WorldObject(world, label=None)

Bases: ABC

Abstract base class for objects that exist within a World.

This ensures that all WorldObjects are known by the associated World and that they have easy access via properties to the world and its associated event_queue.

Parameters
  • world (World) – This WorldObject is an object in this world.

  • label (str or None) – A string to represent this object in a human-readable way. If None, a default string will be used. Default: None

Variables
  • world (World) –

  • label (str) – A human-readable label for the object.

  • event_queue (EventQueue) –

  • last_updated (scalar) –

  • required_by_events (list of Events) –

  • is_blocked (bool) –

  • type (str) –

Methods:

add_destroy_callback(callback_func)

destroy()

Remove this WorldObject from the world.

update_time()

Attributes:

type

Returns the quantum object type.

event_queue

Shortcut to access the event_queue self.world.event_queue.

add_destroy_callback(callback_func)
destroy()

Remove this WorldObject from the world.

property type

Returns the quantum object type.

Returns

str – The quantum object type.

property event_queue

Shortcut to access the event_queue self.world.event_queue.

Returns

EventQueue – The event queue

update_time()
class requsim.quantum_objects.Qubit(world, unresolved_noises=None, info=None, label=None)

Bases: WorldObject

A Qubit.

Parameters
  • world (World) – This WorldObject is an object in this world.

  • unresolved_noises (list of NoiseChannel, or None) – Noise that affected the qubit, but has not been applied to the state yet. Default: None

  • info (dict or None) – Initial information dictionary for storing additional information such as where the qubit is located and whether it is part of a pair. This should not be used as a workaround to access these actions. Default: None

  • label (str or None) – Optionally, provide a custom label.

Variables
  • type (str) – “Qubit”

  • higher_order_object (QuantumObject or None) – If the qubit is part of a higher level concept (e.g. a pair) this can be accessed here, otherwise None.

Attributes:

type

Returns the quantum object type.

Methods:

update_info(info_dictionary)

Update to the internal info dict.

add_time_dependent_noise(noise_channel)

remove_time_dependent_noise(noise_channel)

add_noise_handler(noise_handler)

remove_noise_handler(noise_handler)

apply_noise(noise_channel, *args, **kwargs)

property type

Returns the quantum object type.

Returns

str – The quantum object type.

update_info(info_dictionary)

Update to the internal info dict.

This method is provided to avoid accessing self._info directly, as the information in self._info should not be used to avoid using the proper registering and deregistering methods to e.g. handle noise.

Parameters

info_dictionary (dict) – Internal info dict will be updated with this dictionary.

Returns

None

add_time_dependent_noise(noise_channel)
remove_time_dependent_noise(noise_channel)
add_noise_handler(noise_handler)
remove_noise_handler(noise_handler)
apply_noise(noise_channel, *args, **kwargs)
class requsim.quantum_objects.Station(world, position, memory_noise=None, memory_cutoff_time=None, BSM_noise_model=NoiseModel(channel_before=None, map_replace=None, channel_after=None), creation_noise_channel=None, dark_count_probability=0, label=None)

Bases: WorldObject

A repeater station.

Parameters
  • world (World) – This WorldObject is an object in this world.

  • position (scalar or np.ndarray) – Position on 1D line (scalar) or coordinates (np.ndarray).

  • memory_noise (NoiseChannel or None) – Should take parameters rho (density matrix) and t (time). Default: None

  • memory_cutoff_time (scalar or None) – Qubits will be discarded after this amount of time in memory. Default: None

  • BSM_noise_model (NoiseModel) – Noise model that is used for Bell State measurements performed at this station (especially for entanglement swapping). Default: dummy NoiseModel that corresponds to no noise.

  • creation_noise_channel (NoiseChannel or None) – Noise channel that is applied to a qubit on creation. (e.g. misalignment) Default: None

  • dark_count_probability (scalar) – Probability that a detector clicks without a state arriving. This is not used by the Station itself, but state generation functions may use this. Default: 0

  • label (str or None) – Optionally, provide a custom label.

Variables
  • position (scalar) – Position in meters in the 1D line for this linear repeater.

  • qubits (list of Qubit objects) – The qubits currently at this position.

  • type (str) – “Station”

  • memory_noise (NoiseChannel or None) –

  • memory_cutoff_time (scalar or None) –

  • BSM_noise_model (NoiseModel) –

  • creation_noise_channel (NoiseChannel or None) –

  • dark_count_probability (scalar) –

Attributes:

type

Returns the quantum object type.

Methods:

register_qubit(qubit)

Add a qubit to be tracked by this station.

create_qubit([label])

Create a new qubit at this station.

remove_qubit(qubit)

Remove a qubit from the station.

property type

Returns the quantum object type.

Returns

str – The quantum object type.

register_qubit(qubit)

Add a qubit to be tracked by this station.

This is usually used when the qubit is present at this station. It causes the qubit to be influenced by properties of the station, most prominently the noise model of station.memory_noise for being stored in a quantum memory.

Parameters

qubit (Qubit) – The qubit to add.

Returns

None

create_qubit(label=None)

Create a new qubit at this station.

Parameters

label (str) – Optionally assign a label to the Qubit (the default is None).

Returns

Qubit – The created Qubit object.

remove_qubit(qubit)

Remove a qubit from the station.

The qubit is no longer tracked by the station and no longer influenced by the error models tied to that station. Basically undoes what the register_qubit method did.

Parameters

qubit (Qubit) – Description of parameter qubit.

Returns

None

class requsim.quantum_objects.Pair(world, qubits, initial_state, label=None)

Bases: WorldObject

A Pair of two qubits with its associated quantum state.

Parameters
  • world (World) – This WorldObject is an object in this world.

  • qubits (list of Qubits) – The two qubits that are part of this entangled Pair.

  • initial_state (np.ndarray) – The two qubit system is intialized with this density matrix.

  • label (str or None) – Optionally, provide a custom label.

Variables
  • state (np.ndarray) – Current density matrix of this two qubit system.

  • qubit1 (Qubit) – Alternative way to access self.qubits[0]

  • qubit2 (Qubit) – Alternative way to access self.qubits[1]

  • qubits (List of qubits) – The two qubits that are part of this entangled Pair.

  • type (str) – “Pair”

Attributes:

type

Returns the quantum object type.

qubit1

Alternative way to access self.qubits[0].

qubit2

Alternative way to access self.qubits[1].

Methods:

is_between_stations(station1, station2)

Check whether qubits are at specified stations.

destroy()

Remove this WorldObject from the world.

property type

Returns the quantum object type.

Returns

str – The quantum object type.

property qubit1

Alternative way to access self.qubits[0].

Returns

Qubit – The first qubit of the pair.

property qubit2

Alternative way to access self.qubits[1].

Returns

Qubit – The second qubit of the pair.

is_between_stations(station1, station2)

Check whether qubits are at specified stations.

Parameters
Returns

bool – True if pair is between station1 and station2, False otherwise.

destroy()

Remove this WorldObject from the world.

class requsim.quantum_objects.Source(world, position, target_stations, label=None)

Bases: WorldObject

A source of entangled pairs.

Parameters
  • world (World) – This WorldObject is an object in this world.

  • position (scalar) – Position in meters in the 1D line for this linear repeater.

  • target_stations (list of Stations) – The two stations the source to which the source sends the entangled pairs, usually the neighboring repeater stations.

  • label (str or None) – Optionally, provide a custom label.

Variables
  • position (scalar) – Position in meters in the 1D line for this linear repeater.

  • target_stations (list of Stations) – The two stations the source to which the source sends the entangled pairs, usually the neighboring repeater stations.

  • type (str) – “Source”

Attributes:

type

Returns the quantum object type.

Methods:

generate_pair(initial_state)

Generate an entangled pair.

property type

Returns the quantum object type.

Returns

str – The quantum object type.

generate_pair(initial_state)

Generate an entangled pair.

The Pair will be generated in the initial_state at the self.target_stations of the source. Usually called from a SourceEvent.

Parameters

initial_state (np.ndarray) – Initial density matrix of the two-qubit

Returns

Pair – The newly generated Pair.

class requsim.quantum_objects.SchedulingSource(world, position, target_stations, time_distribution, state_generation, label=None)

Bases: Source

A Source that schedules its next event according to a distribution.

Parameters
  • Source (see) –

  • time_distribution (callable) – Used for scheduling. Should return the amount of time until the next SourceEvent should take place (possibly probabilistic).

  • state_generation (callable) – Should return (possibly probabilistically) the density matrix of the pair generated by the source. Takes the source as input.

  • label (str or None) – Optionally, provide a custom label.

Methods:

schedule_event()

Schedule a SourceEvent according to the specified rules.

schedule_event()

Schedule a SourceEvent according to the specified rules.

Will generate a pair after a time detemined by time_distribution and in a state specified by state_generation.

Returns

SourceEvent – The event that was scheduled by this.