# pmm_tools.coherence

*module*

First decay crossing with a bound on unsampled envelope excursions.

For C(t)=sum(c_j exp(2 pi i f_j t))/abs(sum(c_j)), set q=abs(C)\*\*2.
Its curvature obeys abs(q'') \<= 2 W\*\*2 Var_w(2 pi f)/abs(sum(c))\*\*2,
where w=abs(c) and W=sum(w). Linear interpolation therefore differs from q
by at most M dt\*\*2/8. Intervals are discarded only when that bound excludes
a 1/e crossing. Times are ns and frequencies GHz. The bound certifies sampling
of the supplied finite ensemble, not convergence of the physical noise average.

## pmm_tools.coherence.first_envelope_crossing

*function*

```python
def first_envelope_crossing(frequencies_ghz, coefficients, *, maximum_time_ns=100000000000.0, relative_tolerance=0.001, maximum_evaluations=100000, normalization=None)
```

Return time, resolved interval, status, and number of signal evaluations.

All intervals before the returned bracket exclude a crossing using the
curvature bound (up to floating-point error). The bracket width bounds
uncertainty in the location of the first crossing, including multiple roots.
If an interval cannot be resolved, return its location rather than skip it.
By default normalize at t=0. Set normalization=1 for an absolute physical
contrast threshold, retaining its actual DC offset and initial amplitude.

[View source](https://gitlab.kwant-project.org/qt/pmm_tools/-/blob/e412d66507a554f455ef935b755fc39f28ab4e05/pmm_tools/coherence.py#L15-L100)
