Bob

Client code for QOSST Bob.

class qosst_bob.bob.Bob(config_path: str, enable_laser: bool = True)

Client class that will interact with the sockets and the hardware.

Parameters:
  • config_path (str) – configuration path.

  • enable_laser (bool, optional) – if True, the laser will be enabled by the client. If False, no interaction is made with the laser. Useful for the GUI. Defaults to True.

photon_number: float

Mean photon number at Alice’s side.

polarisation_controller: GenericPolarisationController | None

For polarisation recovery, polarisation controller for Bob.

powermeter: GenericPowerMeter | None

For polarisation recovery, powermeter for Bob.

notifier: QOSSTNotifier

Notifier for Bob.

config_path: str

Location of the configuration path.

is_connected: bool

True if the client is connected to the server.

config: Configuration | None

Configuration object.

electronic_noise: ElectronicNoise | None

Electronic noise object.

electronic_shot_noise: ElectronicShotNoise | None

Electronic shot noise object.

electronic_symbols: ndarray | None

Array of electronic noise symbols after DSP.

electronic_shot_symbols: ndarray | None

Array of electronic+shot noise symbols after DSP.

end_electronic_shot_noise: int

End of the electronic shot noise data in case of automatic calibration.

indices: ndarray | None

Indices to ask for to Alice

alice_symbols: ndarray | None

Symbols of Alice

transmittance: float

Total transmittance estimated.

excess_noise_bob: float

Excess noise estimated at Bob.

vel: float

Normalised electronic noise.

skr: float

Secret key rate.

adc_data: list[numpy.ndarray] | None

List of arrays containing current ADC

signal_data: list[numpy.ndarray] | None

List of arrays containing the signal data.

begin_data: int | None

Indice of beginning of data

end_data: int | None

Indice of end of data

received_tone: ndarray | None

Received stone

quantum_data_phase_noisy: ndarray | None

Array of symbols with phase noise

quantum_symbols: ndarray | None

Array of corrected symbols.

enable_laser: bool

Enable the laser if True. Meant to be False when using the GUI.

laser: GenericLaser | None

Laser device for Bob.

switch: GenericSwitch | None

Switch device for Bob.

adc: GenericADC | None

ADC device for Bob.

frame_uuid: UUID | None

UUID of the current frame.

load_configuration() None

Load or reload the configuration.

open_hardware() None

Open the ADC, the switch and the laser (if enable laser is True).

close_hardware() None

Close the ADC, the switch and the laser (if it was open).

_init_socket()

Init the QOSST socket.

_init_data_adc()

Configure the acquisition of the ADC.

_get_adc_data()

Get the data from the ADC.

_init_notifier()

Initialize the notifier.

connect() bool

Connect the client to the server.

Returns:

True if the operation succeded. False otherwise.

Return type:

bool

close() None

Close the socket and Bob.

identification() bool

Identify the client to the server and get the server identification.

Returns:

True if the identification was successful. False otherwise.

Return type:

bool

initialization() bool

Start a new frame and initializalize to the server.

Returns:

True if the initialization was successful. False otherwise.

Return type:

bool

quantum_information_exchange() bool

Start the Quantum Information Exchange (QIE).

Returns:

True if the QIE was successful. False otherwise.

Return type:

bool

dsp() bool

Apply the Digital Signal Processing (DSP) algorithm.

Returns:

True if the DSP was successful, False otherwise.

Return type:

bool

parameters_estimation() bool

Run the parameters estimation algorithm.

Returns:

True if the parameters estimation wen well, False otherwise.

Return type:

bool

error_correction() bool

Apply error correction on the data.

Raises:

NotImplementedError – This function is not yet implemented.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

privacy_amplification() bool

Apply privacy amplification on the data.

Raises:

NotImplementedError – This function is not yet implemented.

Returns:

True if the operation was successful, False otherwise.

Return type:

bool

_start_acquisition()

Start the acquisition.

_stop_acquisition()

Stop the acquisition.

_do_dsp()

Actually apply the DSP to the data.

Also request the symbols to Alice, in order to correct the global phase.

_wait_for_timer()

Timer for the acquisition.

get_electronic_noise_data()

Acquire electronic+shot noise data using the configured adc.

It will make an acquisition, and compute the noise density.

load_electronic_noise_data()

Load electronic noise from a numpy file.

save_electronic_noise_data(detector: str = '', comment: str = '') None

Save the electronic noise data as numpy file.

get_electronic_shot_noise_data() None

Acquire electronic+shot noise data using the configured adc.

It will switch the state of the optical switch to the calibration state, make an acquisition, switch back, and finally compute the noise density.

load_electronic_shot_noise_data() None

Load electronic+shot noise from a numpy file.

save_electronic_shot_noise_data(detector: str = '', power: float | None = None, comment: str = '') None

Save the electronic+shot noise data as numpy file.

get_alice_photon_number() float

Request variance to Alice.

Raises:

Exception – if the received message is not the expected message.

Returns:

the variance of Alice’s symbols.

Return type:

float

request_parameter_change(parameter: str, new_value: Any) None

Request a parameter change to the server.

Parameters:
  • parameter (str) – full module name of the parameter.

  • new_value (Any) – the requested value for the parameter.

_optimal_polarisation_finding()

The goal of this function is to minimize the power on the powermeter, that corresponds to the vertical polarisation.

This is done by minimizing for the three paddles.