Skip to content

Instantly share code, notes, and snippets.

@nworbmot
nworbmot / pypsa_plotly.py
Last active October 12, 2017 16:00
Minimal example of plotly working with PyPSA
## 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 October 12, 2017 14:57
working example of https://plot.ly/python/network-graphs/ to be pasted into Jupyter notebook
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 December 22, 2020 14:52
Tools for fast Pyomo problem building
## 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.