Changing max_treedepth

I try to change the max_treedepth.
But in sample stats, it is still showing tree_depth =10 for all the data

with Model() as model_pd4:

# Priors for unknown model parameters
alpha_4 = Normal("alpha", mu=np.zeros(48), sigma=np.full(48,5),shape=48)
#beta0 = Normal("beta0", mu=12, sigma=1)
#beta1 = Normal("beta1", mu=18, sigma=1)
s_4 = pm.Exponential('error', 1)

# Expected value of outcome
#mu = alpha + beta0 * X1 + beta1 * X2

# Likelihood (sampling distribution) of observations
Y_obs_4 = Normal("Y_obs",,alpha_4), sigma=s_4, observed=e)

# draw 1000 posterior samples

trace_4 = sample(6000, step=[pm.NUTS(target_accept=0.9,max_treedepth=30)])

Try doing az.plot_posterior(idata, var_names="tree_depth", group="sample_stats"). It is not strange for the tree depth to be quite stable/constant throughout the posterior, moreover, if using a max_treedepth=15 no sample reaches a tree depth of 15, it should be expected to still get no samples over tree depth=15 even if you use max_treedepth=30. It is not that it is ignored but that max_treedepth is a value enforcing a cutoff to avoid samples taking too much time to get.

To see if it is ignored, try using max_treedepth=7 and see if you still get tree depths of ~10.