By patruvius - 3/26/2013
I have tried to modify a script posted by Dave on this topic and despite using the list element and the counter element have not been able to find a solution.
Using the counter I get overlap of images despite my use of the not operator so possibly some simple error on my behalf - script below.
Using the list element I can get flawless displays, but cannot find out how to determine where the X image is placed on each iteration, so that I can use that to attach a target image in the second phase of the trial.
Counter Script:
<defaults> / screencolor = (0,0,0) / fontstyle = ("Arial", 20pt) </defaults>
<block myblock> / trials = [1=mytrial] </block>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Trial presents one type 1 stimulus and four type 2 stimuli +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<trial mytrial> / stimulustimes = [1= fixation,pic1,pic2,pic3,pic4,xpos] / validresponse = (anyresponse) / ontrialend = [reset(counter.type1xpos,counter.type1ypos,counter.type2xpos,counter.type2ypos,counter.type3xpos,counter.type3ypos,counter.type4xpos,counter.type4ypos)] </trial>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ There will 16 possible displays for a 2x2 matric with 4 different images +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <text fixation> / items = ("+") / color = white / txbgcolor = (0,0,0) / fontstyle = ("Arial", 30pt) / erase = false </text> <picture pic1> /items= ("letter X.png") / vposition = counter.type1xpos.selectedvalue / hposition = counter.type1ypos.selectedvalue </picture> <picture pic2> /items= ("letter H.png") / vposition = counter.type2xpos.selectedvalue / hposition = counter.type2ypos.selectedvalue </picture> <picture pic3> /items= ("letter I.png") / vposition = counter.type3xpos.selectedvalue / hposition = counter.type3ypos.selectedvalue </picture> <picture pic4> /items= ("letter T.png") / vposition = counter.type4xpos.selectedvalue / hposition = counter.type4ypos.selectedvalue </picture>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Four candidate positions for pic1 stimulus (25% & 75%)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type1xpos> / items = (25%,25%,75%,75%) / select = noreplace </counter> <counter type1ypos> / items = (25%,25%,75%,75%) / select = noreplace </counter>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Candidate positions for pic2 stimuli (all positions but *not* the one already chosen for pic1 stimulus) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type2xpos> / items = (25%,25%,75%,75%) / not = (type1xpos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (25%,25%,75%,75%) / not = (type1ypos) / select = noreplace / selectionrate = always </counter> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Candidate positions for pic3 stimuli (all positions but *not* the ones already chosen for pic1 or pic2 stimulus) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type3xpos> / items = (25%,25%,75%,75%) / not = (type1xpos,type2xpos) / select = noreplace / selectionrate = always </counter> <counter type3ypos> / items = (25%,25%,75%,75%) / not = (type1ypos,type2ypos) / select = noreplace / selectionrate = always </counter> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Candidate positions for pic3 stimuli (all positions but *not* the ones already chosen for pic1, pic2 or pic3 stimulus) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type4xpos> / items = (25%,25%,75%,75%) / not = (type1xpos,type2xpos,type3xpos) / select = noreplace / selectionrate = always </counter> <counter type4ypos> / items = (25%,25%,75%,75%) / not = (type1ypos,type2ypos,type3ypos) / select = noreplace / selectionrate = always </counter> *********************** debug message *************************
<text xpos> / items= (" X hposition = <% picture.pic1.hposition %> and vpos is <% picture.pic1.vposition %>")
</text>
List controlled counter
<defaults> / screencolor = (0, 0, 0) / fontstyle = ("Arial", 20pt) </defaults> *************************** Display Items **************************** <text fixation> / items = ("+") / color = white / txbgcolor = (0,0,0) / fontstyle = ("Arial", 30pt) / erase = false </text>
<item fourdistractors > /1 = "letter X.png" /1 = "letter H.png" /2 = "letter I.png" /3 = "letter T.png" </item> <picture fourd01> /items = fourdistractors /select = fourd01counter /position = (25%,25%) /erase = true(black) /transparentcolor = (black) </picture>
<picture fourd02> /items = fourdistractors /select = fourd02counter /position = (25%,75%) /erase = true(black) /transparentcolor = (black) </picture>
<picture fourd03> /items = fourdistractors /select = fourd03counter /position = (75%,25%) /erase = true(black) /transparentcolor = (black) </picture>
<picture fourd04> /items = fourdistractors /select = fourd04counter /position = (75%,75%) /erase = true(black) /transparentcolor = (black) </picture>
*********************** Counters for 4 distractors *********************** <list fourd01counter> /items = (1,2,3,4) </list>
<list fourd02counter> /items = (1,2,3,4) /not = (fourd01counter) </list>
<list fourd03counter> /items = (1,2,3,4) /not = (list.fourd01counter.nextvalue, list.fourd02counter.nextvalue) </list>
<list fourd04counter> /items = (1,2,3,4) /not = (list.fourd01counter.nextvalue, list.fourd02counter.nextvalue,list.fourd03counter.nextvalue) / selectionrate = trial </list>
************************* Trials **************************** <trial displayone> / stimulustimes = [0=fixation; 500=fourd01,fourd02,fourd03,fourd04] / timeout= 3500 </trial>
******************************* Blocks ******************************** <block jayblockone> / trials = [1=displayone] / bgstim = (fixation) </block>
**************************** Experiment ****************************
<expt>
/ blocks = [1=jayblockone]
</expt> ******************************** debugging messages ********************************
With thanks,
Patrick
|
By patruvius - 3/26/2013
Actually, belatedly, I think I understand, why the not operation fails.
It is operating on the x,y co-ordinates separately, hence not pic1 x coordinate if it was 25% will only allow 75% in the grid and so on. I suppose the x,y combined coordinate is what must be unique for each picture, but I still cannot work out how that can be done.
Perhaps use the position parameter with an enclosed expression. I'll try that ,,,,
|
By Dave - 3/26/2013
It is operating on the x,y co-ordinates separately, hence not pic1 x coordinate if it was 25% will only allow 75% in the grid and so on. I suppose the x,y combined coordinate is what must be unique for each pictur
Yes.
but I still cannot work out how that can be done
You'll want to define a dependency between the respective x and y counters *and* make the values unique:
<counter type1xpos> / items = (25.0000%,25.0001%,75.0000%,75.0001%) / select = noreplace </counter>
<counter type1ypos> / items = (25.0000%,75.0000%,25.0000%,75.0000%) / select = current(type1xpos) </counter>
etc.
|
By patruvius - 4/1/2013
Thank you for this Dave, but I am going to need a bit more guidance if you have the time.
I have tried to implement your suggestion here but still get clashes so I am obviously not making the selection unique.
I have tried to understand the select current (countername) but the documented example of presidents and vice-presidents did not help as I cannot see how that works without seeing the item list.
In my case if the current x coordinate selected is 25.001 then a choice of any of the others seems possible.
Reading the documentation on the /not property has not helped me either.
Your comment of defining dependency and making unique values seemed clear and a guiding light for me, but implementing seemed as difficult as understanding recursion.
Any other tips gratefully received.
Latest relevant code:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Candidate positions for pic2 stimuli (all positions but *not* the one already chosen for pic1 stimulus) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type2xpos> / items = (25.0000%,25.0001%,25.0002,75.0000%,75.0001%,75.0002%) / not = (type1xpos,type1ypos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (25.0000%,75.0000%,25.0000%,75.0000%,25.0000%,75.0000%) / not = (type1ypos,type1xpos) / select = current(type2xpos) / selectionrate = always </counter>
BTW when the display of the current position of X is created, sometimes the x co-ordinate may be something like 25.00000000000000097344445555.
How does that work?
With great appreciation for your help as always.
Patrick
|
By Dave - 4/1/2013
<counter type2xpos> / items = (25.0000%,25.0001%,25.0002,75.0000%,75.0001%,75.0002%) / not = (type1xpos,type1ypos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (25.0000%,75.0000%,25.0000%,75.0000%,25.0000%,75.0000%) / not = (type1ypos,type1xpos) / select = current(type2xpos) / selectionrate = always </count
Patrick,
note the differences between your previous example and your current code. The above counters effectively contain the same position multiple times, so of course things will clash.
BTW when the display of the current position of X is created, sometimes the x co-ordinate may be something like 25.00000000000000097344445555. How does that work?
Computers have no concept of real (in the mathematical sense) numbers. They deal in binary. Floating point representations of reals are thus subject to rounding error and imprecision.
|
By patruvius - 4/2/2013
Thanks again Dave.
I feel you are teaching the village idiot how to fish rather than throwing him a fish and I appreciate this.
I assume you indicate with the red text that these are the redundant entries. I just don't see what you mean by the same position multiple times.
If I give my narrative of how I understand it to work, you may see where my thinking is awry.
Using your hints, my current code runs correctly over ten tests for just two of the images, however as soon as I extend it to three pictures collisions abound.
<counter type1xpos> / items = (25.0000%,25.0001%,75.0000%,75.0001%) / select = noreplace </counter> <counter type1ypos> / items = (25.0000%,75.0000%,25.0000%,75.0000%) / select = current(type1xpos) </counter>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Candidate positions for pic2 stimuli (all positions but *not* the one already chosen for pic1 stimulus) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<counter type2xpos> / items = (25.0001%,25.0001%,75.0001%,75.0001%) / not = (type1xpos,type1ypos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (75.0000%,75.0000%,25.0000%,25.0000%) / not = (type1ypos,type1xpos) / select = current(type2xpos) / selectionrate = always </counter>
CORRECTION: Testing again, there were collisions.
If I just leave the items in red, not understanding why they don't create the same position multiple times, I get collisions even more frequently.
I am wandering blind and just throwing my line in without really knowing how to bait the hook as I am simply not getting this basic concept of creating unique positions.
I have tried introducing new positions to strive for 'different' positions, eg 25.0003 and 25.0004 etc., but this doesn't appear to work either.
Also I am not getting how the select = current(type2xpos) works.
When I look at the example in the documentation,
<text vicepresidents> / items = vicepresidentitems / select = current(presidents) </text>
The following first selects Jefferson, then Adams, and then Washington:
<text presidents> / items = ("George Washington", "John Adams", "Thomas Jefferson") / select = sequence(3, 2, 1) </text>
my understanding is that the vicepresidentitems would look something like:
<text vicepresidents>
<items = ( "Adams", "Jefferson","Burr")
</text>
Hence at first choice, current(presidents) returns 3, this then is the selection from vicepresidentlist, #3 - Burr ?
So extending this to picking a vposition after choosing a hposition, if say 25.001 was chosen at the second position, then
/select = current(type2xpos), looks for the second choice in the list, say 75% in the above example, ignoring for the moment the red text.
Is that correct?
I can't rationally proceed until I know if I am on the right track with this or totally lost at sea.
Any life lines handy Dave?
Patrick
(Thanks for the explanation on the floating point representations, that made sense.)
|
By patruvius - 4/2/2013
Late Press:
This code produced no collisions over 20 tests:
<counter type2xpos> / items = (25.0001%,25.0001%,75.0001%,75.0001%) / not = (type1xpos,type1ypos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (75.0000%,25.0000%) / not = (type1ypos,type1xpos) / select = current(type2xpos) / selectionrate = always </counter>
However, extending what I thought I had "seen" to the third image co-ordinates resulted in multiple collisions again. :-(
|
By Dave - 4/2/2013
Here's a short, fully functional snippet that should hopefully be helpful. It's just a straightforward extension of the original example script to two dimensions (x and y coordinates instead of x coordinates only):
<block myblock> / trials = [1-4=mytrial] </block>
<trial mytrial> / pretrialpause = 500 / stimulusframes = [1=type1,type2a,type2b,type2c] / validresponse = (57) / ontrialend = [reset(counter.type2xpos)] </trial>
<text type1> / items = ("Type 1") / hposition = counter.type1xpos.selectedvalue / vposition = counter.type1ypos.selectedvalue </text>
<text type2a> / items = ("Type 2a") / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue </text>
<text type2b> / items = ("Type 2b") / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue </text>
<text type2c> / items = ("Type 2c") / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue </text>
<counter type1xpos> / items = (25.0000%, 25.0001%, 75.0000%, 75.0001%) / select = noreplace / selectionrate = trial </counter>
<counter type1ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type1xpos) </counter>
<counter type2xpos> / items = (25.0000%, 25.0001%, 75.0000%, 75.0001%) / select = noreplace / not = (type1xpos) / selectionrate = always </counter>
<counter type2ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type2xpos) </counter>
|
By patruvius - 4/3/2013
Thank you so much Dave. Of course it works perfectly for my situation. Sorry I was so obtuse about getting to grips with the principles here. If you were British, I would recommend you for a knight hood.
Patrick
|
By Dave - 4/3/2013
Sorry I was so obtuse about getting to grips with the principles here.
Absolutely no need to be sorry. I wish I could have made what I meant clearer from the get-go, but I couldn't quite put my finger on where the actual problem / misunderstanding was (I'm still not sure, really). Anyway, if you need me to elaborate on anything, let me know.
If you were British, I would recommend you for a knight hood.
That would mean I'd have to rescue maidens and slay dragons in the process, wouldn't it? Thanks, but I'll give this a pass. I'm not good with swords... :-)
Cheers,
~Dave
|
By patruvius - 4/7/2013
I just thought Sir Dave had a nice ring to it.
Need your help again though when I really thought I was on clear water.
I need to place a target image (rather one of two over where the X was in the first display. No problems.
Congruent images are placed over most recent position of X Incongruent trials place the target images other than where X has last been positioned Using list counters to position images in either congruent positions on non-congruent positions ********************************************************* <item targets> /1 = "target horizontal.png" /2 = "target vertical.png" </item> <picture twotargets> /items = targets /select = twotargetscounter /position = (type1xpos,type1ypos) /erase = true(black) /transparentcolor = (black) </picture>
<list twotargetscounter> /items = (1,2) </list>
Then i need to place other distractor images where the letters H, I, and T were but in no particuar arrangement as long as they don't land on the target image.
I have tried to use the picture.pic2.hposition etc to replace those positions with the new images and I have tried to use the original counter , using counter.pics. selected values
eg.
<picture rightslash2> /items =("Right 45 distracter.png") /hposition = counter.type2xpos.selectedvalue /vposition = counter.type2ypos.selectedvalue </picture>
even using screen messages to try and match up these positions doesn't bear a relationship with the actual positions of the original H, T and I images.?
<text ipos> / items= (" I position = <% counter.type2xpos.selectedvalue %> ,<% counter.type2ypos.selectedvalue %>") / position = (20%,35%) </text> or
<text ipos> / items= (" I position = <% picture.pic3.hposition %> ,<% picture.pic3.vposition %>") / position = (20%,35%) </text>
nether gives reliable results.
Any ideas?
regards,
Vassal patrick
|
By Dave - 4/7/2013
You should *not* reuse the 2nd counter. Its selection rate is set to 'always', i.e., every time you access it, a new sample will be drawn.
The code is too incomplete for me to say anything more specific about it. If you could assemble a minimal, runnable example (just enough to convey the core logic; please use <text> elements only, I don't have your picture files), I may be able to give you a more useful answer.
|
By Dave - 4/7/2013
Then i need to place other distractor images where the letters H, I, and T were but in no particuar arrangement as long as they don't land on the target image.
Note that this is exaclty the same as the initial question (placing a target, placing other elements excluding target position). I.e. the exact same solution applies:
<counter distractorxpos> / items = (25.0000%, 25.0001%, 75.0000%, 75.0001%) / select = noreplace / not = (type1xpos) / selectionrate = always </counter>
<counter distractorypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(distractorxpos) </counter>
with your 3 distractor elements getting their postiions from the above counters.
|
By patruvius - 4/8/2013
Dave,
below is the code of a text based stimulli.
What happens with this is that the target or rather one of two targets always lands where the X was. So far so good.
Then I try placing one of the distractors - good, not on X but elsewhere.
Second distractor also good
Final distractor - clashes all over the place - on top of X or other distractors ????
<defaults> / screencolor = (0,0,0) / fontstyle = ("Arial", 30pt) / txcolor = white </defaults>
<block myblock> / trials = [1=mytrial] </block>
<trial mytrial> / stimulustimes = [1= fixation,txt1,txt2,txt3,txt4 ;500=twotargets,distractor1,distractor2,distractor3] / validresponse = (anyresponse) </trial>
<text fixation> / items = ("+") / erase = false / txbgcolor = black </text> <text txt1> / items = ("X") / txbgcolor = black / hposition = counter.type1xpos.selectedvalue / vposition = counter.type1ypos.selectedvalue / erase = true(black) </text> <text txt2> / items = ("H") / txbgcolor = black / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue / erase = true(black) </text> <text txt3> / items = ("I") / txbgcolor = black / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue / erase = true(black) </text> <text txt4> / items = ("T") / txbgcolor = black / hposition = counter.type2xpos.selectedvalue / vposition = counter.type2ypos.selectedvalue / erase = true(black) </text> <counter type1xpos> / items = (25.0000%, 25.0001%, 75.0000%, 75.0001%) / select = noreplace </counter> <counter type1ypos> / items = (25.0000%,75.0000%,25.0000%,75.0000%) / select = current(type1xpos) </counter> <counter type2xpos> / items = (25.0000%, 25.0001%, 75.0000%, 75.0001%) / not = (type1xpos) / select = noreplace / selectionrate = always </counter> <counter type2ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type2xpos) / selectionrate = always </counter> <counter type3xpos> / items = (25.0000%, 25.0001%,75.0000%,75.0001%) / not = (type1xpos,type2xpos) / select = noreplace / selectionrate = always </counter> <counter type3ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type3xpos) / selectionrate = always </counter> <counter type4xpos> / items = (25.0000%, 25.0001%,75.0000%,75.0001%) / not = (type1xpos,type2xpos,type3xpos) / select = noreplace / selectionrate = always </counter> <counter type4ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type3xpos) / selectionrate = always </counter> +++++++++++++++++++++++++++++++++++ target placement +++++++++++++++++++++++++++++++++++
<item targets> /1 = "|" /2 = "-" </item> <text twotargets> /items = targets / txbgcolor = black /select = twotargetscounter /position = (type1xpos,type1ypos) /erase = true(black) </text> <list twotargetscounter> /items = (1,2) </list> +++++++++++++++++++++++++++++++++ Distractor placement +++++++++++++++++++++++++++++++++ <text distractor1> / items = ("/") / txcolor = red / txbgcolor = white /select = distractorxpos / hposition = (counter.distractorxpos.selectedvalue) / vposition = (counter.distractorypos.selectedvalue) </text> <text distractor2> / items = ("/") / txcolor = black / txbgcolor = red /select = distractorxpos2 / hposition = (counter.distractorxpos.selectedvalue) / vposition = (counter.distractorypos.selectedvalue) </text> <text distractor3> / items = ("\") / txcolor = yellow / txbgcolor = green /select = distractorxpos3 / hposition = (counter.distractorxpos.selectedvalue) / vposition = (counter.distractorypos.selectedvalue) </text>
<counter distractorxpos> / items = (25.0000,25.0001, 75.0000, 75.0001) / select = noreplace / not = (type1xpos) / selectionrate = always </counter> <counter distractorypos> / items = (25.0000%, 75.0000%,25.0000%,75.0000%) / select = current(distractorxpos) </counter> <counter distractorxpos2> / items = (25.0000,25.0001, 75.0000, 75.0001) / select = noreplace / not = (type1xpos,type2xpos) / selectionrate = always </counter> <counter distractorypos2> / items = (25.0000%, 75.0000%,25.0000%,75.0000%) / select = current(distractorxpos2) </counter> <counter distractorxpos3> / items = (25.0000,25.0001, 75.0000, 75.0001) / select = noreplace / not = (type1xpos,type2xpos,type3xpos) / selectionrate = always </counter> <counter distractorypos3> / items = (25.0000%, 75.0000%,25.0000%,75.0000%) / select = current(distractorxpos3) </counter>
Note: with the /not property, i have tried using the other distractor positions to exclude,
eg /not = (type1xpos, distractorxpos, distractorxpos2) for no difference in results.
This is all for the congruent trials where the target will be positioned over the X, but in incongruent trials the target(s) must not sit over the X, and in specifying the position of the target as I have for the congruent trials there is no equivalent property of an element such as hposition = not(type1xpos) is there?
Thanks again Dave for sticking with me with this it is driving me particularly batty.
At present I am at a place with little cell phone and therefore mobile broadband connection, so I have had to drive my car about 20km (sorry 15 miles) to another town where there is some connection.
The joys of country living in Australia.
Patrick
|
By Dave - 4/8/2013
<counter type4ypos> / items = (25.0000%, 75.0000%, 25.0000%, 75.0000%) / select = current(type3xpos) / selectionrate = always </counter>
Wrong dependency. You are also omitting the necessary reset() of certain counters /ontrialend. Please refer to my example for that.
|
By patruvius - 4/10/2013
Thank you, thank you Dave. I got this last night, drove home to try it and of course it works beautifully.
I now have all three components of the puzzle working - distractor, congruent (over X) and incongruent trials (not over X) working and can now possibly get back to my holiday.
I am very grateful as always. Inquisit would be impossible for me without you. I struggle for obvious intellectual deficits, but also because I only get asked occasionally for help with coding as most people here use pre-existing examples or simple questionnaire type applications.
I would like to do more and although I enjoy my interaction with Sir Dave, I would like to be more self reliant too.
cheers,
Patrick
|
|