Track Reference
GPXFileTrack(gpx_file, n_track=0, stopped_speed_threshold=1, max_speed_percentile=95, require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized by loading a .gpx file
Initialize a Track object from a gpx file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gpx_file
|
str
|
Path to the gpx file. |
required |
n_track
|
int
|
Index of track in the gpx file, defaults to 0 |
0
|
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Source code in geo_track_analyzer/track.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | |
add_segmeent(segment)
Add a new segment ot the track
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTracksegment to be added |
required |
Source code in geo_track_analyzer/track.py
114 115 116 117 118 119 120 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |
FITTrack(source, stopped_speed_threshold=1, max_speed_percentile=95, strict_elevation_loading=False, require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized by loading a .fit file
Load a .fit file and extract the data into a Track object. NOTE: Tested with Wahoo devices only
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | bytes
|
Path to fit file or byte representation of fit file |
required |
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
strict_elevation_loading
|
bool
|
If set, only points are added to the track that have a valid elevation,defaults to False |
False
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Source code in geo_track_analyzer/track.py
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 | |
add_segmeent(segment)
Add a new segment ot the track
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTracksegment to be added |
required |
Source code in geo_track_analyzer/track.py
114 115 116 117 118 119 120 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |
ByteTrack(bytefile, n_track=0, stopped_speed_threshold=1, max_speed_percentile=95, require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized from a byte stream
Initialize a Track object from a gpx file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bytefile
|
bytes
|
Bytestring of a gpx file |
required |
n_track
|
int
|
Index of track in the gpx file, defaults to 0 |
0
|
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Source code in geo_track_analyzer/track.py
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | |
add_segmeent(segment)
Add a new segment ot the track
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTracksegment to be added |
required |
Source code in geo_track_analyzer/track.py
114 115 116 117 118 119 120 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |
PyTrack(points, elevations, times, extensions=None, stopped_speed_threshold=1, max_speed_percentile=95, require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized from python objects
A geospacial data track initialized from python objects
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[tuple[float, float]]
|
List of Latitude/Longitude tuples |
required |
elevations
|
None | list[float]
|
Optional list of elevation for each point |
required |
times
|
None | list[datetime]
|
Optional list of times for each point |
required |
heartrate
|
Optional list of heartrate values for each point |
required | |
cadence
|
Optional list of cadence values for each point |
required | |
power
|
Optional list of power values for each point |
required | |
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Raises:
| Type | Description |
|---|---|
TrackInitializationError
|
Raised if number of elevation, time, heatrate, or cadence values do not match passed points |
Source code in geo_track_analyzer/track.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |
SegmentTrack(segment, stopped_speed_threshold=1, max_speed_percentile=95, require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized by loading a PGXTrackSegment object
Wrap a GPXTrackSegment into a Track object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTrackSegment |
required |
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Source code in geo_track_analyzer/track.py
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | |
add_segmeent(segment)
Add a new segment ot the track
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTracksegment to be added |
required |
Source code in geo_track_analyzer/track.py
114 115 116 117 118 119 120 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |
GeoJsonTrack(source, stopped_speed_threshold=1, max_speed_percentile=95, allow_empty_spatial=False, fallback_coordinates=(0.0, 0.0), require_data_extensions=None, heartrate_zones=None, power_zones=None, cadence_zones=None)
Bases: Track
Track that should be initialized by loading a .json file
Load a .json file that conforms to a supported geojson format. Currently the GeoJsonTrack supports: 1. LineString + Arrays 2. Collection of Points
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str | bytes | dict
|
Path or byte representation of the json file |
required |
stopped_speed_threshold
|
float
|
Minium speed required for a point to be count as moving, defaults to 1 |
1
|
max_speed_percentile
|
int
|
Points with speed outside of the percentile are not counted when analyzing the track, defaults to 95 |
95
|
allow_empty_spatial
|
bool
|
Allow geojson files without spatial values. If true, will generate the track with a fixed location (see. fallback_coordinates) |
False
|
fallback_coordinates
|
tuple[float, float]
|
Coordinates to be used if the geojson file does not contain spatial data, defaults to (0.0, 0.0) |
(0.0, 0.0)
|
heartrate_zones
|
None | Zones
|
Optional heartrate Zones, defaults to None |
None
|
power_zones
|
None | Zones
|
Optional power Zones, defaults to None |
None
|
cadence_zones
|
None | Zones
|
Optional cadence Zones, defaults to None |
None
|
Source code in geo_track_analyzer/track.py
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 | |
add_segmeent(segment)
Add a new segment ot the track
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
segment
|
GPXTrackSegment
|
GPXTracksegment to be added |
required |
Source code in geo_track_analyzer/track.py
114 115 116 117 118 119 120 | |
find_overlap_with_segment(n_segment, match_track, match_track_segment=0, width=50, overlap_threshold=0.75, max_queue_normalize=5, merge_subsegments=5, extensions_interpolation='copy-forward')
Find overlap of a segment of the track with a segment in another track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Segment in the track that sould be used as base for the comparison |
required |
match_track
|
Track
|
Track object containing the segment to be matched |
required |
match_track_segment
|
int
|
Segment on the passed track that should be matched to the segment in this track, defaults to 0 |
0
|
width
|
float
|
Width (in meters) of the grid that will be filled to estimate the overalp , defaults to 50 |
50
|
overlap_threshold
|
float
|
Minimum overlap (as fracrtion) required to return the overlap data, defaults to 0.75 |
0.75
|
max_queue_normalize
|
int
|
Minimum number of successive points in the segment between two points falling into same plate bin, defaults to 5 |
5
|
merge_subsegments
|
int
|
Number of points between sub segments allowed for merging the segments, defaults to 5 |
5
|
extensions_interpolation
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points, defaults to copy-forward |
'copy-forward'
|
Returns:
| Type | Description |
|---|---|
Sequence[tuple[Track, float, bool]]
|
Tuple containing a Track with the overlapping points, the overlap in percent, and the direction of the overlap |
Source code in geo_track_analyzer/track.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | |
get_avg_pp_distance(threshold=10)
Get average distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
379 380 381 382 383 384 385 386 387 388 | |
get_avg_pp_distance_in_segment(n_segment=0, threshold=10)
Get average distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the average, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Average distance |
Source code in geo_track_analyzer/track.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
get_closest_point(n_segment, latitude, longitude)
Get closest point in a segment or track to the passed latitude and longitude corrdinate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
None | int
|
Index of the segment. If None is passed the whole track is considered |
required |
latitude
|
float
|
Latitude to check |
required |
longitude
|
float
|
Longitude to check |
required |
Returns:
| Type | Description |
|---|---|
PointDistance
|
Tuple containg the point as GPXTrackPoint, the distance from the passed coordinates and the index in the segment |
Source code in geo_track_analyzer/track.py
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | |
get_max_pp_distance(threshold=10)
Get maximum distance between points in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
406 407 408 409 410 411 412 413 414 415 | |
get_max_pp_distance_in_segment(n_segment=0, threshold=10)
Get maximum distance between points in the segment with index n_segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement to process, defaults to 0 |
0
|
threshold
|
float
|
Minimum distance between points required to be used for the maximum, defaults to 10 |
10
|
Returns:
| Type | Description |
|---|---|
float
|
Maximum distance |
Source code in geo_track_analyzer/track.py
417 418 419 420 421 422 423 424 425 426 427 428 429 | |
get_point_data_in_segmnet(n_segment=0)
Get raw coordinates (latitude, longitude), times and elevations for the segement with the passed index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], None | list[float], None | list[datetime]]
|
tuple with coordinates (latitude, longitude), times and elevations |
Source code in geo_track_analyzer/track.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
get_segment_data(n_segment=0)
Get processed data for the segmeent with passed index as DataFrame
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segement, defaults to 0 |
0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with segmenet data |
Source code in geo_track_analyzer/track.py
513 514 515 516 517 518 519 520 521 522 | |
get_segment_overview(n_segment=0)
Get overall metrics for a segment
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, default to 0 |
0
|
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics moving time and distance, total time and distance, maximum and average speed and elevation and cummulated uphill, downholl elevation |
Source code in geo_track_analyzer/track.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_track_data(connect_segments='forward')
Get processed data for the track as DataFrame. Segment are indicated via the segment column.
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with track data |
Source code in geo_track_analyzer/track.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | |
get_track_overview(connect_segments='forward')
Get overall metrics for the track. Equivalent to the sum of all segments
Returns:
| Type | Description |
|---|---|
SegmentOverview
|
A SegmentOverview object containing the metrics |
Source code in geo_track_analyzer/track.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
get_xml(name=None, email=None)
Get track as .gpx file data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
None | str
|
Optional author name to be added to gpx file, defaults to None |
None
|
email
|
None | str
|
Optional auther e-mail address to be added to the gpx file, defaults to None |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Content of a gpx file |
Source code in geo_track_analyzer/track.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
interpolate_points_in_segment(spacing, n_segment=0, copy_extensions='copy-forward')
Add additdion points to a segment by interpolating along the direct line between each point pair according to the passed spacing parameter. If present, elevation and time will be linearly interpolated. Extensions (Heartrate, Cadence, Power) will be interpolated according to value of copy_extensions. Optionas are:
- copy the value from the start point of the interpolation (copy-forward)
- Use value of start point for first half and last point for second half (meet-center)
- Linear interpolation (linear)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spacing
|
float
|
Minimum distance between points added by the interpolation |
required |
n_segment
|
int
|
segment in the track to use, defaults to 0 |
0
|
copy_extensions
|
Literal['copy-forward', 'meet-center', 'linear']
|
How should the extenstion (if present) be defined in the interpolated points. |
'copy-forward'
|
Source code in geo_track_analyzer/track.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
plot(kind, *, segment=None, reduce_pp_intervals=None, use_distance_segments=None, **kwargs)
Visualize the full track or a single segment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
Literal['profile', 'profile-slope', 'map-line', 'map-line-enhanced', 'map-segments', 'zone-summary', 'segment-zone-summary', 'segment-box', 'segment-summary', 'metrics']
|
Kind of plot to be generated - profile: Elevation profile of the track. May be enhanced with additional information like Velocity, Heartrate, Cadence, and Power. Pass keyword args for |
required |
segment
|
None | int | list[int]
|
Select a specific segment, multiple segments or all segmenets, defaults to None |
None
|
reduce_pp_intervals
|
None | int
|
Optionally pass a distance in m which is used to reduce the points in a track, defaults to None |
None
|
use_distance_segments
|
None | float
|
Ignore all segments in data and split full track into segments with passed cummulated distance in meters. If passed, segment arg must be None. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
Figure (plotly) |
Raises:
| Type | Description |
|---|---|
VisualizationSetupError
|
If the plot prequisites are not met |
Source code in geo_track_analyzer/track.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | |
remove_segement(n_segment, merge='before')
Remove a given segment from the track and merge it with the previous or next segment. Will return False, of the passed parameters lead to not possible operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_segment
|
int
|
Index of the segment the overview should be generated for, |
required |
merge
|
Literal['before', 'after']
|
Direction of the merge. Possible values of "before" and "after". |
'before'
|
Returns:
| Type | Description |
|---|---|
bool
|
Boolean value reflecting if a segment was removed |
Source code in geo_track_analyzer/track.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
split(coords, distance_threshold=20)
Split the track at the passed coordinates. The distance_threshold parameter defines the maximum distance between the passed coordingates and the closest point in the track.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
tuple[float, float]
|
Latitude, Longitude point at which the split should be made |
required |
distance_threshold
|
float
|
Maximum distance between coords and closest point, defaults to 20 |
20
|
Raises:
| Type | Description |
|---|---|
TrackTransformationError
|
If distance exceeds threshold |
Source code in geo_track_analyzer/track.py
914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | |
strip_segements()
Strip all segments from the track. Duplicate points at the segmentment boardes will be dropped.
Source code in geo_track_analyzer/track.py
122 123 124 125 126 127 128 129 130 131 | |