pm.Deterministic model with python parameters, i.e no pytensor parameters

Hello
I followed the tutorial on using PyMC. It exemplifies the use of a Keplerian orbital function. The model is sufficiently simple, and the above function is defined under the “with pm.Model” loop employing previously PyTensor-defined parameters (tensors, objects, whatever).

I want to use a more complicated function, namely the Quadfunc for a transit exoplanet, defined with the machinery of the “batman” package.
The function is defined with simple Python variables (floats) and not with PyTensors. I tried to extract the scalar value from the pytensor using different suggestions from the internet, like .numpy, .item, or .detach.item, with a total failure.

Any new ideas? please

You need to wrap your python code in a pytensor Op. See here for an example that focuses on likelihood functions. Your case will be the same in terms of constructing an Op, but you will call the function on symbolic inputs rather than put it in a CustomDist logp. Here is another example where I wrap scipy.optimize.root in an Op and use it in a model, which is close to how you will use your external functions I guess.