Millisecond Forums

A few things not working properly. And flicker.

https://forums.millisecond.com/Topic4488.aspx

By Blackadder - 5/18/2010

Hi All,


consider the attached script. There are a few things not functional here.



(1) Fixation cross flickers between trials TRIAL_refset and TRIAL_probe.


There is not a single "erase=true" statement in the entire script. However, the fixation cross (or text in this demo script) flickers at the switch between TRIAL_refset and TRIAL_probe. Since we are doing an EEG experiment, the flicker yields EEG activity which we'd rather avoid.



(2) A second port stimulus in trial TRIAL_refset has no effect.


Issue (1) could be circumvented by integrating TRIAL_refset and TRIAL_probe into one trial. The latter should look like


<trial TRIAL_refset>
/ iscorrectresponse = [((values.iIdent==0) && (trial.TRIAL_probe.response==203))||((values.iIdent==1) && (trial.TRIAL_probe.response==205))]
/ responseinterrupt = trial
/ responsetime = 2250
/ responsetrial = (anyresponse, TRIAL_response)
/ responsetrial = (noresponse, TRIAL_response)
/ stimulustimes = [0 = SHAPE_blank,PIC_fix,TEXT_debugstring;
1500=PORT_refset,PIC_ref_p01,PIC_ref_p02,PIC_fix; 3000=SHAPE_blank,PIC_fix; 4500=PORT_probe,SHAPE_blank,PIC_ref_p03; 5250=SHAPE_blank]
/ timeout = 8250
/ validresponse = (203,205,noresponse)
</trial>


Unfortunately, PORT_probe is not set in this case.



(3) Inquisit allows only for some none-consecutive numbers in an <item>.


The port triggers need to be computed at runtime since they encode some important trial properties. Since I wasn't aware of a way to send integer values to a port, I decided to realize a translation table "integer -> binary" via an item. The various integer codes used throughout the script are not consecutive, hence I originally planned to define the <item> like this:


<item ITEM_portsignals>
/  1 = "00000001"
/  2 = "00000010"
/  3 = "00000011"
/ 11 = "00001011"
/ 12 = "00001100"
/ 13 = "00001101"
/ 14 = "00001110"
/ 15 = "00001111"
/ 16 = "00010000"
/ 21 = "00010101"
/ 22 = "00010110"
/ 23 = "00010111"
/ 24 = "00011000"
/ 25 = "00011001"
/ 26 = "00011010"
/ 31 = "01101111"
/ 32 = "01110000"
/ 33 = "01110001"
/ 34 = "01110010"
/ 35 = "01110011"
/ 36 = "01110100"
/ 41 = "01111001"
/ 42 = "01111010"
/ 43 = "01111011"
/ 44 = "01111100"
/ 45 = "01111101"
/ 46 = "01111110"
</item>


Inquisit does not issue an error when I do so. During runtime, while the following expressions work:


getitem(ITEM_portsignals,1)
getitem(ITEM_portsignals,11)
getitem(
ITEM_portsignals,26)


these do not but issue a script error:


getitem(ITEM_portsignals,31)
getitem(ITEM_portsignals,46)



Any clues on any of these?


Bye, Malte.

By Dave - 5/18/2010

(1) Fixation cross flickers between trials TRIAL_refset and TRIAL_probe.


There is not a single "erase=true" statement in the entire script. However, the fixation cross (or text in this demo script) flickers at the switch between TRIAL_refset and TRIAL_probe. Since we are doing an EEG experiment, the flicker yields EEG activity which we'd rather avoid.


There is no TRIAL_refset in the script you attached. Also, I'm not seeing any flickers.


(2) A second port stimulus in trial TRIAL_refset has no effect.


Issue (1) could be circumvented by integrating TRIAL_refset and TRIAL_probe into one trial. The latter should look like


