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(*values)

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.