Python Interface

The Python interface provides a thin wrapper around cmdstanpy.CmdStanModel to facilitate working with the gptools library.

Function Reference

compile_model(model_name: Optional[str] = None, stan_file: Optional[Union[str, PathLike]] = None, exe_file: Optional[Union[str, PathLike]] = None, compile: Union[bool, str] = True, stanc_options: Optional[Dict[str, Any]] = None, cpp_options: Optional[Dict[str, Any]] = None, user_header: Optional[Union[str, PathLike]] = None, cls: Optional[Type] = None, **kwargs) CmdStanModel

Create a cmdstanpy.CmdStanModel and configure include paths for gptools.

Parameters
  • model_name – Model name used for output file names (defaults to base name of stan_file).

  • stan_file – Path to Stan model file.

  • exe_file – Path to compiled executable file. Optional unless stan_file is not given. If both stan_file and exe_file are given, the base names must match.

  • compile – Whether or not to compile the model (defaults to True). If "force", the model will compile even if a newer executable is found.

  • stanc_options – Stanc3 compiler options (see here for details).

  • cpp_options – C++ compiler options.

  • user_header – Path to a C++ header file to include during compilation.

  • cls – Subclass of cmdstanpy.CmdStanModel if a custom implementation should be used.

  • **kwargs – Keyword arguments passed to the cmdstanpy.CmdStanModel constructor.

Returns

model – Model instance with include paths configured for gptools.

get_include() str

Get the include directory for the library.

set_cmdstanpy_log_level(level: Optional[Union[str, int]] = None) None

Set the log level of cmdstanpy.

Parameters

level – Log level (defaults to WARNING).