示例#1
0
def test_detector_response(xes: fd.ERSource):
    r = xes.detector_response('photon', xes.data_tensor[0],
                              xes.ptensor_from_kwargs()).numpy()
    assert r.shape == (n_events, xes.dimsizes['photon_detected'])

    # r is p(S1 | detected quanta) as a function of detected quanta
    # so the sum over r isn't meaningful (as long as we're frequentists)

    # Maximum likelihood est. of detected quanta is correct
    max_is = r.argmax(axis=1)
    domain = xes.domain('photon_detected').numpy()
    found_mle = np_lookup_axis1(domain, max_is)
    np.testing.assert_array_less(
        np.abs(xes.data['photon_detected_mle'] - found_mle), 0.5)
示例#2
0
def test_domain_detected(xes: fd.ERSource):
    dd = xes.domain('photon_detected').numpy()
    np.testing.assert_equal(dd.min(axis=1),
                            np.floor(xes.data['photon_detected_min']).values)