snowdrop.src.graphs package

Submodules

snowdrop.src.graphs.test_contour module

snowdrop.src.graphs.util module

Created on Mon Mar 4 14:28:27 2019

@author: A.Goumilevski

snowdrop.src.graphs.util.barPlot(path_to_dir, titles, data, labels=None, xLabel=None, yLabel=None, sizes=None, plot_variables=False, fig_sizes=(8, 6), save=False, show=True, ext=None)[source]

Plot bar graph.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param titles:

Title.

type titles:

str or list.

param data:

Data.

type data:

numpy array.

param labels:

List of graphs labels.

type labels:

list.

param xLabel:

X axis label.

type xLabel:

str.

param yLabel:

Y axis label.

type yLabel:

str.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param plot_variables:

If True plot selected variables.

type plot_variables:

bool.

param fig_sizes:

Figure sizes.

type fig_sizes:

Tuple.

param save:

If True saves plot in a pdf format.

type save:

bool.

param show:

If True display plots.

type show:

bool.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.bar_plot(path_to_dir=None, var=[], var_names=[], par=None, par_names=None, title='', symbols=None, xLabel=None, yLabel=None, plot_variables=False, relative=False, sizes=None, fig_sizes=(8, 6))[source]

Plot bar graphs.

snowdrop.src.graphs.util.getColors(variables=[])[source]

Define RGB colors.

snowdrop.src.graphs.util.make_space_above(fig, topmargin=1)[source]

Increase figure size to make top margin (in inches) space for titles, without changing the axes sizes.

snowdrop.src.graphs.util.plot(path_to_dir, data, variable_names, sizes=None, figsize=None, meas_values=None, meas_variables=None, lrx_filter=None, hp_filter=None, Tmax=10000000000.0, output_variables=None, var_labels={}, prefix=None, steady_state=None, rng=None, rng_meas=None, irf=0, Npaths=1, header=None, show=True, save=True, ext='png')[source]

Plot 1-D graphs of macro variables.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param data:

Data array.

type data:

array.

param variable_names:

Variables names.

type variable_names:

list.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param figsize:

Figure size..

type figsize:

tuple.

param meas_values:

Measurement variables values.

type meas_values:

list.

param meas_variables:

Measurement variables names.

type meas_variables:

list.

param lrx_filter:

List of LRX filtered measurement values.

type lrx_filter:

list.

param hp_filter:

List of HP filtered measurement values.

type hp_filter:

list.

param Tmax:

Maximum number of periods to display in graphs.

type Tmax:

int.

param output_variables:

Output variable names.

type output_variables:

list.

param var_labels:

Labels of output variable names.

type var_labels:

dict.

param prefix:

Prefix of variables. If set then display variable which name start with prefix.

type prefix:

str.

param steady_state:

Steady-state solution.

type steady_state:

list.

param irf:

Impulse-responce function variable.

type irf:

int.

param Npaths:

Number of paths.

type Npaths:

int.

param header:

Plot header.

type header:

str.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.

param ext:

Format of the saved file.

type ext:

str.

returns:

List of figures.

snowdrop.src.graphs.util.plot3D(path_to_dir, data, variable_names, show=True, save=True, ext='png')[source]

Plot 3-D graphs of macro variables.

This is a toy example of 3D plots.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param data:

Data array.

type data:

array.

param variable_names:

Variables names.

type variable_names:

list.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.

param ext:

Format of the saved file.

type ext:

str.

returns:

List of figures.

snowdrop.src.graphs.util.plotDecomposition(path_to_dir, model, y, variables_names, decomp_variables, periods, isKF=False, header=None, sizes=(2, 2), Tmax=50, rng=None, figsize=None, show=True, save=True, ext='png')[source]

Plot contributions of different soures to endogenous variable.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param model:

Model object.

type model:

Model.

param y:

Data array.

type y:

array.

param variables_names:

Variable names.

type variables_names:

list.

param decomp_variables:

decomposition variables names.

type decomp_variables:

list.

param periods:

List of periods of shocks.

type periods:

list.

param header:

Plot header.

type header:

str.

param isKF:

True if shocks are obtained by Kalman Filter.

type isKF:

bool.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param Tmax:

Maximum number of periods to display in graphs.

type Tmax:

int.

param rng:

Time range.

type rng:

list.

param sizes:

Figure sizes.

type sizes:

tuple.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plotEigenValues(path_to_dir, ev, show=True, save=True, ext='png')[source]

Plot eigen values.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param ev:

Eigen values

type ev:

np.array.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.colors

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plotHistogram(path_to_dir, priors, samples, names, parameters, header=None, show=True, save=True, sizes=(2, 2), ext='png')[source]

Plot histogram and kernel density function.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param priors:

Model parameters priors.

type priors:

dict.

param samples:

Data array.

type samples:

np.array.

param names:

List of parameters names.

type names:

list.

param parameters:

List of parameters values.

type parameters:

