BORGForwardModel
-
class
aquila_borg.forward.
BORGForwardModel
Base class for all forward models.
All forward models derive from this class. However python implemented forward models must use
BaseForwardModel
.- Members
-
accumulateAdjoint
(self: aquila_borg._borg.forward.BORGForwardModel, do_accumulate: bool) → None Request the model to accumulate adjoint vectors instead of resetting at each call.
This changes the default behavior of adjointModel_v2. Use with care.
- Parameters
do_accumulate (bool) – If true, request the change of behavior.
-
adjointModel_v2
(self: aquila_borg._borg.forward.BORGForwardModel, adjoint_gradient: object) → None Pushes the adjoint gradient from a deeper part of the computation.
This function allows to push the adjoint gradient vector for a deeper part of the computation (like the likelihood) to the forward model. It will not return the result which has to be query with
getAdjointModel()
.- Parameters
adjoint_gradient (numpy.array) – A 3d numpy array either real or complex. If
it must use the RFFT half-complex representation (complex) –
- Returns
None
-
clearAdjointGradient
(self: aquila_borg._borg.forward.BORGForwardModel) → None Clear accumulated information to compute the adjoint gradient vector.
This is automaticalled by getAdjointModelOutput.
-
forwardModel
(self: aquila_borg._borg.forward.BORGForwardModel, arg0: numpy.ndarray[numpy.complex128], arg1: numpy.ndarray[numpy.float64]) → None
-
forwardModel_v2
(self: aquila_borg._borg.forward.BORGForwardModel, arg0: numpy.ndarray) → None Run the first part of the forward model (v2 API).
- Parameters
input_array (numpy.array) – A 3d numpy array either real or complex. If complex it must use the RFFT half-complex representation
- Returns
None
-
getAdjointModel
(self: aquila_borg._borg.forward.BORGForwardModel, arg0: numpy.ndarray) → None
-
getBoxModel
(self: aquila_borg._borg.forward.BORGForwardModel) → aquila_borg._borg.forward.BoxModel Return the box on which is defined the input of the model is defined.
-
getCommunicator
(self: aquila_borg._borg.forward.BORGForwardModel) → object Build and return an MPI4PY communicator object that is linked to the internal MPI communicator of that object.
- Returns
mpi4py.MPI.Comm
-
getDensityFinal
(self: aquila_borg._borg.forward.BORGForwardModel, arg0: numpy.ndarray) → None Obtain the density field produced by the forward model (part 2 of the evaluation, v2 API).
-
getMPISlice
(self: aquila_borg._borg.forward.BORGForwardModel) → tuple Returns a tuple of integer indicating the way the slab is distributed among the node.
- Returns
(startN0, localN0, N1, N2)
- Return type
tuple of int
-
getModelParam
(self: aquila_borg._borg.forward.BORGForwardModel, model: str, keyname: str) → object This queries the current state of the parameters ‘keyname’ in model ‘model’.
- Parameters
model (str) – sub model name keyname (str): key of the parameter to query
- Returns
the value of the parameter
- Return type
object
-
getOutputBoxModel
(self: aquila_borg._borg.forward.BORGForwardModel) → aquila_borg._borg.forward.BoxModel Return the box on which is defined the output of the model is defined.
- Returns
the box model representing the shape and size of the output of that forward model.
- Return type
-
getOutputMPISlice
(self: aquila_borg._borg.forward.BORGForwardModel) → tuple Return a tuple indicating what is the expected output MPI slicing (startN0,localN0,N1,N2) (Warning! unstable API)
-
getPreferredInput
(self: aquila_borg._borg.forward.BORGForwardModel) → aquila_borg._borg.forward.PreferredIO Returns the preferred output format (i.e. the one that incurs less transforms) for that model.
- Returns
the preferred format
- Return type
-
getPreferredOutput
(self: aquila_borg._borg.forward.BORGForwardModel) → aquila_borg._borg.forward.PreferredIO Returns the preferred output format (i.e. the one that incurs less transforms) for that model.
- Returns
the preferred format
- Return type
-
holdParticles
(self: aquila_borg._borg.forward.BORGForwardModel) → None
-
setAdjointRequired
(self: aquila_borg._borg.forward.BORGForwardModel, arg0: bool) → None Indicate whether the caller require the adjoint gradient to be computed later.
- Parameters
flag (bool) – if True, tape is recorded to compute adjoint
-
setCosmoParams
(self: aquila_borg._borg.forward.BORGForwardModel, cosmo_params: aquila_borg._borg.cosmo.CosmologicalParameters) → None Setup the cosmological parameters that this model requires.
- Parameters
cosmo_params (
aquila_borg.cosmo.CosmologicalParameters
) – Cosmological parameters
-
setModelParams
(self: aquila_borg._borg.forward.BORGForwardModel, params: dict) → None Allow changing model parameters for different model indexed by the dictionnary key, each item is another dictionnary with key/value pairs.
-
setName
(self: aquila_borg._borg.forward.BORGForwardModel, name: str) → None Give a to localize more easily a model instance.
- Parameters
name (str) – string name of the instance
Methods
|
Initialize self. |
|
Request the model to accumulate adjoint vectors instead of resetting at each call. |
|
Pushes the adjoint gradient from a deeper part of the computation. |
|
Clear accumulated information to compute the adjoint gradient vector. |
|
|
|
Run the first part of the forward model (v2 API). |
|
|
|
Return the box on which is defined the input of the model is defined. |
|
Build and return an MPI4PY communicator object that is linked to the internal MPI communicator of that object. |
|
Obtain the density field produced by the forward model (part 2 of the evaluation, v2 API). |
|
Returns a tuple of integer indicating the way the slab is distributed among the node. |
|
This queries the current state of the parameters ‘keyname’ in model ‘model’. |
|
Return the box on which is defined the output of the model is defined. |
|
Return a tuple indicating what is the expected output MPI slicing (startN0,localN0,N1,N2) (Warning! unstable API) |
|
Returns the preferred output format (i.e. |
|
Returns the preferred output format (i.e. |
|
|
|
Indicate whether the caller require the adjoint gradient to be computed later. |
|
Setup the cosmological parameters that this model requires. |
|
Allow changing model parameters for different model indexed by the dictionnary key, each item is another dictionnary with key/value pairs. |
|
Give a to localize more easily a model instance. |