TypeError: 'float' object is not iterable

Dear Afni experts:

I recently use uber_subject.py to process my BOLD data
following is my cmd.ap file

#!/usr/bin/env tcsh

# created by uber_subject.py: version 1.2 (April 5, 2018)
# creation date: Mon Jan 27 17:34:50 2020

# set subject and group identifiers
set subj  = test
set gname = a1

# set data directory
set top_dir = /Volumes/SSUJU/NTHU_${subj}

# run afni_proc.py to create a single subject processing script
afni_proc.py -subj_id $subj                           \
        -script proc.$subj -scr_overwrite             \
        -blocks tshift volreg blur mask scale regress \
        -dsets $top_dir/${subj}.nii.gz                \
        -tcat_remove_first_trs 10                     \
        -volreg_align_to MIN_OUTLIER                  \
        -blur_size 4.0                                \
        -regress_stim_times $top_dir/sti.txt          \
        -regress_stim_labels                          \
            sti.txt                                   \
        -regress_basis 'BLOCK(20)'                    \
        -regress_censor_motion 0.3                    \
        -regress_motion_per_run                       \
        -regress_make_ideal_sum sum_ideal.1D          \
        -regress_est_blur_epits                       \

and I run the uber_subject.py
Ii seems go well in the process
but finally it shows the following error in the last

apqc_make_tcsh.py -review_style basic -subj_dir . -uvar_json out.ss_review_uvars.json
++ Found 31 files for QCing.
Traceback (most recent call last):
  File "/Users/SJL/abin/apqc_make_tcsh.py", line 821, in <module>
  File "/Users/SJL/abin/lib_apqc_tcsh.py", line 2826, in apqc_warns_cen_stim
    ntr_init_per_stim = list(ntr_init_per_stim)
TypeError: 'float' object is not iterable

Hope anyone can do me a favor, thank you!


That is a bug that I seem to have introduced into the QC part at the end of afni_proc.py (which occurs in the case when 1 stim is used). I have now squashed it and committed the change—thanks for mentioning this.

We will do a build soon to update the binaries, but I can send you a copy of the updated file, as well as instructions for running the final QC part, if you would like.


Hi, Louis-

I edited this post so that your email address would not be directly included here; that might help reduce the chance that you get spammed later, e.g., by bots scraping webpages. (And I have responded both my email in and in the thread.)


Dear Ptaylor,

Really thank to your help.
I am looking forward to your files, and I wish you could teach me how to fix it with your file.

Thank you!


Hi, Louis-

I have sent it. For the benefit of possible future readers of this, I will include much of that text here, including the commands to re-run the APQC.

To regenerate the APQC (afni_proc.py quality control) output, you can re-run the steps that the proc.* script created by afni_proc.py uses; based on the command you copy+pasted, I think the following will do it (the only part you would have to change would be the value of the “subj” variable at the top, but I think you called your subj ID “test”), in a script I called “do_redo_apqc.tcsh” on my computer:


set subj  = test

set thedate = `date +%Y_%m_%d_%H_%M_%S`

if ( -e QC_${subj} ) then
    \mv QC_${subj} QC_${subj}_pre_${thedate} 

apqc_make_tcsh.py                               \
    -review_style  basic                        \
    -subj_dir      .                            \
    -uvar_json     out.ss_review_uvars.json
tcsh @ss_review_html |& tee out.review_html_${thedate}

apqc_make_html.py -qc_dir QC_${subj}

So, you can put do_redo_apqc.tcsh into your “results” directory where afni_proc.py output all your results, and run:

tcsh do_redo_apqc.tcsh

and that should do it.

Note: if you have Python installed on your computer and the “matplotlib” module installed on it, you can run a nicer version of the QC output in “pythonic” style (instead of the default “basic” style). I would strongly recommend having that, as it is a lot nicer and more informative. To have this nicer QC output from afni_proc.py, include the following in your command:
-html_review_style pythonic
(and make sure you have Python with matplotlib). If you want to have the nicer output in your current run, you can change the word “basic” in line 13 of the attached do_redo_apqc.tcsh to be “pythonic”, and run the file in the same way as above.

More about the APQC is described here:
… although there are even newer features that I have to update on the webpage descriptions (such as checking in the “warnings” about too much censoring-- the very change that I made while introducing the current bug…).