list.

param header:

Plot header.

type header:

str.

param sizes:

Figure sizes.

type sizes:

tuple.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plotImage(path_to_dir, fname)[source]

Plot image file.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param fname:

Image file name.

type fname:

str.

snowdrop.src.graphs.util.plotSeries(path_to_dir, header, titles, labels, series, sizes=None, xlabel=[], ylabel=[], plotType=None, fig_sizes=(12, 10), save=False, show=True, ext=None)[source]

Plot time series.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param header:

List of variables.

type header:

str.

param titles:

List of graphs titles.

type titles:

list.

param labels:

List of graphs labels.

type labels:

list.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param plotType:

Type of plot, i.e., line plot, bar plot, etc.

type plotType:

str.

param xlabel:

X labels of plot.

type xlabel:

list.

param ylabel:

Y labels of plot.

type ylabel:

list.

param save:

If True saves plot in a pdf format.

type save:

bool.

param isLastLinePlot:

If True the last series plot will be drawn as line plots.

type isLastLinePlot:

bool.

param show:

If True display plots.

type show:

bool.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plotSteadyState(path_to_dir, variables, arr_ss, par_ss, sizes=None, fig_sizes=(12, 10), save=False, show=False, ext='png')[source]

Plot steady state solution graphs.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param variables:

List of variables.

type variables:

list.

param arr_ss:

Array of steady states.

type arr_ss:

array.

param par_ss:

List of parameter names.

type par_ss:

list.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plotSurface(path_to_dir, data, Time, variable_names, output_variables=None, prefix=None, Npaths=1, show=True, save=True, ext='png')[source]

Plot 2-D graphs of macro variables.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param data:

Data array.

type data:

array.

param Time:

List of dates.

type Time:

list.

param variable_names:

Variables names.

type variable_names:

list.

param output_variables:

Output variable names.

type output_variables:

list.

param prefix:

Prefix of variables. If set displays variable which name start with this prefix.

type prefix:

str.

param Npaths:

Number of paths.

type Npaths:

int.

param show:

Boolean variable. If set to True shows graphs.

type show:

bool.

param save:

Boolean variable. If set to True saves graphs.

type save:

bool.

param ext:

Format of the saved file.

type ext:

str.

returns:

List of figures.

snowdrop.src.graphs.util.plotTestedSeries(x1, dx1, x2, dx2, n1, n2)[source]

Check endogenous variables cross-correlation and Granger cointegration.

Parameters:
x1numpy array

Values of the first endogenous variables.

dx1numpy array

Values of the increments of the first endogenous variables.

x2numpy array

Values of the second endogenous variables.

dx12numpy array

Values of the increments of the second endogenous variables.

snowdrop.src.graphs.util.plotTimeSeries(path_to_dir, header, titles, labels, series, sizes=None, fig_sizes=(12, 10), save=False, highlight=None, stacked=True, isLastLinePlot=True, zero_line=False, show=True, ext=None)[source]

Plot time series.

Parameters:
param path_to_dir:

Path to the folder where figures are saved.

type path_to_dir:

str.

param header:

List of variables.

type header:

str.

param titles:

List of graphs titles.

type titles:

list.

param labels:

List of graphs labels.

type labels:

list.

param sizes:

Subplots dimensions.

type sizes:

tuple.

param save:

If True saves plot in a pdf format.

type save:

bool.

param highlight:

The startong and ending dates of a highlighted region.

type highlight:

list.

param stacked:

If True plot stacked bar plots.

type stacked:

bool.

param isLastLinePlot:

If True the last series plot will be drawn as line plots.

type isLastLinePlot:

bool.

param show:

If True display plots.

type zero_line:

bool.

param zero_line:

If True adds zero line.

type show:

bool.

param ext:

Format of the saved file.

type ext:

str.

snowdrop.src.graphs.util.plot_chain(path_to_dir, chains, names=None, title=None, sizes=[3, 2], figsize=None, save=False, ext='pdf')[source]

Plot sampling chain for each parameter.

Args:
  • param path_to_dir Path to the folder where figures are saved

  • chains (ndarray): Sampling chain for each parameter

  • names (list): List of strings - name of each parameter

  • figsize (list): Specify figure size in inches [Width, Height]

  • **save* If True saves plot in a pdf format

  • **ext* Format of the saved file

snowdrop.src.graphs.util.plot_pairwise_correlation(path_to_dir, chains, names=None, title=None, figsize=None, save=False, ext='pdf')[source]

Plot pairwise correlation for each parameter.

Args:
  • param path_to_dir Path to the folder where figures are saved

  • chains (ndarray): Sampling chain for each parameter

  • names (list): List of strings - name of each parameter

  • figsize (list): Specify figure size in inches [Width, Height]

  • **save* If True saves plot in a pdf format

  • **ext* Format of the saved file

snowdrop.src.graphs.util.rgb(col)[source]

Set up RGB Colours.

Module contents