IndexFinder

class ctapipe.utils.IndexFinder(values)[source]

Bases: object

Helper class to find the index of the closest matching value in an array/list/…, used to locate the pointing of an event based on the trigger time. This searches using pythons bisect module. Duplicated values will result in the first value being returned.

Explanations can be found here: https://stackoverflow.com/questions/9706041/finding-index-of-an-item-closest-to-the-value-in-a-list-thats-not-entirely-sort

Since we only need the searching part, the code has been cut down slightly.

Methods Summary

closest(target)

Given a value, that is comparable to the associated values list, return the index of the closest matching entry relative to the unordered list, that was given at construction.

Methods Documentation

closest(target)[source]

Given a value, that is comparable to the associated values list, return the index of the closest matching entry relative to the unordered list, that was given at construction.