modeljupyter module

Created on Sat Jun 22 21:26:13 2019

@author: hanseni

modeljupyter.vis_alt3(dfs, model, title='Show variables', basename='Baseline', altname='Alternative', trans={}, legend=True)[source]

display tabbed widget with results from different dataframes, usuallly 2 but more can be shown

dfs is a list of dataframes. They should be of same dimensionalities

modeljupyter.vis_alt4(dfs, model, title='Show variables', trans={}, legend=True)[source]

display tabbed widget with results from different dataframes, usuallly 2 but more can be shown

dfs is a list of dataframes. They should be of same dimensionalities

class modeljupyter.jup_keepviz(dfs, title='Show variables', trans={}, legend=True, showfig=False)[source]

Bases: object

Class to vizualize a number of runs, primary in Jupyter :dfs: A dict with runs {name :{‘result’ : df}} :title: A title :trans: a translation of variable names to more redable names :legend: if legends has to be shown

plot_level(var)[source]
plot_dif(var)[source]
formatnumber(var, out)[source]
class modeljupyter.jupviz(dfs, title='Show variables', trans={}, legend=True, showfig=False)[source]

Bases: jup_keepviz

Class to vizualize a number of experiments in an tabbed ipywidget in a jupyter notebook

vis()[source]

display tabbed widget with results from different dataframes, usuallly 2 but more can be shown

dfs is a list of dataframes. They should be of same dimensionalities

modeljupyter.get_alt(mmodel, pat, onlyendo=False)[source]

Retrieves variables matching pat from a model

modeljupyter.get_alt_dic(mmodel, pat, dfs, onlyendo=False)[source]

Retrieves variables matching pat from a model

modeljupyter.inputwidget(model, basedf, slidedef={}, radiodef=[], checkdef=[], modelopt={}, varpat='RFF XGDPN RFFMIN GFSRPN DMPTRSH XXIBDUMMY', showout=1, trans={}, base1name='', alt1name='', go_now=True, showvar=False)[source]

Creates an input widgets for updating variables

Df:

Baseline dataframe

Slidedef:

dict with definition of variables to be updated by slider

Radiodef:

dict of lists. each at first level defines a collection of radiobuttoms second level defines the text for each leved and the variable to set or reset to 0

Varpat:

the variables to show in the output widget

Showout:

1 if the output widget is to be called

modeljupyter.get_att_gui(totdif, var='FY', spat='*', desdic={}, use='level', kind='bar', perselect='per', ysize=10)[source]

Creates a jupyter ipywidget to display model level attributions

modeljupyter.get_att_gui2(totdif, var='RP', spat='*', desdic={}, use='level', kind='bar')[source]

Creates a jupyter ipywidget to display model level attributions for datily dates

modeljupyter.vtol(var)[source]

replaces special characters in variable name to latex

modeljupyter.an_expression_to_latex(exp, funks=[])[source]

Returns a latex string from a list of terms (defined in the modelpattern module)

funks is a list of localy defines functions

modeljupyter.expressions_to_latex(expressions, funks=[], allign=True, disp=False)[source]

Returns a latex string from a list of a list of terms

Funks:

a list of local functions in the model

Allign:

the first = is enclosed in & for alligning several equations in latex

Disp:

the result is displayed

modeljupyter.frml_as_latex(frml_in, funks=[], allign=True, name=True, disp=True, linespace=False)[source]

Display formula

Funks:

local functions

Allign:

allign =

Name:

also display the frml name

modeljupyter.get_frml_latex(model, pat='*', name=True)[source]