You're reading the documentation of the v0.13. For the latest released version, please have a look at v1.0.

Source

>>> import perceval as pcvl
>>> source = pcvl.Source(emission_probability=0.3, multiphoton_component=0.05)
>>> pcvl.pdisplay(source.probability_distribution())

state

probability

|0>

7/10

|{_:0}>

0.297716

|{_:0}{_:2}>

0.002284

class perceval.components.source.Source(emission_probability=1, multiphoton_component=0, indistinguishability=1, losses=0, multiphoton_model='distinguishable')

Definition of a source We build on a phenomenological model first introduced in ref. [1] where an imperfect quantum-dot based single-photon source is modeled by a statistical mixture of Fock states. The model developed here, first introduced in ref. [2], constructs the input multi-photon state using features specific to Perceval. [1] Pont, Mathias, et al. Physical Review X 12, 031033 (2022). https://doi.org/10.1103/PhysRevX.12.031033 [2] Pont, Mathias, et al. arXiv preprint arXiv:2211.15626 (2022). https://doi.org/10.48550/arXiv.2211.15626

Parameters:
  • emission_probability (float) – probability that the source emits at least one photon

  • multiphoton_component (float) – second order intensity autocorrelation at zero time delay \(g^{(2)}(0)\)

  • indistinguishability (float) – 2-photon mean wavepacket overlap

  • losses (float) – optical losses

  • multiphoton_model (str) – distinguishable if additional photons are distinguishable, indistinguishable otherwise

create_iterator(expected_input, min_photons_filter=0)

Creates a source iterator that can generate all already separated noisy states according to the probability distribution without representing them in memory.

This is far more efficient than computing the whole distribution.

Supports a min_photons_filter to avoid generating states having not enough photons.

>>> from perceval import BasicState, Source
>>>
>>> source = Source(indistinguishability=0.85, losses=0.56)
>>> iterator = source.create_iterator(BasicState([1, 0, 1]), 2)
>>> iterator.prob_threshold = iterator.max_p * 1e-5  # Generates only states having at most 1e-5 times the biggest probability.
>>> for separated_state, prob in iterator:
>>>     print(separated_state, prob)
Parameters:
  • expected_input (FockState) – Expected input BasicState

  • min_photons_filter (int) – The minimum number of photons required to generate a state.

Return type:

SimpleSourceIterator

create_sampler(expected_input, min_photons_filter=0)

Creates a source sampler that will be able to generate states according to the source probability distribution :type expected_input: FockState :param expected_input: The expected input BasicState to sample. :type min_photons_filter: int :param min_photons_filter: Minimum number of photons in a sampled state

Return type:

SourceSampler

generate_distribution(expected_input, prob_threshold=0)

Simulates plugging the photonic source on certain modes and turning it on. Computes the input probability distribution

Parameters:
  • expected_input (FockState) – Expected input FockState The properties of the source will alter the input state. A perfect source always delivers the expected state as an input. Imperfect ones won’t.

  • prob_threshold (float) – Probability threshold under which the resulting state is filtered out. By default, global_params[‘min_p’] value is used.

Return type:

SVDistribution

generate_samples(max_samples, expected_input, min_detected_photons=0)

Samples states from the source probability distribution without representing the whole distribution in memory. Creates a source sampler and store it in self for faster repeated sampling if necessary.

Parameters:
  • max_samples (int) – Number of samples to generate.

  • expected_input (FockState) – The nominal input state that the source should produce.

  • min_detected_photons – Minimum number of photons in a sampled state.

Return type:

list[NoisyFockState]

generate_separated_samples(max_samples, expected_input, min_detected_photons=0)

Samples separated states from the source probability distribution without representing the whole distribution in memory. The sampled states are equivalent (up to permutation) to calling separate_state() on each state returned by generate_samples() but this sampling process uses a simplified procedure to do it faster.

Creates a source sampler and store it in self for faster repeated sampling if necessary.

Parameters:
  • max_samples (int) – Number of samples to generate.

  • expected_input (FockState) – The nominal input state that the source should produce.

  • min_detected_photons – Minimum number of photons in a sampled state.

Return type:

list[BSSamples]

probability_distribution(nphotons=1, prob_threshold=0)

returns SVDistribution on 1 mode associated to the source

Parameters:
  • nphotons (int) – Require nphotons in the mode (default 1).

  • prob_threshold (float) – Probability threshold under which the resulting state is filtered out.

Return type:

SVDistribution