optiwindnet.db¶
Package Contents¶
- optiwindnet.db.open_database(filepath: str, create_db: bool = False) pony.orm.Database[source]¶
Opens the sqlite database v2 file specified in filepath.
- Parameters:
filepath – path to database file
create_db – True -> create a new file if it does not exist
- Returns:
Database object (Pony ORM)
- optiwindnet.db.G_by_method(G: networkx.Graph, method: object, db: pony.orm.Database) networkx.Graph[source]¶
Fetch from the database a layout for G by method. G must be a layout solution with the necessary info in the G.graph dict. method is a Method.
- optiwindnet.db.G_from_routeset(routeset: object) networkx.Graph[source]¶
Translate a RouteSet database entry to a routeset graph.
- Parameters:
routeset – an entry from the database RouteSet table.
- Returns:
Graph G containing the routeset.
- optiwindnet.db.Gs_from_attrs(farm: object, methods: object | collections.abc.Sequence[object], capacities: int | collections.abc.Sequence[int], db: pony.orm.Database) list[tuple[networkx.Graph]][source]¶
Fetch from the database a list (one per capacity) of tuples (one per method) of layouts. farm must have the desired NodeSet name in the name attribute. methods is a (sequence of) Method instance(s). capacities is a (sequence of) int(s).