Skip to content

Commit a187e6d

Browse files
authored
Merge pull request #125 from UDST/develop
v0.4.4 release
2 parents 947b440 + 460a132 commit a187e6d

10 files changed

+83
-73
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
v0.4.4
2+
======
3+
4+
2019/9/4
5+
6+
* Restores support for pre-C++11 compilers.
7+
18
v0.4.3
29
======
310

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
[![Build Status](https://travis-ci.org/UDST/pandana.svg?branch=master)](https://travis-ci.org/UDST/pandana)
1+
![Version](https://img.shields.io/badge/version-0.4.4-blue.svg)
2+
[![Travis build status](https://travis-ci.org/UDST/pandana.svg?branch=master)](https://travis-ci.org/UDST/pandana)
3+
[![Appveyor build status](https://ci.appveyor.com/api/projects/status/a90kvns7qe56kg57?svg=true)](https://ci.appveyor.com/project/smmaurer/pandana)
24
[![Coverage Status](https://coveralls.io/repos/github/UDST/pandana/badge.svg?branch=master)](https://coveralls.io/github/UDST/pandana?branch=master)
35

46
# Pandana

appveyor.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
build: false
2+
3+
environment:
4+
matrix:
5+
- PYTHON: 2.7
6+
- PYTHON: 3.6
7+
8+
init:
9+
- "ECHO %PYTHON%"
10+
11+
# The goal here is mainly to confirm that Pandana compiles in Windows; we're not
12+
# running any of the CI tests
13+
14+
# Cython and NumPy need to be present before building Pandana. Some other
15+
# runtime requirements aren't installing well with Pip in win-py27, so I'm just
16+
# putting all of them into the Conda environment
17+
18+
install:
19+
- "set PATH=C:\\Miniconda3;C:\\Miniconda3\\Scripts;%PATH%"
20+
- conda config --append channels conda-forge
21+
- "conda create --name test-env python=%PYTHON% pip cython matplotlib numpy osmnet pandas requests scikit-learn pytables --yes --quiet"
22+
- activate test-env
23+
- python setup.py install
24+
- conda list

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@
5757
# built documents.
5858
#
5959
# The short X.Y version.
60-
version = '0.4.3'
60+
version = '0.4.4'
6161
# The full version, including alpha/beta/rc tags.
62-
release = '0.4.3'
62+
release = '0.4.4'
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.

docs/installation.rst

+17-12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Pandana is hosted on Conda Forge::
1616
conda install pandana --channel conda-forge
1717

1818

19+
.. _pip:
20+
1921
Pip (requires local compilation)
2022
--------------------------------
2123

@@ -25,6 +27,10 @@ Pandana is also hosted on PyPI::
2527

2628
Pandana's C/C++ extension will compile automatically if the right tools are present. See below for troubleshooting.
2729

30+
Pip can have trouble installing Pandana's requirements in Windows Python 2.7; try Conda instead.
31+
32+
33+
.. _github:
2834

2935
GitHub source code
3036
------------------
@@ -35,6 +41,8 @@ If you'll be modifying the code, you can install Pandana from the `GitHub source
3541
cd pandana
3642
python setup.py develop
3743

44+
You'll need to have Cython and NumPy installed before running :code:`setup.py`.
45+
3846
Pandana's C/C++ extension will compile automatically if the right tools are present. See below for troubleshooting.
3947

4048

@@ -43,16 +51,10 @@ Compiling locally
4351

4452
Building Pandana from source requires C/C++ compilers. On Linux and Mac these are usually already present, but read on for more information.
4553

46-
.. note::
47-
Pandana's C/C++ code references some libraries from NumPy, so you'll need to have NumPy fully installed before running Pandana's setup script.
48-
49-
.. note::
50-
Pandana uses OpenMP to parallelize computations --- compiling without OpenMP support will still work but won't allow multi-threading.
51-
5254
Compiling Pandana in Linux
5355
~~~~~~~~~~~~~~~~~~~~~~~~~~
5456

55-
Pandana's setup script expects a version of the GCC compiler with support for the C++11 standard and OpenMP. This appears to be GCC 4.8+, but we haven't done extensive testing. If you run into problems, try doing a fresh install of the core build tools::
57+
Pandana's setup script expects a version of the GCC compiler with support for OpenMP. This appears to be GCC 4.8+, but we haven't done extensive testing. If you run into problems, try doing a fresh install of the core build tools::
5658

5759
sudo apt-get install --reinstall build-essential
5860

@@ -66,16 +68,19 @@ Certain older machines may need the `Microsoft Visual C++ 2008 SP1 Redistributab
6668
Compiling Pandana in OS X
6769
~~~~~~~~~~~~~~~~~~~~~~~~~
6870

69-
The default OS X compilers don't support OpenMP multi-threading. Use these commands to confirm that Xcode Command Line Tools are present and to install some newer compilers from Anaconda::
71+
The default OS X compilers don't support OpenMP, which Pandana uses for multi-threading.
72+
73+
To allow multi-threading, use these commands to confirm that Xcode Command Line Tools are present and to install some newer compilers from Anaconda::
7074

7175
xcode-select --install
7276
conda install llvm-openmp clang
7377

74-
After installing Pandana, running :code:`examples/simple_example.py` will display the number of threads that Pandana is using.
78+
Then follow the :ref:`Pip <pip>` or :ref:`GitHub source code <github>` instructions above.
7579

76-
.. note::
77-
If you get a compilation error like ``'wchar.h' file not found``, you can resolve it in macOS 10.14 by installing some additional header files::
80+
If you get a compilation error like ``'wchar.h' file not found``, you can resolve it in macOS 10.14 by installing some additional header files::
7881

79-
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
82+
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
83+
84+
After installing Pandana, running :code:`examples/simple_example.py` will display the number of threads that Pandana is using.
8085

8186
.. _Anaconda: https://www.anaconda.com/distribution/

pandana/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .network import Network
22

3-
version = __version__ = '0.4.3'
3+
version = __version__ = '0.4.4'

pandana/tests/test_cyaccess.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def net(nodes_and_edges):
3434

3535
net = cyaccess(
3636
nodes.index.values,
37-
nodes.as_matrix(),
38-
edges.as_matrix(),
39-
edge_weights.transpose().as_matrix(),
37+
nodes.values,
38+
edges.values,
39+
edge_weights.transpose().values,
4040
True
4141
)
4242

@@ -109,9 +109,9 @@ def test_memory_leak(nodes_and_edges):
109109
print i
110110
net = cyaccess(
111111
nodes.index.values,
112-
nodes.as_matrix(),
113-
edges.as_matrix(),
114-
edge_weights.transpose().as_matrix(),
112+
nodes.values,
113+
edges.values,
114+
edge_weights.transpose().values,
115115
True
116116
)
117117
'''

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def run(self):
102102
## Standard setup
103103
###############################################
104104

105-
version = '0.4.3'
105+
version = '0.4.4'
106106

107107
packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
108108

src/accessibility.cpp

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "accessibility.h"
22
#include <algorithm>
33
#include <cmath>
4-
#include <functional>
54
#include <utility>
65
#include "graphalg.h"
76

@@ -18,6 +17,23 @@ bool distance_node_pair_comparator(const distance_node_pair& l,
1817
const distance_node_pair& r)
1918
{ return l.first < r.first; }
2019

20+
21+
double exp_decay(const double &distance, const float &radius, const float &var)
22+
{
23+
return exp(-1*distance/radius) * var;
24+
}
25+
26+
double linear_decay(const double &distance, const float &radius, const float &var)
27+
{
28+
return (1.0-distance/radius) * var;
29+
}
30+
31+
double flat_decay(const double &distance, const float &radius, const float &var)
32+
{
33+
return var;
34+
}
35+
36+
2137
Accessibility::Accessibility(
2238
int numnodes,
2339
vector< vector<long>> edges,
@@ -350,17 +366,14 @@ Accessibility::aggregateAccessibilityVariable(
350366
double sum = 0.0;
351367
double sumsq = 0.0;
352368

353-
std::function<double(const double &, const float &, const float &)> sum_function;
369+
double (*sum_function_ptr)(const double &, const float &, const float &);
354370

355371
if(decay == "exp")
356-
sum_function = [](const double &distance, const float &radius, const float &var)
357-
{ return exp(-1*distance/radius) * var; };
372+
sum_function_ptr = &exp_decay;
358373
if(decay == "linear")
359-
sum_function = [](const double &distance, const float &radius, const float &var)
360-
{ return (1.0-distance/radius) * var; };
374+
sum_function_ptr = &linear_decay;
361375
if(decay == "flat")
362-
sum_function = [](const double &distance, const float &radius, const float &var)
363-
{ return var; };
376+
sum_function_ptr = &flat_decay;
364377

365378
for (int i = 0 ; i < distances.size() ; i++) {
366379
int nodeid = distances[i].first;
@@ -371,7 +384,7 @@ Accessibility::aggregateAccessibilityVariable(
371384

372385
for (int j = 0 ; j < vars[nodeid].size() ; j++) {
373386
cnt++; // count items
374-
sum += sum_function(distance, radius, vars[nodeid][j]);
387+
sum += (*sum_function_ptr)(distance, radius, vars[nodeid][j]);
375388

376389
// stddev is always flat
377390
sumsq += vars[nodeid][j] * vars[nodeid][j];

tmp.py

-41
This file was deleted.

0 commit comments

Comments
 (0)