def onclick(event): import math ts = event.xdata if ts is None: return diffs = flex.abs(t - ts) ts = t[flex.first_index(diffs, flex.min(diffs))] print(get_paths_from_timestamps([ts], tag="shot", ext=ext)[0])
def _analyse_periodogram(self, pgram): """Use the periodogram pgram to suggest a suitable interval width for scan-varying refinement to account for the major variation in residuals""" if pgram is None: return None # determine a baseline from the high frequency noise bl = flex.median(pgram.spec.select(pgram.freq > 0.25)) # look for peaks greater than 5 times this baseline. We expect one at # low frequency cutoff = 5 * bl peaks = pgram.spec > cutoff # find where this peak falls off below the cutoff and return the cycle # period at half that frequency (this is a heuristic that often seems to # give sensible results) pk_start = flex.first_index(peaks, True) if pk_start is None: return None peaks = peaks[pk_start:] idx = pk_start + flex.first_index(peaks, False) - 1 if idx is not None: f1 = pgram.freq[idx] s1 = pgram.spec[idx] try: f2 = pgram.freq[idx + 1] s2 = pgram.spec[idx + 1] ds = cutoff - s1 df = (f2 - f1) * ds / (s2 - s1) freq = f1 + df except IndexError: freq = f1 period = 2.0 * 1.0 / freq else: period = None return period
def onclick(event): import math ts = event.xdata diffs = flex.abs(t - ts) ts = t[flex.first_index(diffs, flex.min(diffs))] print get_paths_from_timestamps([ts], tag="shot")[0]