6.1.1.5.1.12. thyrsis.simulation.nearest_nodes module

Calculates nearest nodes for each point of interest

and return results in nearest_node.csv

USAGE:

python -m thyrsis.simulation.nearest_nodes database.sqlite [table_name, nodes_number]

OPTIONS

table_name : name of the points table, among [‘points_interet’, ‘points_pilote’] (default points_interet) nodes_number : number of nearest nodes to find out (default 1)

class thyrsis.simulation.nearest_nodes.Nearest(database, compute_dir, table='points_interet', nodes_number=1)

Bases: object

Process class for inversion calculation

get_points()

Returns list of points

Return list_pp

Point list

Rtype list_pp

list

index_nodes()

Computes index for nodes coordinates

Return idx_n

nodes index

Rtype idx_n

rtree.Index

Return xy_n

nodes coordinates list

Rtype xy_n

list

index_npp(compute_dir)

Computes index of nearest nodes to pilot point

Return idx_npp

npp index

Rtype idx_npp

list

Return pds_npp

weight of nearest nodes

Rtype pds_npp

list

points()

Defines points and indexes them

Return list_pp

points list

Rtype list_pp

list

class thyrsis.simulation.nearest_nodes.Point(x, y, num, nom)

Bases: object

Class object for pilot point

thyrsis.simulation.nearest_nodes.distance(x1, y1, x2, y2)

Compute distance between two points

Parameters
  • x1 (float) – x1 coord

  • y1 (float) – y1 coord

  • x2 (float) – x2 coord

  • y2 (float) – y2 coord

Returns

distance

Return type

float

thyrsis.simulation.nearest_nodes.nearest_nodes(dbname, table, nodes_number)

Computes nearest node of points in table

Parameters
  • dbname (string) – path to database

  • table – points table

Returns

file nearest_node.csv

Return type

file