Declare priors using loop results in bracket nesting level exceeded maximum

In case anyone else has the same error and stumbles on the same cryptic error message:

The error is caused by the model being “too complex”. Basically, the generated C code for it having too many nested brackets. A for loop, like in this thread, is one easy way of doing so but is by no means the only one.

This is an issue only on Macs, because of the C compiler there being different (clang vs gcc)

This being said, there is an actual solution that does not require rewriting your model: the bracket limit can be increased with a compiler flag that is given to pytensor. Effectively, the only thing needed is adding the following before importing pymc:

import pytensor
pytensor.config.gcc__cxxflags = '-fbracket-depth=512'