<trial TRIAL_refset>
/ iscorrectresponse = [((values.iIdent==0) && (trial.TRIAL_probe.response==203))||((values.iIdent==1) && (trial.TRIAL_probe.response==205))]
/ responseinterrupt = trial
/ responsetime = 2250
/ responsetrial = (anyresponse, TRIAL_response)
/ responsetrial = (noresponse, TRIAL_response)
/ stimulustimes = [0 = SHAPE_blank,PIC_fix,TEXT_debugstring;
1500=PORT_refset,PIC_ref_p01,PIC_ref_p02,PIC_fix; 3000=SHAPE_blank,PIC_fix; 4500=PORT_probe,SHAPE_blank,PIC_ref_p03; 5250=SHAPE_blank]
/ timeout = 8250
/ validresponse = (203,205,noresponse)
</trial>


Unfortunately, PORT_probe is not set in this case.


See response to (1). Offhand though, I'd say introducing a proper <port erase> before sending the second trigger could help.


(3) Inquisit allows only for some none-consecutive numbers in an <item>.


The port triggers need to be computed at runtime since they encode some important trial properties. Since I wasn't aware of a way to send integer values to a port, I decided to realize a translation table "integer -> binary" via an item. The various integer codes used throughout the script are not consecutive, hence I originally planned to define the <item> like this:


<item ITEM_portsignals>
/  1 = "00000001"
/  2 = "00000010"
/  3 = "00000011"
/ 11 = "00001011"
/ 12 = "00001100"
/ 13 = "00001101"
/ 14 = "00001110"
/ 15 = "00001111"
/ 16 = "00010000"
/ 21 = "00010101"
/ 22 = "00010110"
/ 23 = "00010111"
/ 24 = "00011000"
/ 25 = "00011001"
/ 26 = "00011010"
/ 31 = "01101111"
/ 32 = "01110000"
/ 33 = "01110001"
/ 34 = "01110010"
/ 35 = "01110011"
/ 36 = "01110100"
/ 41 = "01111001"
/ 42 = "01111010"
/ 43 = "01111011"
/ 44 = "01111100"
/ 45 = "01111101"
/ 46 = "01111110"
</item>


Inquisit does not issue an error when I do so. During runtime, while the following expressions work:


getitem(ITEM_portsignals,1)
getitem(ITEM_portsignals,11)
getitem(
ITEM_portsignals,26)


these do not but issue a script error:


getitem(ITEM_portsignals,31)
getitem(ITEM_portsignals,46)


AFAIK, the  '/ 1', etc. in your <item> element doesn't actually mean anything to Inquisit's parser -- it will simply construct sequential item indexes based on the total number of item entries contained in the <item> element. This means 'getitem(ITEM_portsignals,4)' will return your '/ 11',  while 'getitem(ITEM_portsignals,11)' will return your '/ 22'. The latter expressions fail because they're out of index (i.e. there is no item no. 46). Workaround: Fill in the blank spots with empty entries.


Cheers,


~Dave


By Dave - 5/18/2010

P.S.: BTW, you do realize that '/ erase = true' is actually the default setting, don't you? I.e. you have to *explicitly* declare '/ erase = false' for all your stims.


~Dave

By Blackadder - 5/19/2010

Script has been fixed, trial TRIAL_refset was erroneously named TRIAL_main.

By Blackadder - 5/19/2010

Dave, you've once again been helpful. Amending all stimuli (except the <port> stimuli, of course) with /erase=false did the trick - no more flickering.


I am not quite sure, however, what you mean by sending a proper <port erase> command.



And for the item issue: filling the item with dummy entries was what I eventually came up with. Thank god lpt is only 8 bits.



Bye, Malte.

By Dave - 5/19/2010

Dave, you've once again been helpful


I live to serve...;-)


I am not quite sure, however, what you mean by sending a proper <port erase> command.


For the case of 'PORT_Probe' not being sent out, I'd try introducing yet another port signal in between 'PORT_refset' and 'PORT_probe' which would set all bits to low again


