sf.apps.similarity.sample_to_event¶
-
sample_to_event
(sample, max_count_per_mode)[source]¶ Provides the event corresponding to a given sample.
For an input
max_count_per_mode
, events are expressed here simply by the total photon number \(k\).Example usage:
>>> sample = [1, 2, 0, 0, 1, 1, 0, 3] >>> sample_to_event(sample, 4) 8
>>> sample_to_event(sample, 2) None
- Parameters
sample (list[int]) – a sample from GBS
max_count_per_mode (int) – the maximum number of photons counted in any given mode for a sample to be categorized as an event. Samples with counts exceeding this value are attributed the event
None
.
- Returns
the event of the sample
- Return type
int or None
code/api/strawberryfields.apps.similarity.sample_to_event
Download Python script
Download Notebook
View on GitHub