Skip to content

Instantly share code, notes, and snippets.

@nworbmot
nworbmot / pypsa_plotly.py
Last active Oct 12, 2017
Minimal example of plotly working with PyPSA
View pypsa_plotly.py
## Based on https://plot.ly/python/network-graphs/
## Copyright plotly team, Tom Brown, Bryn Pickering 2017
## Licensed under the Apache 2.0 Licence.
## Working demo: https://pypsa.org/examples/plotly_network.html
import plotly.offline as py
@nworbmot
nworbmot / networkx_plotly.py
Last active Oct 12, 2017
working example of https://plot.ly/python/network-graphs/ to be pasted into Jupyter notebook
View networkx_plotly.py
import plotly.offline as py
from plotly.graph_objs import *
py.init_notebook_mode(connected=True)
%matplotlib inline
import networkx as nx
G=nx.random_geometric_graph(200,0.125)
pos=nx.get_node_attributes(G,'pos')
@nworbmot
nworbmot / opt.py
Last active Mar 23, 2020
Tools for fast Pyomo problem building
View opt.py
## Copyright 2015-2017 Tom Brown (FIAS), Jonas Hoersch (FIAS), David
## Schlachtberger (FIAS)
## Licensed under the Apache 2.0 Licence.
"""
Tools for fast Pyomo linear problem building.
Essentially this library replaces Pyomo expressions with more strict
objects with a pre-defined affine structure.
You can’t perform that action at this time.