Documentation

pynare.core

class pynare.core.model(modpath, engine=None, plot=None, verbose=True)

Bases: object

The class holding information about the model and the engine.

modpath

the full path to the *.mod-file

Type:str
engine

the engine. Must be either ‘matlab’ or ‘octave’. None defaults to ‘matlab’

Type:str, optional
plot

if True, loads all *.eps files from the model directory and displays them using matplotlib. Defaults to False if engine=’matlab’ and to True if engine=’octave’

Type:bool, optional
verbose

if True, prints the messages from dynare during calculation. Default is True

Type:bool, optional
get_log()

Prints the dynare log file for the provided model and returns it as a string

run(verbose=None)

Runs the model again

get_log()

Prints the dynare log file for the provided model and returns it as a string

Returns:a string containting the text in the log file
Return type:str
log
run(verbose=None)

Runs the model again

Parameters:verbose (bool, optional) – if True, prints the messages from dynare during calculation. Default is True
pynare.core.pynare(modpath=None, **kwargs)

The API to Pynare. Runs the model file and returns the Pynare model object. …

Parameters:
  • modpath (str) – the full path to the *.mod-file
  • engine (str, optional) – the engine. Must be either ‘matlab’ or ‘octave’. None defaults to ‘matlab’
  • plot (bool, optional) – if True, loads all *.eps files from the model directory and displays them using matplotlib. Defaults to False if engine=’matlab’ and to True if engine=’octave’
  • verbose (bool, optional) – if True, prints the messages from dynare during calculation. Default is True
Returns:

the Pynare object containing the model

Return type:

pynare.core.model

Raises:

SyntaxError – If provided file is not of ‘*.mod’-type

pynare.core.set_dynare_path(path)

pynare.lib

class pynare.lib.PipeOutput(logfile, stdout=None)

Bases: object

A context manager that redirects stdout for its scope to a file, usage:

with pipeOutput(‘log.txt’):
os.system(‘ls -l’)
logfile

the full path to the output file

Type:str
stdout

the stdout object. Defaults to sys.stdout

Type:object, optional
pynare.lib.isnotebook()

A checker whether the code is running in an Jupyter notebook

Returns:
Return type:bool
pynare.lib.plot_eps(path, title)

Plots all ‘*.eps’ files in folder

Parameters:
  • path (str) – the full path to the folder in which to look
  • title (str) – title string for the output plots
pynare.lib.print_progress(logfile)

Prints new lines arriving in logfile

Parameters:logfile (str) – the full path to the logfile