<port PORT_erase>
/ items = ("00000000")
[...]
</port>


yielding something like


<trial
TRIAL_refset>
/ iscorrectresponse = [((values.iIdent==0)
&& (trial.TRIAL_probe.response==203))||((values.iIdent==1)
&& (trial.TRIAL_probe.response==205))]
/ responseinterrupt =
trial
/ responsetime = 2250
/ responsetrial = (anyresponse,
TRIAL_response)
/ responsetrial = (noresponse, TRIAL_response)
/
stimulustimes = [0 = SHAPE_blank,PIC_fix,TEXT_debugstring;
1500=PORT_refset,PIC_ref_p01,PIC_ref_p02,PIC_fix;
3000=SHAPE_blank,PIC_fix,PORT_erase; 4500=PORT_probe,SHAPE_blank,PIC_ref_p03;
5250=SHAPE_blank]
/ timeout = 8250
/ validresponse =
(203,205,noresponse)
</trial>


Make sense?


~Dave

By Blackadder - 5/19/2010

Perfectly, I'll try that and let you know. But since this is coming from you, I have good faith [I]

By Dave - 5/19/2010

But since this is coming from you, I have good faith


BAD mistake. Everyone knows I can't be trusted. But seriously, I'm not sure my suggestion will do the trick. Troubleshooting port issues is a major pain, IMO.


~Dave

By Dave - 5/20/2010

Any progress / new insights regarding the port issue?


~Dave

By Blackadder - 5/20/2010

Hi Dave,


not yet. I got no access to the gadget that's recording the lpt signals and the colleague who has will not be in before Monday, I'll report as soon as I know something. Let's hope the best, I'm off to Serbia until Tuesday.


Bye, Malte.

By Dave - 5/21/2010

Since I wasn't aware of a way to send integer
values to a port, [...]


What the hell, we might just come up with a way for the fun of it:


How to convert the answer to life, the universe and everything to 8 bit binary?


*********************************************
* Start Function: Convert Decimal to Binary *
*********************************************


<values>
/ dec = 42
/ bit = 0
/ nbits = 8
/ binarystring = ""
/ loopcount = 0
</values>

<expressions>
/ dec2bin = if(values.dec>=0 && values.loopcount<values.nbits)
    {
    values.loopcount=values.loopcount+1;
    values.bit=values.dec-(2*(ipart(values.dec/2)));
    values.binarystring=concat(values.bit,values.binarystring);
    values.dec=ipart(values.dec/2);
    expressions.dec2bin;
    }
</expressions>

<text mybinarystring>
/ items = ("<%values.binarystring%>")
</text>

<trial mytrial>
/ ontrialbegin = [values.binarystring=""; values.loopcount=0; expressions.dec2bin]
/ stimulusframes = [1=mybinarystring]
/ validresponse = (anyresponse)
</trial>


*******************************************

* End Function: Convert Decimal to Binary *

*******************************************



It's a bit bulky, I know. But hey, it get's the job done... And since I can't let this slide, here's some code for the reverse conversion:


*********************************************
*
Start Function: Convert Binary to Decimal *
*********************************************


<values>
/ dec = 0
/ bit = 0
/ binarystring = "00101010"
/ pos = 0
</values>

<expressions>
/ bin2dec = if(values.pos<length(values.binarystring))
    {
    values.bit=substring(values.binarystring,values.pos,1);
    values.dec=values.dec*2+values.bit;
    values.pos=values.pos+1;
    expressions.bin2dec;
    }
</expressions>

<text mydecimal>
/ items = ("<%values.dec%>")
</text>

<trial mytrial>
/ ontrialbegin = [values.dec=0; values.pos=0; expressions.bin2dec]
/ stimulusframes = [1=mydecimal]
/ validresponse = (anyresponse)
</trial>


*******************************************

* End Function: Convert Binary to Decimal *

*******************************************


Cheers,


~Dave