Bins

Bins#

quantflow.utils.bins.pdf(data: ndarray[tuple[int, ...], dtype[floating[Any]]], *, num_bins: int | None = None, delta: float | None = None, symmetric: float | None = None, precision: int = 6) DataFrame#

Extract a probability density function from the data as a DataFrame with index given by the bin centers and a single column pdf with the estimated probability density function values

Parameters:
  • data – the data to extract the PDF from

  • num_bins – the number of bins to use in the histogram, if not provided it is calculated from the delta parameter (if provided) or set to 50

  • delta – the spacing between bins, if not provided it is calculated from the num_bins

  • symmetric – if provided, the bins are centered around this value

  • precision – the precision to use in the calculation

quantflow.utils.bins.event_density(df: DataFrame, columns: Sequence[str], num: int = 10) dict[str, Any]#

Calculate the probability density of the number of events in the dataframe columns