fast-intensity
authors: Thomas A. Lasko, Jacek Bajor, John Still
Overview
Fast density inference. Generates intensity curves from given events.
Installation
We only support Python 3 and above. We recommend using fast_intensity in a
virtual environment; however,
if you choose to install to a system-wide version of Python, be aware that some
distributions will alias Python 3's pip as pip3. You should be able to
verify which Python pip is associated with by running pip --version.
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, numpy, and scipy preinstalled.
$ pip install cython numpy scipy
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 https://github.com/ComputationalMedicineLab/fast-intensity.git
$ cd fast-intensity
$ pip install -e .
Usage
%matplotlib inline
%load_ext cython
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
# If working locally rather than from a wheel or other binary
import pyximport
pyximport.install(language_level=3)
from fast_intensity import infer_intensity
np.random.seed(42)
# Specify a series of 100 events spread over a year
days = np.arange(0.0, 365)
np.random.shuffle(days)
events = np.sort(days[:100])
# Specify times (as reals) where we want to calculate the intensity of event occurrence
grid = np.linspace(1, 365, num=12)
# Generate the intensity curve - the unit is events per time unit
curve = infer_intensity(events, grid)
print(curve)
# 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])
plt.style.use('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, curve, label='Intensity')
plt.legend()
plt.show()
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).
Metadata
Release files for fast-intensity 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fast-intensity-0.4.tar.gz | 163.2 kB | Without provenance | Details for fast-intensity-0.4.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| fast_intensity-0.4-cp37-cp37m-manylinux1_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.5+ x86-64 | Details for fast_intensity-0.4-cp37-cp37m-manylinux1_x86_64.whl |
| fast_intensity-0.4-cp37-cp37m-macosx_10_9_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | macOS 10.9+ x86-64 | Details for fast_intensity-0.4-cp37-cp37m-macosx_10_9_x86_64.whl |
| fast_intensity-0.4-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details for fast_intensity-0.4-cp36-cp36m-manylinux1_x86_64.whl |
| fast_intensity-0.4-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details for fast_intensity-0.4-cp35-cp35m-manylinux1_x86_64.whl |
Total release size: 1.3 MB
Release files / fast-intensity-0.4.tar.gz
| Download URL | fast-intensity-0.4.tar.gz |
|---|---|
| Size | 163.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a4b95d73c8dd075afb48b97ce88776400c445cac82d78fdcfd8b8c08ad8670f
|
|
BLAKE2b-256 checksum How to use checksums |
a034d1c5d1bf0248a082797fd490bbc1127cefb430add3fe9350131614e61072
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / fast_intensity-0.4-cp37-cp37m-manylinux1_x86_64.whl
| Download URL | fast_intensity-0.4-cp37-cp37m-manylinux1_x86_64.whl |
|---|---|
| Size | 351.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9425e5c6520b4893aabda23fb25940d01beaf9b71361630f74479472ee86ffd6
|
|
BLAKE2b-256 checksum How to use checksums |
c0ba6f61389c57e262f82ecdb2426b2b939ec171c8b1e7945a5e26cea57dbbed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / fast_intensity-0.4-cp37-cp37m-macosx_10_9_x86_64.whl
| Download URL | fast_intensity-0.4-cp37-cp37m-macosx_10_9_x86_64.whl |
|---|---|
| Size | 113.4 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
1a99b2c4e1e520079d06b9d9ed6811fa2bb76ac2e2648d7516cd8e56fe2df816
|
|
BLAKE2b-256 checksum How to use checksums |
f185c905116a5c6cadd2f3cc6877ff7b505479e7d36ce34df9926ca99865f171
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / fast_intensity-0.4-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | fast_intensity-0.4-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 351.9 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
cc7092a2016e5753ebb9c06c01555fb4283f2355a690d36cb78029dbe6a90c70
|
|
BLAKE2b-256 checksum How to use checksums |
ecdaccee16286050af55e49273c584074e7dc44b79638365495f4ea40a5cf835
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Release files / fast_intensity-0.4-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | fast_intensity-0.4-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 343.0 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
11e24286bac97fbd8b430c46caa3c3ef89a581e4cad48914db162f7157e51b07
|
|
BLAKE2b-256 checksum How to use checksums |
af6e3d3ceb99182c5376c3d105d5537d239b6fdd88773ca658ae4e7ed0ba60fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.2
|
Security for fast-intensity 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.