There are many choices one could make in modeling this data with this prior. But here’s a pretty straightforward implementation of what you have described:
import pymc3 as pm
import numpy as np
import arviz as az
import matplotlib.pyplot as plt
prior = np.array([20.5,15.25,5.0,29.0,11.75,8.5,8.25,14.5,14.25,
23.25,31.75,44.5,9.75,2.75, 14.25, 7.0])
# we'll throw away this data and instead use a normal
# prior with mean of np.mean(prior)=16.265625
# and a SD of np.std(prior)=10.784634885306735
data = np.array([27, 20.75, 24.5])
with pm.Model() as model:
mean = pm.Normal('mean',
mu=prior.mean(),
sigma=.5*prior.std())
sigma = pm.Gamma('sigma',
alpha=prior.std(),
beta=1)
likelihood = pm.Normal('likelihood',
mu=sigma,
sigma=sigma,
observed=data)
trace = pm.sample(return_inferencedata=True)
az.plot_trace(trace)
plt.show()