Reading subject-specific stimuli from files


Author
Message
MichaelH
MichaelH
Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)
Group: Forum Members
Posts: 13, Visits: 1
We are trying to program a categorization speed task that uses idiographic words that participants have identified as positive, negative, and neutral. Participants write down 10 words of each valence and these words are stored as a hard copy. The goal with this task is to find out how quickly participants classify their own words as positive vs. neutral or negative vs. neutral. The trick is that, because the words are used by another lab and have already been collected, we want to use the words from existing handwritten lists, rather than prompting them for words at the beginning of the Inquisit experiment.

To solve this problem, I want to create a unique file for each participant that defines the idiographic items based on our existing lists, such as:

1_words.exp

<item positive>
/1 = "happy"
/2 = "jovial"
/3 = "cool"
</item>

<item negative>
/1 = "sad"
/2 = "down"
/3 = "depressed"
</item>

<item neutral>
/1 = "level"
/2 = "calm"
/3 = "stable"
</item>

And then the idea would be to conditionally include the file based on the participant number:
<include>
/file = "<% script.subjectid %>_words.exp"
</include>

The problem is that when I try this approach, it attempts to evaluate the include expression before runtime, so the subject number is not yet known and I get a "unable to open file" error. Is there any way to accomplish this form of a conditional include?

Thanks,
Michael


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Hey Michael,

obviously the <include> approach won't work for the reasons you already mentioned. As far as I know, there is no way to do some kind of conditional <include> with Inquisit alone. But if you want to stick with the general approach, here's a suggestion that would work:

(1) You already have txt-files each containing the different items for every participant.
(2) The <include> statement in your Inquisit script should be *fixed* to something like this

<include>
/ file = "currentsession.txt"
</include>

(3) Now, the trick is to collect the subject id and replace "currentsession.txt" with the correct, subject-specific file *before* actually starting Inquisit. You could write a Windows batch file (or - better yet - use a more flexible scripting language - AutoIt, Autohotkey, etc.) that collects the subject id, replaces "currentsession.txt" with the correct file and then starts Inquisit (passing the subject id as a command line argument - refer to the Inquisit helpfile for the syntax).

This actually sounds more complicated than it really is. Of course, if you're planning to run your experiment in Inquisit Web Edition, this approach cannot be used.

If you don't want to go down that route, I guess you'll have to change your general strategy and do the item-selection from within Inquisit (i.e. all items for all subjects are always included and Inquisit selects the correct set based on subject id sometime before running the first trial).

Best wishes,
~Dave


MichaelH
MichaelH
Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)Partner Member (648 reputation)
Group: Forum Members
Posts: 13, Visits: 1
Hi Dave,

Thanks very much for your quick and helpful response. The solution you described using an external scripting language makes good sense to me. I downloaded AutoIt and brushed up on the basic syntax. I prototyped the code below, which works perfectly for this purpose. It prompts the user for the subject id, then copies the person's words into "personalwords.txt" and run's Inquisit with their ID. I still have to improve the code to deal with problems locating files, invalid ids, etc., but I thought I would share the solution in this forum in case others may have a similar need.

Thanks again!
Michael

---Begin AutoIt code---
$subid = InputBox("Categorization Speed", "Please enter the Subject ID", "", " M5")

If @error = 1 Then ; indicates cancel button, so close script
    Exit
EndIf

$inputfile = $subid & "_words.txt"
$dir = "C:\Categorization Speed\"
$outputtarget = "personalwords.txt"
$inquisitpath = "C:\Program Files\Millisecond Software\Inquisit 3\Inquisit.exe"
$scriptpath = "C:\Categorization Speed\Categorization Speed.exp"

FileCopy($dir & $inputfile, $dir & $outputtarget, 9)
$runstring = """" & $inquisitpath & """ """ & $scriptpath & """ " & $subid & " human"
Run($runstring)

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Hi Michael,

It's good to see that the solution seems to be working for you! Many thanks for reporting back and posting the prototype code for the script. Hopefully this will be useful for others facing similar problems.

