To more easily help address this question, could you please post your afni_proc.py in text, preferably within a "triple backtick codeblock" as described here:
? That will make it much easier to help read and interact with your code.
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.