Stroop: identifying congruent/incongruent trials

My question pertains to adding in some lines of code to be able to identify when a trial will be congruent or incongruent. I have it set up sequentially so every other trial is incongruent (2, 4, 6 in the series which corresponds to the location of incongruent trials in the conditions file).

I am going to be adding in some code for r peak detection in cardiac phase so that when an r peak is detected, and incongruent stimulus will be shown 250 ms after that r peak. I’ll be able to add that in myself and would appreciate some help on writing a clause to begin and then say if trial dict at position 0 is not congruent, run cardiac code and if it is congruent, continue with the routine. So for example if trial num[1]=congruent, continue routine.

I’d appreciate some wisdom and thank you!

editstroop.py (11.6 KB)
newstroop.xlsx (30.4 KB)