Note that - AFAIK - you can also convert AutoIt scripts into self-containing exe-files. So, once you've finished and tested the script you can generate a simple experiment loader to distribute on your lab machines. Then there's no need to seperately install / run AutoIt on these systems.

I've used AutoIt or Autohotkey scripts in addition to Inquisit for similar tasks in the past and it's always worked out great!

All the best,
~Dave

Tobbo
Tobbo
Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)
Group: Forum Members
Posts: 3, Visits: 1

Hi,


I start working withInquisit 3. I have the same problem as Michael.


I want the subject to decide between sounds. The question is how good they can decide which sound they made and which sound was produced by someone else.


We have a lot of subjects so I can't make a seperate group or experiment for everyone.


I want the program to open the data `X.wav` after the input of the subject number `X`, but it soen't work. That's the way I tired to do it:


<expt>
/ blocks = [1=test]
</expt>

<block test>
/ trials = [1-10 = random(firsttrial)]
</block>

<trial firsttrial>
/stimulusframes = [1= subjectton]
/ correctresponse = (" ")
</trial>

<sound subjectton>
/ items = ("<% script.subjectid %>.wav")
</sound>

I have no idea how to work with the Autolt programm. I tried to copy and change the part Michael posted, but it didn't work.


Can somebody tell me what the different lines in the Autoltscript do? Or any other way to solve the problem?


Thx for your help,


Greetings, Tobbo


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

In this specific case, there may be an easier way to do this:


<sound subjectsound>
/ items = subjectsounds
/ select = script.subjectid
</sound>

<item subjectsounds>
/ 1 = "1.wav"
/ 2 = "2.wav"
</item>

<trial soundtrial>
/ stimulusframes = [1=subjectsound]
/ validresponse = (anyresponse)
</trial>

<block myblock>
/ trials = [1=soundtrial]
</block>


I've also attached a small demo script along these lines. Best wishes from a fellow Inquisit user,


~Dave


Attachments
SubjectID_Sounds.zip (546 views, 40.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

Hmm, I probably should add a caveat:


In the solution posted above, all soundfiles will be loaded into memory at the start of the experiment. So if you really have *a lot* of subjects / soundfiles, there may be memory / performance issues. Please try that before moving on.


If you encounter performance issues, the AutoIt approach is probably your best shot. AutoIt is freely available at http://www.autoitscript.com/autoit3/. It includes a pretty comprehensive documentation that should be helpful in modifying Michael's code. And of course, there's also a user forum (http://www.autoitscript.com/forum/index.php?act=idx) where questions can be asked.


Tags
Tobbo
Tobbo
Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)
Group: Forum Members
Posts: 3, Visits: 1

Hi Dave,


thx a lot! I don't have all the data at the moment, therefore I don't know if it will work with all the data. But I hope it will!


Thanks again!


Have great time, mate



Tobbo
Tobbo
Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)Respected Member (498 reputation)
Group: Forum Members
Posts: 3, Visits: 1

Hello again,


I have another question.


As mentioned before I want to play a sound and the subject has to rate if the sound was produced by himslef or someone else. Dave told me how to load the rightt sound for  the subject making the test. I want to add another command to load another sound from the following subject for the second trial so that the subject has to differentiate between his sounds and the sound of the following subjects. Can I do anything like this ?.


The perfect solution would be if I could show randomly ,3 times 3 different sounds of the subject and 3 times 3 different sounds of the next subject.


It is getting more and more complex, I know. And that is why I can't help myself anymore with the tutorial and INquisit Help :)



Hope there is a way to program such a study!



I



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

Can be done. You'll want to look up the Inquisit documentation topics on the <expressions>, <values> and possibly <counter> elements along with Inquisit's math and conditional logic functions. To get a general sense of how to use these, you'll want to download and follow through a few of the more complex Inquisit scripts available at http://www.millisecond.com/download/samples. The tutorials don't cover much of those advanced features. Sadly, I cannot discuss this here in any detail, as this goes well beyond the time I feel comfortable spending on free-of-charge, user-to-user support projects. But maybe someone else has some more time to spare and will chime in eventually.


Good luck & keep us posted on your progress!


~Dave


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search