| GNSS data to OSM format processor and track finder

- Main Page
- Packages
- Files

- Packages
- Package Functions

Functions
patternfinding_functions Namespace Reference

This file provides functions used to find bus line patterns. More...

## Functions
def | progressbar (it, prefix="", size=60, file=sys.stdout)
| Function works as a progressbar in other functions running cycles. More...
def | myratio_calc (list1, list2)
| Alternative to ratio provided by gestalt or levenstein algorithms. More...
def | gestalt1 (tuple_nodes, range_from, range_to)
| Function finds repeating patterns of lengths defined by the range_from number ONLY, by crawling through tuple_nodes. More...
def | levenshtein1 (tuple_nodes, range_from, range_to)
| Check definition at the gestalt1 function. More...
def | manual_trackfinder1 (tuple_nodes, range_from, range_to)
| Check definition at the gestalt1 function. More...
def | gestalt2 (tuple_nodes, range_from, range_to)
| Approach difference is in the moment when ratio is calculated. More...
def | levenshtein2 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | manual_trackfinder2 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | gestalt4 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | gestalt5 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | gestalt6 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | gestalt8 (tuple_nodes, range_from, range_to)
| Function finds repeating patterns of lengths range_from to range_to by crawling through tuple_nodes. More...
def | levenshtein3 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | manual_trackfinder3 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | gestalt7 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...
def | levenshtein5 (tuple_nodes, range_from, range_to)
| For basic principle, read gestalt8 description. More...

## Detailed Description

This file provides functions used to find bus line patterns.

## Function Documentation

## ◆ gestalt1()

def patternfinding_functions.gestalt1 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

Function finds repeating patterns of lengths defined by the range_from number ONLY, by crawling through tuple_nodes.

It returns the information about the position of tracks in tuple_nodes. Similarity is decided by the SequenceMatcher ratio or quick_ratio.

Parameters

  tuple_nodes | file with repeating patterns in itself. Implemented with its elements as tuples
  range_from | determines the length of a seeked repeating pattern
  range_to | IGNORED

Returns
  list of tuples in which every tuple contains 3 items

first one is the length of the found track in nodes

second one is the position of first alternative of the found pair in the particular bus line

third one is the position of second alternative of the found pair in the particular bus line

fourth one is the output of the particular method for comparing two trajectories, in this case it compared these two on those mentioned positions

## ◆ gestalt2()

def patternfinding_functions.gestalt2 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

Approach difference is in the moment when ratio is calculated.

Here it initiates by 2 nodes being equal to each other.

## ◆ gestalt4()

def patternfinding_functions.gestalt4 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ gestalt5()

def patternfinding_functions.gestalt5 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ gestalt6()

def patternfinding_functions.gestalt6 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ gestalt7()

def patternfinding_functions.gestalt7 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ gestalt8()

def patternfinding_functions.gestalt8 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

Function finds repeating patterns of lengths range_from to range_to by crawling through tuple_nodes.

It returns information about the position of tracks in tuple_nodes. Similarity is decided by the SequenceMatcher ratio or quick_ratio.

Parameters

  tuple_nodes | file with repeating patterns in itself. Implemented with its elements as tuples
  range_from | determines the minimal length of a seeked repeating pattern
  range_to | determines the maximal length of a seeked repeating pattern

Returns
  list of tuples in which every tuple contains 4 items

first one is the length of the found track in nodes

second one is the position of first alternative of the found pair in the particular bus line

third one is the position of second alternative of the found pair in the particular bus line

fourth one is the output of the particular method for comparing two trajectories, in this case it compared these two on those mentioned positions

## ◆ levenshtein1()

def patternfinding_functions.levenshtein1 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

Check definition at the gestalt1 function.

Differences are in the method for trajectories comparison since here levenshtein is used and therefore its fuzz.ratio

## ◆ levenshtein2()

def patternfinding_functions.levenshtein2 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ levenshtein3()

def patternfinding_functions.levenshtein3 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ levenshtein5()

def patternfinding_functions.levenshtein5 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ manual_trackfinder1()

def patternfinding_functions.manual_trackfinder1 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

Check definition at the gestalt1 function.

Differences are in the method for trajectories comparison since here myratio_calc is used.

## ◆ manual_trackfinder2()

def patternfinding_functions.manual_trackfinder2 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ manual_trackfinder3()

def patternfinding_functions.manual_trackfinder3 | ( |  | tuple_nodes,
|  |  | range_from,
|  |  | range_to
| ) |  |

For basic principle, read gestalt8 description.

Changes and approaches differ tiny amounts on more places in the body of the function.

## ◆ myratio_calc()

def patternfinding_functions.myratio_calc | ( |  | list1,
|  |  | list2
| ) |  |

Alternative to ratio provided by gestalt or levenstein algorithms.

For each point of list1 it finds the nearest point out of all list2 points. It returns the average distance corresponding to one list1 point.

## ◆ progressbar()

def patternfinding_functions.progressbar | ( |  | it,
|  |  | prefix = `""`,
|  |  | size = `60`,
|  |  | file = `sys.stdout`
| ) |  |

Function works as a progressbar in other functions running cycles.