oitg.threshold API

oitg.threshold.optimise_readout(bright_rate, dark_rate, dark_to_bright_rate=0.8561643835616439, p_bright=0.5)[source]

Calculate optimal threshold bin time & threshold count

The calculation assumes both bright and dark counts are Poisson distributed and gives a threshold minimising the error probability

The calculation accounts for de-shelving during the readout bin time. See thesis: Alice Burrell, 2010

Parameters:
  • bright_rate – expected bright count rate in $s^-1$

  • dark_rate – expected dark count ratein $s^-1$

  • dark_to_bright_rate – dark state decay to become bright in $s^-1$. As this function seeks the global minimum error, the rate must not be zero. Default of 1/1.168 is the Calcium D5/2 shelf decay rate.

  • p_bright – probability of encountering a bright state (default=0.5)

Returns:

(target_t_bin [s], threshold_count, p_error)

oitg.threshold.optimise_treshold(bright_rate, dark_rate, t_bin, dark_to_bright_rate=0.0, p_bright=0.5)[source]

Calculate optimal threshold threshold count for a given bin time

The calculation accounts for de-shelving during the readout bin time. See thesis: Alice Burrell, 2010

Parameters:
  • bright_rate – expected bright count rate in $s^-1$

  • dark_rate – expected dark count ratein $s^-1$

  • dark_to_bright_rate – dark state decay to become bright in $s^-1$

  • p_bright – probability of encountering a bright state (default=0.5)

Returns:

(target_t_bin [s], threshold_count, p_error)

oitg.threshold.optimise_t_bin(bright_rate, dark_rate, thresh_count, dark_to_bright_rate=0.0, p_bright=0.5)[source]

Calculate optimal threshold bin time for a given threshold count

The calculation accounts for de-shelving during the readout bin time. See thesis: Alice Burrell, 2010

Parameters:
  • bright_rate – expected bright count rate in $s^-1$

  • dark_rate – expected dark count ratein $s^-1$

  • dark_to_bright_rate – dark state decay to become bright in $s^-1$

  • p_bright – probability of encountering a bright state (default=0.5)

Returns:

(target_t_bin [s], threshold_count, p_error)

oitg.threshold.calc_p_error(bright_rate, dark_rate, t_bin, thresh_count, dark_to_bright_rate=0.0, p_bright=0.5)[source]

Calculate error probability for Poisson statistics with de-shelving

See thesis: Alice Burrell, 2010

Parameters:
  • bright_rate – expected bright count rate in $s^-1$

  • dark_rate – expected dark count rate in $s^-1$

  • t_bin – integration time in s.

  • thresh_count – threshold count for discriminating bright/dark state (Assumes the exact threshold count is evaluated as dark)

  • dark_to_bright_rate – dark state decay to become bright in $s^-1$

  • p_bright – probability of encountering a bright state (default=0.5)

oitg.threshold.poisson_optimal_thresh_count(mean_bright, mean_dark, p_bright=0.5)[source]

Optimal threshold rate in the absence of de-shelving

The calculation assumes both bright and dark counts are Poisson distributed and gives a threshold minimising the error probability.

The calculation neglects de-shelving and accidental shelving during the readout bin time. It is therefore not suitable for P(error) < 2e-4. See thesis: Alice Burrell, 2010

Parameters:
  • mean_bright – expected counts if the ion started in a bright state

  • mean_dark – expected counts if the ion started in a dark state

  • p_bright – probability of encountering a bright state (default=0.5)

Returns:

threshold_count