filter_events

lstchain.reco.utils.filter_events(events, filters=None, finite_params=None)

Apply data filtering to a pandas dataframe or astropy Table. The Table object will be converted to pandas dataframe and used. Each filtering range is applied if the column name exists in the DataFrame so that (events >= range[0]) & (events <= range[1]) The returned object is of the same type as passed events

Parameters:
events: `pandas.DataFrame` or ‘astropy.table.Table’
filters: dict containing events features names and their filtering range

example : dict(intensity=[0, np.inf], width=[0, np.inf], r=[0, np.inf])

finite_params: optional, None or list of strings

extra filter to ensure finite parameters

n_events: int or float

Number of events to keep. If an integer > 1 is passed this will be the maximum number of events to keep. If a float < 1, this is the ratio of events to keep.

Returns:
pandas.DataFrame or ‘astropy.table.Table’