Millisecond Forums

Using subject id/number as picture filename

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

By sdandeneau - 7/4/2013

Hi, 


I am running an IAT where the pictures that Subject #1 sees would be (for example) 1X.jpg, 1XX.jpg, and1XXX.jpg. Subject #2 would see 2X.jpg, 2XX.jpg and 2XXX.jpg. Subject#3 3X.jpg, etc... In other words, the "custom" picture list is set by the participant's subject number. 


How do I call the subject# to then incorporate this information in the file name of the stimuli that is presented? 



I was thinking of something like: 


<item targetA>


/1 = "(subjectid)X.jpg"


/2 = "(subjectid)XX.jpg"


/3 = "(subjectid)XXX.jpg"


</item>



I'm not sure what the appropriate code to use to call up "subjectid" information. 


Thanks in advance, 


Stephane

By Dave - 7/4/2013

You need to use the script.subjectid property in an expression in the <picture> element's /select attribute, i.e. compute the correct item numbers for the given id based on that. See http://www.millisecond.com/download/library/v4/IAT/IAT_Multilanguage.iqx for something similar.


Another option is to work with conditional <include>s. You will find this covered in the language reference for the <include> element and its /precondition attribute as well as e.g. http://www.millisecond.com/forums/Topic10316.aspx#10316.

By sdandeneau - 7/5/2013

Hi Dave, 


Thanks for the reply! If I understand your solution correctly, you're suggesting something along the lines of (assuming I present 4 items/pictures to each subject) "if subject = 1 then select items 1, if subject = 2, then start using item# 5 onwards, if subject = 3, then start using item#9 onwards etc... ). If "targetA" is my list of pictures, it would something like this: 


<items targetA>


/1 = "1a.jpg"


/2 = "1b.jpg"


/3 = "1c.jpg"


/4 = "1d.jpg"


/5 = "2a.jpg"


/6 = "2b.jpg"


/7 = "2c.jpg"


/8 = "2d.jpg"


/9 = "3a.jpg"


/10 = "3b.jpg" 


/11 = "3c.jpg"


/12 = "3d.jpg"


My only concern is that I would have a very long list of items in targetA, i.e. 4 items x 100 subjects = 400 items. Am I understanding your solution correctly?


Also, I haven't quite figured out how to use the script.subjectid in the "select" expression. Can you give me an example of that component?


I've named my pictures Xa.jpg, Xb.jpg, Xc.jpg, and Xd.jpg (where X = subject number) in my folder. I was hoping that I would simply call up the subjectid and use this information to call up the appropriate pictures for that subject. Example, items = "sujbectid"+a.jpg, "subjectid"+b.jpg, "subjectid"+c.jpg, "subjectid"+d.jpg. 


One option I have gotten to work is using the <include> expressions - where I create an .iqx file for each subject (e.g. subject 1 has "targetA = 1a.jpg, 1b.jpg" etc., subject2's iqx file is targetA=2a.jpg, 2b.jpg,2c.jpg etc"  and "include" the appropriate subject.iqx file at run time. E.g. if subject = 1, use subject1.iqx (which contains 1a.jpg, 1b.jpg etc). However in this case I'd have to create a 100 iqx file (one for each subject) - which again might not be so efficient. 


Thanks in advance, 


Stephane



By Dave - 7/5/2013

Am I understanding your solution correctly?


Yes, as far as I can see.


Also, I haven't quite figured out how to use the script.subjectid in the "select" expression. Can you give me an example of that component?


See the scripts / links in my previous reply. Whether you use the subject id or a language selected from a given list does not make any major difference.


I've named my pictures Xa.jpg, Xb.jpg, Xc.jpg, and Xd.jpg (where X = subject number) in my folder. I was hoping that I would simply call up the subjectid and use this information to call up the appropriate pictures for that subject.


See the resources re. conditional <include> elements in my previous reply. You will not be able to construct file names at runtime / on the fly. Inquisit must make sure all required files actually exist prior to executing the script, otherwise you'd run into major runtime problems in case something is missing.


However in this case I'd have to create a 100 iqx file (one for each subject) - which again might not be so efficient. 


Well yes, that stuff has to go somewhere.

By sdandeneau - 7/5/2013

Hi, 


This is great! Thanks for the help! I've got the conditional <include> to work. Still working on the <select> option. One last question, I'll be running the script with inquisit web - in the web tests I've done so far, it takes about 30s to load the script online and start the experiment. I'm guessing it might be the pictures that it needs to run? I've noticed that my pictures are a little big (about 1.3 MB each) - I'll reduce their resolution. Will one strategy (condition vs. select) be more efficient? I'm assuming the <select> option loads all the pictures since you list all the items in the list (in this case I'll have about 400), but does the conditional include only load the pictures it will use (about 10 total)? I'm thinking it would be a lot faster and more efficient to load the 10 pictures instead of 400 and only use 10. Bottom line, which strategy is best for using with inquisit web?


Thanks in advance, 


stephane

By Dave - 7/5/2013

The <include> option is the one to go for. Note that reducing file sizes as much as possible is nevertheless necessary, as Inquisit needs to download all required files to the client machine prior to starting the actual script. The less data there is to download, the better and faster things will work.

By sdandeneau - 7/7/2013

Got it! <include> it is then. Thanks a lot!


stephane