gpkit.interactive package

Submodules

gpkit.interactive.chartjs module

gpkit.interactive.linking_diagram module

Module for creating diagrams illustrating variables shared between submodels.

gpkit.interactive.linking_diagram.linking_diagram(topmodel, subsystems, filename)

Method to create a latex diagram illustrating how variables are linked between a parent model and its submodels

topmodel - a model object, the parent model of all submodels susbystems - a list of model objects, each a submodel of the topmodel filename - a string which is the name of the file latex output will be written to

note: the following packages must be used in the latex file usepackage{tikz} usetikzlibrary{backgrounds}

gpkit.interactive.plot_sweep module

Implements plot_sweep1d function

gpkit.interactive.plot_sweep.assign_axes(var, posys, axes)

Assigns axes to posys, creating and formatting if necessary

gpkit.interactive.plot_sweep.format_and_label_axes(var, posys, axes, ylabel=True)

Formats and labels axes

gpkit.interactive.plot_sweep.plot_1dsweepgrid(model, sweeps, posys, origsol=None, tol=0.01, **solveargs)

Creates and plots a sweep from an existing model

Example usage: f, _ = plot_sweep_1d(m, {‘x’: np.linspace(1, 2, 5)}, ‘y’) f.savefig(‘mysweep.png’)

gpkit.interactive.plotting module

Plotting methods

gpkit.interactive.plotting.plot_convergence(model)

Plots the convergence of a signomial programming model

model: Model
Signomial programming model that has already been solved
matplotlib.pyplot Figure
Plot of cost as functions of SP iteration #

gpkit.interactive.ractor module

Implements Ractor-based interactive CADtoons

gpkit.interactive.ractor.ractorjs(title, model, update_py, ranges, constraint_js='')

Creates Javascript/HTML for CADtoon interaction without installing GPkit.

gpkit.interactive.ractor.ractorpy(model, update_py, ranges, constraint_js='', showtables=('cost', 'sensitivities'))

Creates interactive iPython widget for controlling a CADtoon

gpkit.interactive.ractor.showcadtoon(title, css='')

Displays cadtoon as iPython HTML

gpkit.interactive.sensitivity_map module

Implements heatmapped equations to highlight sensitivities.

class gpkit.interactive.sensitivity_map.SensitivityMap(model, paintby='constants')

Bases: object

Latex representations of a model heatmapped by its latest sensitivities

model : Model
The Model object that the Map will be based on
paintby : string
The unit of colouring. Must be one of “constants”, “monomials”, or “posynomials”.

from IPython.display import display for key in m.solution[“sensitivities”]:

print key display(SensitivityMap(m, paintby=key))
constraint_latex_list(paintby)

Generates LaTeX for constraints.

latex

LaTeX representation.

solution

Gets solution, indexing into a sweep if necessary.

gpkit.interactive.sensitivity_map.colorfn_gen(scale, power=0.66)

Generates color gradient of a given power law.

gpkit.interactive.sensitivity_map.signomial_print(sig, sol, colorfn, paintby='constants', idx=None)

For pretty printing with Sympy

gpkit.interactive.widgets module

Module contents

Module for the interactive and plotting functions of GPkit