BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
PyCallback Class Reference

Base class to wrap Python callable and pass it to C++. More...

Public Types

enum  CallbackType { SCALAR , RESIDUAL }
 

Public Member Functions

 PyCallback (CallbackType callback_type=SCALAR)
 
CallbackType callback_type () const
 
virtual double call_scalar (Fit::Parameters pars)
 Call Python callable and returns its result. More...
 
virtual std::vector< double > call_residuals (Fit::Parameters pars)
 Call Python callable and returns its result. More...
 

Detailed Description

Base class to wrap Python callable and pass it to C++.

Used in swig interface file, intended to be overloaded from Python.

Definition at line 24 of file PyCallback.h.

Member Function Documentation

◆ call_scalar()

double PyCallback::call_scalar ( Fit::Parameters  pars)
virtual

Call Python callable and returns its result.

Intended to be overloaded in Python.

Parameters
parsFit parameters object (intentionally passed by value).
Returns
value of objective function.

Definition at line 26 of file PyCallback.cpp.

◆ call_residuals()

std::vector< double > PyCallback::call_residuals ( Fit::Parameters  pars)
virtual

Call Python callable and returns its result.

Intended to be overloaded in Python.

Parameters
parsFit parameters object (intentionally passed by value).
Returns
vector of residuals

Definition at line 31 of file PyCallback.cpp.


The documentation for this class was generated from the following files: