Supplement 1. The Python source code to conduct the analyses of Harte et al.’s (2008, 2009) and Harte's (2011) model and compare it to alternative models, including both raw and calculated data.

File List

mete_sads_data.py

Python script that extracts data from the primary MySQL databases.


mete_sads.py

Core python script for replicating the complete set of analyses in the paper.


mete.py

Module containing the core functions for working with Harte et al.'s Maximum Entropy Theory of Ecology.


mete_distributions.py

Module containing some distributions for use in analyses of Harte et al.'s Maximum Entropy Theory of Ecology.


macroecotools.py

Module containing tools for conducting macroecological analyses.


macroeco_distributions.py

Module containing some common macroecological distributions, including the Poisson log-normal used in this paper.


data.zip

Intermediate data files from various phases of the analysis. Includes the raw data from the MySQL exports, and latitude and longitude information for mapping, for 4 of the 6 data sets (BBS, MCDB, FIA, and Gentry). The other two datasets were obtained under agreements restricting the publication of raw data. This file should be extracted in the same directory as the other files.

Description

The code and data in this supplement allow the analyses in the paper to be fully replicated for four of the six data sets BBS, MCDB, FIA, and Gentry). The other two data sets were obtained under agreements restricting the publication of raw data, but simulation results and figures can still be generated for these data sets.

Requirements: Python 2.x and the following Python modules: numpy, scipy, matplotlib, and mpmath. Two additional modules, mpl_toolkits, and mpl_toolkits.basemap, are required for generating the figures.

All files should be placed in a single directory and the data.zip file should be extracted into that directory. The analyses can then be replicated by running the following commands from the command line.

Run all analyses and generate figures: python mete_sads.py ./data/ all

Run portions of the analysis pipeline:
Empirical analyses: python mete_sads.py ./data/ empir
Simulation analyses: python mete_sads.py ./data/ sims
Figures: python mete_sads.py ./data/ figs

On Windows ./data/ should be replaced with .\data\ to match the relevant path conventions.

Please note that these analyses involve both a large amount of data and a lot of computational work and therefore take a long time to run. Expect the empirical analysis to take up to a day. Simulations may take up to several weeks on an 8-core server. This can be decreased to about a week by downloading the beta_lookup_table.pck file from the repository described below and placing it in the same folder as the other files. Generating figures takes about one hour due to the neighborhood calculations required for the color ramps on the observed-predicted plots.

Version Control Repository: The full version control repository for this project (including post-publication improvements) is publicly available at https://github.com/weecology/white-et-al-2012. The code in this repository relies on two additional modules: https://github.com/weecology/METE and https://github.com/weecology/macroecotools. If you would like to use the code in this Supplement for your own analyses it is strongly suggested that you use the equivalent code in the repositories as this is the code that is being actively maintained and developed. If for some reason the repositories are moved, links will always be available at http://weecology.org.

Data Use: Data is provided in this supplement for the purposes of replication and is not presented in such a way as to be generally useful for additional analyses. If you wish to use these data sets for additional research they should be obtained from relevant data providers. For BBS, MCDB, FIA, and Gentry this can be done automatically by using the EcoData Retriever (http://ecologicaldata.org/ecodata-retriever).

Software License: All code is licensed using the standard MIT license.

Copyright (c) 2011 Weecology

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.