Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Fast intensity inference

Project description


authors: Thomas A. Lasko, Jacek Bajor


Fast density inference. Generates intensity curves from given events.


If you prefer to install a precompiled binary, we provide wheels for OS X and Linux (via the manylinux project). The basic pip install command line

$ pip install fast-intensity

should prefer one of our prebuilt binaries. Installation from source requires an environment with Cython and numpy preinstalled.

$ pip install cython numpy

Then you may install a release from source by specifying not to use a binary:

$ pip install fast-intensity --no-binary fast-intensity

(Yes, it is necessary to specify fast-intensity twice.) Alternately, to install the bleeding edge version:

$ git clone
$ cd fast-intensity
$ pip install -e .


%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
from fast_intensity import FastIntensity


# Specify a series of 100 events spread over a year
days = np.arange(0, 365)
events = sorted(days[:100])

# Specify times (as reals) where we want to calculate the intensity of event occurrence
grid = np.linspace(1, 365, num=12)

# Configure a FastIntensity instance with the events and the grid
curve_builder = FastIntensity(events, grid)

# Generate the intensity curve - the unit is events per time unit
intensity = curve_builder.run_inference()
#     array([0.38953   , 0.27764734, 0.33549508, 0.27285165, 0.22284481,
#            0.16997545, 0.26651725, 0.23580527, 0.23351076, 0.25272662,
#            0.33146159, 0.28486727])'ggplot')
fig, ax = plt.subplots(figsize=(9,9))
ax.scatter(events, np.zeros(len(events)), alpha='0.4', label='Events')
ax.scatter(grid, np.zeros(len(grid)) + 0.025, label='Grid')
ax.plot(grid, intensity, label='Intensity')

You can see how the intensity graph dips in the middle, where events are more thinly spaced, and rises near the beginning (where we have a high density of events).


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fast_intensity-0.3-cp35-cp35m-manylinux1_x86_64.whl (225.0 kB) Copy SHA256 hash SHA256 Wheel cp35
fast_intensity-0.3-cp36-cp36m-manylinux1_x86_64.whl (237.5 kB) Copy SHA256 hash SHA256 Wheel cp36
fast_intensity-0.3-cp37-cp37m-macosx_10_7_x86_64.whl (71.4 kB) Copy SHA256 hash SHA256 Wheel cp37
fast_intensity-0.3-cp37-cp37m-manylinux1_x86_64.whl (237.2 kB) Copy SHA256 hash SHA256 Wheel cp37
fast-intensity-0.3.tar.gz (112.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page