code: def test_get_sampler_stats_compound(self, caplog):
      # Initialize a very simply toy model
      N = 45
      with pm.Model() as pmodel:
          a = pm.Normal("a")
          b = pm.Uniform("b")
          c = pm.Deterministic("c", a + b)
          ip = pmodel.initial_point()
          shared_a = pm.make_shared_replacements(ip, [a], pmodel)
          shared_b = pm.make_shared_replacements(ip, [b], pmodel)
          stepA = ToyStepper([a], shared_a)
          stepB = ToyStepperWithOtherStats([b], shared_b)
          run, traces = init_traces(
              backend=mcb.NumPyBackend(),
              chains=1,
              expected_length=N,
              step=pm.CompoundStep([stepA, stepB]),
              initial_point=pmodel.initial_point(),
              model=pmodel,
          )
      cra = traces[0]
      assert isinstance(cra, ChainRecordAdapter)
  
      # Simulate recording of draws and stats
      rng = np.random.RandomState(2023)
      for i in range(N):
          tune = i <= 5
          draw = {"a": rng.normal(), "b_interval__": rng.normal()}
          stats = [
              dict(tune=tune, s1=i, accepted=bool(rng.randint(0, 2))),
              dict(tune=tune, s2=i, accepted=bool(rng.randint(0, 2))),
          ]
          cra.record(draw, stats)
  
      # The 'accepted' stat was emitted by both samplers
      assert cra.get_sampler_stats(
          "accepted", sampler_idx=None
      ).shape == (N, 2)
      acpt_1 = cra.get_sampler_stats(
          "accepted", sampler_idx=0, burn=3, thin=2
      )
      acpt_2 = cra.get_sampler_stats(
          "accepted", sampler_idx=1, burn=3, thin=2
      )
      assert acpt_1.shape == (21,)  # (N-3)/2
      assert not np.array_equal(acpt_1, acpt_2)
  
      # s1 and s2 were sampler specific
      # they are squeezed into vectors, but warnings are logged at DEBUG level
      with caplog.at_level(logging.DEBUG, logger="pymc"):
          s1 = cra.get_sampler_stats("s1", burn=10)
          assert s1.shape == (35,)
          assert s1.dtype == np.dtype("float64")
          s2 = cra.get_sampler_stats("s2", thin=5)
          assert s2.shape == (9,)  # N/5
          assert s2.dtype == np.dtype("float64")
      assert any(
          "'s1' was not recorded by all samplers" in r.message
          for r in caplog.records
      )
  
      with pytest.raises(KeyError, match="No stat"):
          cra.get_sampler_stats("notastat")
  
imports: import logging
  import arviz
  import numpy
  import pytest
  import pymc
  from pymc.backends import init_traces
  from pymc.step_methods.arraystep import ArrayStepShared
  from pymc.backends.mcbackend import ChainRecordAdapter, find_data, get_variables_and_point_fn, make_runmeta_and_point_fn
label_desc: Use image node_id 2 for calling the TestChainRecordAdapter obj's underlying member method code with example usage: obj.test_get_sampler_stats_compound(caplog) without return types