Raise KeyError("Unknown variable %s" % var), KeyError: "Unknown variable

Sorry but I don’t really understand your code. How did you define sigma_obs? Could you expand your code to get a minimum, self contained example that produces the error you saw?