Measurement scenario module

Module description

The Measurement Scenario class (necessary for the EmpiricalModel class) is storing the variables linked to an experiment described by Abramsky and Brandenburger.

Module documentation

Contextual scenario for Contextual Fraction

class contextuality.measurement_scenario.GeneralizedMeasurementScenario(X, M, O, ME, PE)
Parameters:
  • X (List[int | Symbol | str])

  • M (List[List[int | Symbol | str]])

  • O (List[int])

  • ME (Dict[str | Symbol | Expr, str | Symbol | Expr])

  • PE (Dict[str | Symbol | Expr, str | Symbol | Expr])

__init__(X, M, O, ME, PE)

Initialize the measurement scenario.

Parameters:
  • X (List[int | Symbol | str]) – Set of measurement labels. Must be a list of integers or symbols.

  • M (List[List[int | Symbol | str]]) – Covering family of X. Set of subsets of X. List of measurement contexts.

  • O (List[int]) – List of outcomes. It is assumed that all measurements have the same possible outcomes.

  • ME (Dict[str | Symbol | Expr, str | Symbol | Expr])

  • PE (Dict[str | Symbol | Expr, str | Symbol | Expr])

property incidence_matrix: ndarray

Accessor for the incidence matrix.

Returns:

the incidence matrix

Return type:

np.ndarray

class contextuality.measurement_scenario.MeasurementScenario(X, M, O)

Class for Contextual Scenario.

Parameters:
  • X (List[int | Symbol | str])

  • M (List[List[int | Symbol | str]])

  • O (List[int])

__init__(X, M, O)

Initialize the measurement scenario.

Parameters:
  • X (List[int | Symbol | str]) – Set of measurement labels. Must be a list of integers or symbols.

  • M (List[List[int | Symbol | str]]) – Covering family of X. Set of subsets of X. List of measurement contexts.

  • O (List[int]) – List of outcomes. It is assumed that all measurements have the same possible outcomes.

Return type:

None

property all_outcomes: List[Tuple[int]]

Give all the outcomes of the full measurement scenario.

Returns:

A list of all the outcomes.

Example:

>>> ms = MeasurementScenarioImplementations.CHSH()
>>> ms.all_outcomes
[(0, 0), (0, 1), (1, 0), (1, 1)]
property incidence_matrix: ndarray

Accessor for the incidence matrix.

Returns:

the incidence matrix

Return type:

np.ndarray

property incidence_matrix_constrained: ndarray

Accessor for an incidence matrix that takes into account incompatible measurements.

Returns:

the incidence matrix

Return type:

np.ndarray

property outcomes_global: List[List[int]]

Gives all the possible variable attributions. For the CHSH scenario it corresponds to: [A,A’,B,B’]: [0,0,0,0], [0,0,0,1], [0,0,1,0], [0,0,1,1], [0,1,0,0], …

Returns:

A list of lists of attributions.

class contextuality.measurement_scenario.MeasurementScenarioImplementations

Director for many implementations of the MeasurementScenario, and to be DRY.

static CHSH()

Generates the CHSH MeasurementScenario class.

Return type:

MeasurementScenario

static KCBS()

Generates the KCBS MeasurementScenario class.

Return type:

MeasurementScenario

static PeresMermin()

Generates the Peres Mermin MeasurementScenario class.

Return type:

MeasurementScenario