docstr: Test running model for a scalar ODE with 2 parameters
docstr_tok: ["Test","running","model","for","a","scalar","ODE","with","2","parameters"]
code: def test_scalar_ode_2_param(self):
      """Test running model for a scalar ODE with 2 parameters"""
  
      def system(y, t, p):
          return p[0] * np.exp(-p[0] * t) - p[1] * y[0]
  
      times = np.array(
          [
              0.5,
              1.0,
              1.5,
              2.0,
              2.5,
              3.0,
              3.5,
              4.0,
              4.5,
              5.0,
              5.5,
              6.0,
              6.5,
              7.0,
              7.5,
          ]
      )
  
      yobs = np.array(
          [
              0.31,
              0.57,
              0.51,
              0.55,
              0.47,
              0.42,
              0.38,
              0.3,
              0.26,
              0.22,
              0.22,
              0.14,
              0.14,
              0.09,
              0.1,
          ]
      )[:, np.newaxis]
  
      ode_model = DifferentialEquation(
          func=system, t0=0, times=times, n_states=1, n_theta=2
      )
  
      with pm.Model() as model:
          alpha = pm.HalfCauchy("alpha", 1)
          beta = pm.HalfCauchy("beta", 1)
          y0 = pm.LogNormal("y0", 0, 1)
          sigma = pm.HalfCauchy("sigma", 1)
          forward = ode_model(theta=[alpha, beta], y0=[y0])
          y = pm.LogNormal(
              "y", mu=pm.math.log(forward), sigma=sigma, observed=yobs
          )
  
          with pytensor.config.change_flags(
              mode=fast_unstable_sampling_mode
          ):
              with warnings.catch_warnings():
                  warnings.filterwarnings(
                      "ignore", ".*number of samples.*", UserWarning
                  )
                  warnings.filterwarnings(
                      "ignore",
                      "invalid value encountered in log",
                      RuntimeWarning,
                  )
                  idata = pm.sample(50, tune=0, chains=1)
  
      assert idata.posterior["alpha"].shape == (1, 50)
      assert idata.posterior["beta"].shape == (1, 50)
      assert idata.posterior["y0"].shape == (1, 50)
      assert idata.posterior["sigma"].shape == (1, 50)
  
imports: import warnings
  import numpy
  import pytensor
  import pytensor.tensor
  import pytest
  from scipy.stats import norm
  import pymc
  from pymc.ode import DifferentialEquation
  from pymc.testing import fast_unstable_sampling_mode
label_desc: Use image node_id 3 for calling the TestDiffEqModel obj's underlying member method code with example usage: obj.test_scalar_ode_2_param() and returns: unknown