You're reading the documentation of the 0.3. For the latest released version, please have a look at 0.4.

merlin.core.state module

Photon input-state helpers.

This module intentionally stays lightweight and avoids classes that only expose static methods.

class merlin.core.state.StatePattern(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: str, Enum

Enumeration of supported input photon state patterns.

DEFAULT = 'default'
PERIODIC = 'periodic'
SEQUENTIAL = 'sequential'
SPACED = 'spaced'
merlin.core.state.generate_state(n_modes, n_photons, state_pattern=StatePattern.DEFAULT)

Generate a Perceval Fock input state as a pcvl.BasicState.

Parameters:
  • n_modes (int) – Number of photonic modes.

  • n_photons (int) – Total number of photons.

  • state_pattern (StatePattern | str) – Placement strategy for the photons.

Returns:

Generated Perceval basic state.

Return type:

pcvl.BasicState

Raises:

ValueError – If the inputs are inconsistent or the pattern is unknown.