RDG-Networks 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- RDG_Networks-0.2.4.dist-info/LICENSE.txt +5 -0
- {RDG_Networks-0.2.2.dist-info → RDG_Networks-0.2.4.dist-info}/METADATA +7 -3
- {RDG_Networks-0.2.2.dist-info → RDG_Networks-0.2.4.dist-info}/RECORD +7 -7
- RDG_networks/generate_line_segments_dynamic.py +17 -14
- RDG_Networks-0.2.2.dist-info/LICENSE.txt +0 -21
- {RDG_Networks-0.2.2.dist-info → RDG_Networks-0.2.4.dist-info}/WHEEL +0 -0
- {RDG_Networks-0.2.2.dist-info → RDG_Networks-0.2.4.dist-info}/entry_points.txt +0 -0
- {RDG_Networks-0.2.2.dist-info → RDG_Networks-0.2.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,5 @@
|
|
1
|
+
All Rights Reserved
|
2
|
+
|
3
|
+
The following code and its accompanying documentation are the property of Martijn (Niek) Mooij. All rights are reserved. No part of this code may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the author, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the author at mooij.niek@gmail.com.
|
4
|
+
|
5
|
+
Copyright 2024 Niek Mooij
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: RDG-Networks
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.4
|
4
4
|
Summary: Most of the code from the RDG Networks project
|
5
5
|
Home-page: https://github.com/NiekMooij/RDG_networks
|
6
6
|
Author: Niek Mooij
|
7
7
|
Author-email: mooij.niek@gmail.com
|
8
|
+
License: All Rights Reserved
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
10
|
Classifier: Operating System :: OS Independent
|
11
11
|
License-File: LICENSE.txt
|
12
12
|
Requires-Dist: networkx
|
@@ -54,7 +54,11 @@ To use the package, import the relevant script from the functions folder based o
|
|
54
54
|
No specific configuration is required.
|
55
55
|
|
56
56
|
## License
|
57
|
-
|
57
|
+
All Rights Reserved
|
58
|
+
|
59
|
+
The following code and its accompanying documentation are the property of Martijn (Niek) Mooij. All rights are reserved. No part of this code may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the author, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the author at mooij.niek@gmail.com.
|
60
|
+
|
61
|
+
Copyright 2024 Niek Mooij
|
58
62
|
|
59
63
|
## Contact
|
60
64
|
You can contact me at mooij.niek@gmail.com for any questions or suggestions.
|
@@ -3,12 +3,12 @@ RDG_networks/__init__.py,sha256=aCfGs87cJn0Tp5GqTpFXPOEfJPpR4Tnnz819Kk_0t84,661
|
|
3
3
|
RDG_networks/draw_segments.py,sha256=U53N5GXmQHWKdM1Q1faP_EGKjc6enOu2mcsunzSFpP0,984
|
4
4
|
RDG_networks/generate_line_network.py,sha256=lJ4rhObim3WcEQoebomewRQKWNJC5phFyFYRW7qjXIg,1127
|
5
5
|
RDG_networks/generate_line_segments.py,sha256=QV8_k7q6TD5c7Hcb2Ms_apEdWYw4XdLr7rdJgh49v4Q,9004
|
6
|
-
RDG_networks/generate_line_segments_dynamic.py,sha256=
|
6
|
+
RDG_networks/generate_line_segments_dynamic.py,sha256=GoIhGXYbcvjqR5BJCnkvAGp8QBpzsE1ZSbl2k9XAOGI,7531
|
7
7
|
RDG_networks/get_intersection_segments.py,sha256=mXB5qCy1oOps4Vu1mX6flW6v_4Xxc71YK41yOWjJX8o,2797
|
8
8
|
RDG_networks/sample_in_polygon.py,sha256=qpPpW-Da1vK8ZkVWMJ0zBsE8IgyMB619gCdybSkzKSQ,1605
|
9
|
-
RDG_Networks-0.2.
|
10
|
-
RDG_Networks-0.2.
|
11
|
-
RDG_Networks-0.2.
|
12
|
-
RDG_Networks-0.2.
|
13
|
-
RDG_Networks-0.2.
|
14
|
-
RDG_Networks-0.2.
|
9
|
+
RDG_Networks-0.2.4.dist-info/LICENSE.txt,sha256=BHUkX2GsdTr30sKmVZ1MLGR1njnx17EX_oUuuSVZZPE,598
|
10
|
+
RDG_Networks-0.2.4.dist-info/METADATA,sha256=UAxR8eK6DyBT3B1C1O9chrCUnYpWfhh7YcytLETtYMc,2422
|
11
|
+
RDG_Networks-0.2.4.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
12
|
+
RDG_Networks-0.2.4.dist-info/entry_points.txt,sha256=Htsh9jRabMCGHwXayUwZoSy-9IFGFrMB1X9hgyyr3_8,350
|
13
|
+
RDG_Networks-0.2.4.dist-info/top_level.txt,sha256=4gUUYafD5Al9V8ZSiViVGYHpRMMCsCBcGgCNodk9Syg,13
|
14
|
+
RDG_Networks-0.2.4.dist-info/RECORD,,
|
@@ -2,6 +2,7 @@ import numpy as np
|
|
2
2
|
import random
|
3
3
|
from shapely.geometry import LineString
|
4
4
|
from typing import List, Dict, Any, Tuple
|
5
|
+
import matplotlib.pyplot as plt
|
5
6
|
|
6
7
|
from .Classes import LineSegment
|
7
8
|
|
@@ -88,7 +89,7 @@ def update_for_border_intersections(lines: List[Dict[str, Any]]) -> List[Dict[st
|
|
88
89
|
|
89
90
|
return lines
|
90
91
|
|
91
|
-
def check_and_update_when_intersect(lines: List[Dict[str, Any]], epsilon: float) -> List[Dict[str, Any]]:
|
92
|
+
def check_and_update_when_intersect(lines: List[Dict[str, Any]], epsilon: float, dt: float) -> List[Dict[str, Any]]:
|
92
93
|
"""
|
93
94
|
Check for intersections between lines and update their properties accordingly.
|
94
95
|
|
@@ -99,36 +100,37 @@ def check_and_update_when_intersect(lines: List[Dict[str, Any]], epsilon: float)
|
|
99
100
|
Returns:
|
100
101
|
List[Dict[str, Any]]: The updated list of lines after handling intersections.
|
101
102
|
"""
|
103
|
+
|
102
104
|
for index1, j1 in enumerate(lines):
|
103
105
|
for index2, j2 in enumerate(lines):
|
104
106
|
if j1['id'][:-2] == j2['id'][:-2] or index2 < index1:
|
105
107
|
continue
|
106
|
-
|
108
|
+
|
107
109
|
if j1['growth_status'] == False and j2['growth_status'] == False:
|
108
110
|
continue
|
109
|
-
|
111
|
+
|
110
112
|
line1 = LineString([j1['start'], j1['end']])
|
111
113
|
line2 = LineString([j2['start'], j2['end']])
|
112
|
-
|
114
|
+
|
113
115
|
intersection_pt = line1.intersection(line2)
|
114
116
|
|
115
117
|
if not intersection_pt.is_empty:
|
116
118
|
d1 = np.linalg.norm(np.array(j1['start']) - np.array([intersection_pt.x, intersection_pt.y]))
|
117
119
|
d2 = np.linalg.norm(np.array(j2['start']) - np.array([intersection_pt.x, intersection_pt.y]))
|
118
120
|
|
119
|
-
arrival_1 = j1['introduction_time'] + d1 / epsilon
|
120
|
-
arrival_2 = j2['introduction_time'] + d2 / epsilon
|
121
|
+
arrival_1 = j1['introduction_time'] + d1 / epsilon * dt
|
122
|
+
arrival_2 = j2['introduction_time'] + d2 / epsilon * dt
|
121
123
|
|
122
124
|
if arrival_1 > arrival_2:
|
123
125
|
lines[index1]['end'] = (intersection_pt.x, intersection_pt.y)
|
124
126
|
lines[index1]['neighbors_initial'] = lines[index1]['neighbors_initial'] + [j2['id'][:-2]]
|
125
|
-
lines[index1]['growth_status'] = False
|
127
|
+
lines[index1]['growth_status'] = False
|
126
128
|
|
127
129
|
else:
|
128
130
|
lines[index2]['end'] = (intersection_pt.x, intersection_pt.y)
|
129
131
|
lines[index2]['neighbors_initial'] = lines[index2]['neighbors_initial'] + [j1['id'][:-2]]
|
130
132
|
lines[index2]['growth_status'] = False
|
131
|
-
|
133
|
+
|
132
134
|
return lines
|
133
135
|
|
134
136
|
def transform_to_standard_lines(lines: List[Dict[str, Any]]) -> List[LineSegment]:
|
@@ -173,7 +175,7 @@ def generate_line_segments_dynamic(size: int, dt: float, epsilon: float, time: f
|
|
173
175
|
"""
|
174
176
|
lines = []
|
175
177
|
line_id, t, t_total = 1, 0, 0
|
176
|
-
|
178
|
+
|
177
179
|
# Stop loop whenever we have enough lines and all lines have stopped growing
|
178
180
|
while len(lines) / 2 < size or np.any([item['growth_status'] for item in lines]):
|
179
181
|
|
@@ -185,17 +187,18 @@ def generate_line_segments_dynamic(size: int, dt: float, epsilon: float, time: f
|
|
185
187
|
if time == 0:
|
186
188
|
number_of_lines_to_add = size
|
187
189
|
else:
|
188
|
-
number_of_lines_to_add = int(t
|
190
|
+
number_of_lines_to_add = int(t / time)
|
191
|
+
|
189
192
|
for _ in range(number_of_lines_to_add):
|
190
193
|
lines = add_new_line(lines, line_id, t_total, angles=angles)
|
191
194
|
line_id += 1
|
192
|
-
|
193
|
-
|
195
|
+
|
196
|
+
t = 0
|
194
197
|
|
195
198
|
lines = grow_lines(lines, epsilon)
|
196
199
|
lines = update_for_border_intersections(lines)
|
197
|
-
lines = check_and_update_when_intersect(lines, epsilon)
|
198
|
-
|
200
|
+
lines = check_and_update_when_intersect(lines, epsilon, dt)
|
201
|
+
|
199
202
|
lines = transform_to_standard_lines(lines)
|
200
203
|
|
201
204
|
return lines
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2023 M.N. Mooij
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
File without changes
|
File without changes
|
File without changes
|