PyTDLM 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- TDLM/__init__.py +24 -0
- TDLM/tdlm.py +821 -0
- pytdlm-0.1.0.dist-info/METADATA +141 -0
- pytdlm-0.1.0.dist-info/RECORD +7 -0
- pytdlm-0.1.0.dist-info/WHEEL +5 -0
- pytdlm-0.1.0.dist-info/licenses/LICENSE +674 -0
- pytdlm-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyTDLM
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Systematic comparison of trip distribution laws and models
|
|
5
|
+
Author-email: Maxime Lenormand <maxime.lenormand@inrae.fr>
|
|
6
|
+
License: GPL-3.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/RTDLM/PyTDLM
|
|
8
|
+
Project-URL: Repository, https://github.com/RTDLM/PyTDLM
|
|
9
|
+
Project-URL: Documentation, https://rtdlm.github.io/PyTDLM/
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/RTDLM/PyTDLM/issues
|
|
11
|
+
Keywords: spatial-interaction,gravity-model,trip-distribution
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.20.0
|
|
26
|
+
Requires-Dist: pandas>=1.3.0
|
|
27
|
+
Requires-Dist: tabulate>=0.9.0
|
|
28
|
+
Requires-Dist: tqdm>=4.60.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=2.0; extra == "dev"
|
|
32
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
34
|
+
Requires-Dist: isort>=5.0; extra == "dev"
|
|
35
|
+
Provides-Extra: docs
|
|
36
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
|
37
|
+
Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# PyTDLM: Systematic comparison of trip distribution laws and models
|
|
41
|
+
|
|
42
|
+
A Python port of the [TDLM R package](https://github.com/RTDLM/TDLM), with numpy-based implementations and parallel processing support for multiple exponent values.
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
PyTDLM provides implementations of several trip distribution models commonly used in transportation planning and spatial analysis:
|
|
47
|
+
|
|
48
|
+
### Available Laws
|
|
49
|
+
- **GravExp**: Gravity model with exponential distance decay
|
|
50
|
+
- **NGravExp**: Normalized gravity model with exponential decay
|
|
51
|
+
- **GravPow**: Gravity model with power distance decay
|
|
52
|
+
- **NGravPow**: Normalized gravity model with power decay
|
|
53
|
+
- **Schneider**: Schneider's intervening opportunities model
|
|
54
|
+
- **Rad**: Radiation model
|
|
55
|
+
- **RadExt**: Extended radiation model
|
|
56
|
+
- **Rand**: Random model (baseline)
|
|
57
|
+
|
|
58
|
+
### Available Models
|
|
59
|
+
- **UM**: Unconstrained Model
|
|
60
|
+
- **PCM**: Production Constrained Model
|
|
61
|
+
- **ACM**: Attraction Constrained Model
|
|
62
|
+
- **DCM**: Doubly Constrained Model
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
### Using conda
|
|
67
|
+
```bash
|
|
68
|
+
conda install -c conda-forge pytdlm
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Using pip
|
|
72
|
+
```bash
|
|
73
|
+
pip install PyTDLM
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### From source
|
|
77
|
+
```bash
|
|
78
|
+
git clone https://github.com/PyTDLM/TDLM.git
|
|
79
|
+
cd TDLM
|
|
80
|
+
pip install -e .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Quick Start
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import numpy as np
|
|
87
|
+
from TDLM import tdlm
|
|
88
|
+
|
|
89
|
+
# Prepare your data
|
|
90
|
+
mi = np.array([100, 200, 150]) # Origin masses
|
|
91
|
+
mj = np.array([80, 180, 120]) # Destination masses
|
|
92
|
+
dij = np.array([[0, 10, 15], # Distance matrix
|
|
93
|
+
[10, 0, 8],
|
|
94
|
+
[15, 8, 0]])
|
|
95
|
+
Oi = np.array([50, 80, 60]) # Out-trips
|
|
96
|
+
Dj = np.array([40, 90, 50]) # In-trips
|
|
97
|
+
Tij_observed = np.array([[0, 25, 25], # Observed trip matrix
|
|
98
|
+
[30, 0, 50],
|
|
99
|
+
[35, 35, 0]])
|
|
100
|
+
|
|
101
|
+
# Run simulation
|
|
102
|
+
exponent = np.arange(0.1, 1.01, 0.01)
|
|
103
|
+
results = tdlm.run_law_model(
|
|
104
|
+
law='NGravExp',
|
|
105
|
+
mass_origin=mi,
|
|
106
|
+
mass_destination=mj,
|
|
107
|
+
distance=dij,
|
|
108
|
+
exponent=exponent,
|
|
109
|
+
model='DCM',
|
|
110
|
+
out_trips=Oi,
|
|
111
|
+
in_trips=Dj,
|
|
112
|
+
repli=100
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Calculate goodness-of-fit
|
|
116
|
+
gof_results = tdlm.gof(sim=results, obs=Tij_observed, distance=dij)
|
|
117
|
+
|
|
118
|
+
# Print results for a given exponent
|
|
119
|
+
print(gof_results[0.1].to_markdown(index=False))
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Documentation
|
|
123
|
+
|
|
124
|
+
For detailed documentation and examples, visit: [https://rtdlm.github.io/PyTDLM/](https://rtdlm.github.io/PyTDLM/)
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
129
|
+
|
|
130
|
+
## Citation
|
|
131
|
+
|
|
132
|
+
If you use this library in your research, please cite:
|
|
133
|
+
|
|
134
|
+
```bibtex
|
|
135
|
+
@software{lenormand2024tdlm,
|
|
136
|
+
title={TDLM: Trip Distribution Law Models},
|
|
137
|
+
author={Lenormand, Maxime},
|
|
138
|
+
year={2024},
|
|
139
|
+
url={https://github.com/RTDLM/PyTDLM}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
TDLM/__init__.py,sha256=2bNrUg98xYlNf69VWsj0LO46FXeL-GDHCPM14j6AVEg,535
|
|
2
|
+
TDLM/tdlm.py,sha256=iYpjZg0WaQS952K5csmg3gJdkCRi0DK8GYJjktf2H5o,27943
|
|
3
|
+
pytdlm-0.1.0.dist-info/licenses/LICENSE,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
4
|
+
pytdlm-0.1.0.dist-info/METADATA,sha256=Znp4-k8hCFmggJaW_7nCgeReLom0beBSSDoZCHaORmg,4275
|
|
5
|
+
pytdlm-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
pytdlm-0.1.0.dist-info/top_level.txt,sha256=QtnXM0Q7zSajUWac2ZzPq2RDA0MdRLhJtRB1TIoP9BU,5
|
|
7
|
+
pytdlm-0.1.0.dist-info/RECORD,,
|