Infer information about local hotspots.
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
inferhotspot
.gitattributes
.gitignore
LICENSE.txt
MANIFEST.in
README.md
requirements.txt
setup.cfg
setup.py

README.md

inferhotspot

Infer information about local hotspots.

Plot examples

The examples below were created using a collection of 196,318 tweets within Denton County from Tue Feb 12 to Wed Apr 10. The data was collected using bwbaugh/twitter-corpus.

Map

map

User map

user map

user check-ins

Heat map

heat map

Time

time

Usage

Configuration file

The first time you run any script it will create a configuration file named inferhotspot.ini, and you will be asked to edit it.

Filtering the tweets

Because of the way Twitter matches location bounding boxes, we must first filter the tweets as part of a preprocessing step in order to make sure every tweet has a geocoded-point and is within our defined bounding box.

Run using the command: python -m inferhotspot.filter

Configuration file settings:

  • Section: [filter]
    • process_directory: The directory containing bz2-archive files. Each line of the uncompressed file must be a JSON encoded tweet.
    • output: The filename of the uncompressed file to save the combined tweets. This file will be saved to the current working directory.
  • Section: [place]
    • box: JSON encoded flat-list containing a pair of longitude and latitude pairs, with the southwest corner of the bounding box coming first.

Making the plots

Run using the command: python -m inferhotspot.plot

If the data hasn't been preprocessed to include only those tweets that are geocded with using a coordinates-point---and that point falls within the bounding box---then you will first need to use the filter.py script to preprocess your data.

  • Section: [place]
    • box: JSON encoded flat-list containing a pair of longitude and latitude pairs, with the southwest corner of the bounding box coming first.
    • name: The place name of the bounding box.
  • Section: [plot]
    • path: The directory containing bz2-archive file of filtered tweets.
    • archive: The filename of the bz2-archive of filtered tweets. Each line of the uncompressed file must be a JSON encoded tweet.

Installation

You do not need to install the package in order to use it, however if you choose to install then use one of the options below. Otherwise your current working directory must be the parent of the inferhotspot package.

Using distribute

Standard install

python setup.py install

Development install

To install in development mode, which creates a symlink to the current directory so that the source can be modified or updated in-place, use:

python setup.py develop

And to remove the symlink:

python setup.py develop -u

Using pip

pip install .

To uninstall:

pip uninstall inferhotspot