Millisecond Forums

Sending markers to Labchart for specific stimulus conditions

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

By SCHAMP - 4/10/2019

Hi, 

My lab and I are currently trying to run an EMG experiment where we present faces to participants and measure facial muscle responses. 
The study is a 2 x 2 x 3, with two emotions (happy/angry), model gender (1=F, 2 =M), and facial intensity level (1, 2, 3). Every participant will see different models representing each condition (i.e., 4x happy/F/30% images), and will make a mouse click response when they see the face to try and guess the emotion being displayed, as well as having their muscle movements measured. 

We are interested in sending a different marker to Labchart every time a specific combination of factors is displayed via Inquisit. Currently, our trials are set up as 'angry' faces and 'happy' faces, and the data about the gender/intensity of the image being shown is coded separately as expressions, and recorded during the trial. The script is based on the facial display of emotions task script. 

I have been reading other forum posts about similar experiments involving markers (https://www.millisecond.com/forums/Topic23095.aspx) but I'm still not sure how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level. 

My script is attached below. 

Thank you in advance for your help!! 

By Dave - 4/10/2019

SCHAMP - Wednesday, April 10, 2019
Hi, 

My lab and I are currently trying to run an EMG experiment where we present faces to participants and measure facial muscle responses. 
The study is a 2 x 2 x 3, with two emotions (happy/angry), model gender (1=F, 2 =M), and facial intensity level (1, 2, 3). Every participant will see different models representing each condition (i.e., 4x happy/F/30% images), and will make a mouse click response when they see the face to try and guess the emotion being displayed, as well as having their muscle movements measured. 

We are interested in sending a different marker to Labchart every time a specific combination of factors is displayed via Inquisit. Currently, our trials are set up as 'angry' faces and 'happy' faces, and the data about the gender/intensity of the image being shown is coded separately as expressions, and recorded during the trial. The script is based on the facial display of emotions task script. 

I have been reading other forum posts about similar experiments involving markers (https://www.millisecond.com/forums/Topic23095.aspx) but I'm still not sure how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level. 

My script is attached below. 

Thank you in advance for your help!! 


> "how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level"

I'm not sure how that's different from any other example or merely encoding trial type. The method would be exactly the same. Set up a <port> element, display it via your <trial> elements' /stimulustimes or -frames, and set the port element to a specific marker value that reflects the applicable combination of type-gender-intensity /ontrialbegin.

To do this, you'll want to shift these things

<trial anger>
/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]

/stimulusframes = [1 = anger]
/ inputdevice = mousekey
/ validresponse = (lbuttonup, rbuttonup)
/ correctresponse = (rbuttonup)
/ beginresponsetime = 0
/branch = [trial.ITI]
/recorddata = true
/ response = timeout(parameters.stimulusduration)
/branch = [trial.ITI]
/recorddata = true
</trial>

to the start of the trial (/ontrialbegin) so you can know the result of the relevant <expressions> before the stimulus presentation starts. Set the marker value /ontrialbegin as well based on the result of those expressions.

You'll have to come up with some encoding scheme for the various possible combinations -- if you want to cram everything into a single marker, keep in mind that you effectively have the decimals 1 to 255 to work with. You could, to keep things relatively simple, use some prefix indicating trial type (e.g. 1=happy, 2=angry) plus the item number, which encodes all the information you want already (according to your expressions), i.e. the marker value 123 would indicate item 23 in a "happy" trial, the marker value 214 would indicate item 14 in an "angry" trial, etc.

Alternatively, you could set up multiple <port> elements -- one indicating trial type, one indicating gender, one indicating intensity, etc. -- and have your <trial>s send them one after the other.
By SCHAMP - 4/11/2019

Dave - Wednesday, April 10, 2019
SCHAMP - Wednesday, April 10, 2019
Hi, 

My lab and I are currently trying to run an EMG experiment where we present faces to participants and measure facial muscle responses. 
The study is a 2 x 2 x 3, with two emotions (happy/angry), model gender (1=F, 2 =M), and facial intensity level (1, 2, 3). Every participant will see different models representing each condition (i.e., 4x happy/F/30% images), and will make a mouse click response when they see the face to try and guess the emotion being displayed, as well as having their muscle movements measured. 

We are interested in sending a different marker to Labchart every time a specific combination of factors is displayed via Inquisit. Currently, our trials are set up as 'angry' faces and 'happy' faces, and the data about the gender/intensity of the image being shown is coded separately as expressions, and recorded during the trial. The script is based on the facial display of emotions task script. 

I have been reading other forum posts about similar experiments involving markers (https://www.millisecond.com/forums/Topic23095.aspx) but I'm still not sure how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level. 

My script is attached below. 

Thank you in advance for your help!! 


> "how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level"

I'm not sure how that's different from any other example or merely encoding trial type. The method would be exactly the same. Set up a <port> element, display it via your <trial> elements' /stimulustimes or -frames, and set the port element to a specific marker value that reflects the applicable combination of type-gender-intensity /ontrialbegin.

To do this, you'll want to shift these things

<trial anger>
/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]

/stimulusframes = [1 = anger]
/ inputdevice = mousekey
/ validresponse = (lbuttonup, rbuttonup)
/ correctresponse = (rbuttonup)
/ beginresponsetime = 0
/branch = [trial.ITI]
/recorddata = true
/ response = timeout(parameters.stimulusduration)
/branch = [trial.ITI]
/recorddata = true
</trial>

to the start of the trial (/ontrialbegin) so you can know the result of the relevant <expressions> before the stimulus presentation starts. Set the marker value /ontrialbegin as well based on the result of those expressions.

You'll have to come up with some encoding scheme for the various possible combinations -- if you want to cram everything into a single marker, keep in mind that you effectively have the decimals 1 to 255 to work with. You could, to keep things relatively simple, use some prefix indicating trial type (e.g. 1=happy, 2=angry) plus the item number, which encodes all the information you want already (according to your expressions), i.e. the marker value 123 would indicate item 23 in a "happy" trial, the marker value 214 would indicate item 14 in an "angry" trial, etc.

Alternatively, you could set up multiple <port> elements -- one indicating trial type, one indicating gender, one indicating intensity, etc. -- and have your <trial>s send them one after the other.

Hi Dave, 

Firstly, thanks for your help and being so quick to respond, I really appreciate it!

I've set up individual <port>'s  for each marker for each condition. I'm still a bit confused about how to get the different markers to display depending on specific values of the stimulus in each trial. 

If, for example, I had ports called angry 30 = an_30, angry 50 = an_50, angry 70 = an_70 and was looking at an 'angry' trial with all intensities mixed in during that trial presentation. At the start of the trial, would I be able to do something like: 

<trial anger>
/ontrialbegin = [
if (expressions.intensity == 1), port.an_30;
if(expressions.intensity == 2), port.an_50;
if(expressions.intensity == 3), port.an_70 
]

/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]

/stimulusframes = [1 = anger]
....

In order to get the trial to send off those specific markers in those specific cases of the trial? 

Thanks again. 

By Dave - 4/11/2019

SCHAMP - Thursday, April 11, 2019
Dave - Wednesday, April 10, 2019
SCHAMP - Wednesday, April 10, 2019
Hi, 

My lab and I are currently trying to run an EMG experiment where we present faces to participants and measure facial muscle responses. 
The study is a 2 x 2 x 3, with two emotions (happy/angry), model gender (1=F, 2 =M), and facial intensity level (1, 2, 3). Every participant will see different models representing each condition (i.e., 4x happy/F/30% images), and will make a mouse click response when they see the face to try and guess the emotion being displayed, as well as having their muscle movements measured. 

We are interested in sending a different marker to Labchart every time a specific combination of factors is displayed via Inquisit. Currently, our trials are set up as 'angry' faces and 'happy' faces, and the data about the gender/intensity of the image being shown is coded separately as expressions, and recorded during the trial. The script is based on the facial display of emotions task script. 

I have been reading other forum posts about similar experiments involving markers (https://www.millisecond.com/forums/Topic23095.aspx) but I'm still not sure how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level. 

My script is attached below. 

Thank you in advance for your help!! 


> "how you would indicate that a specific condition of a trial is being shown, rather than a trial type (so, instead of sending a marker at the start of happy/angry trials to say the image was happy/angry, sending a different mark per image to indicate trial type AND gender AND intensity level"

I'm not sure how that's different from any other example or merely encoding trial type. The method would be exactly the same. Set up a <port> element, display it via your <trial> elements' /stimulustimes or -frames, and set the port element to a specific marker value that reflects the applicable combination of type-gender-intensity /ontrialbegin.

To do this, you'll want to shift these things

<trial anger>
/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]

/stimulusframes = [1 = anger]
/ inputdevice = mousekey
/ validresponse = (lbuttonup, rbuttonup)
/ correctresponse = (rbuttonup)
/ beginresponsetime = 0
/branch = [trial.ITI]
/recorddata = true
/ response = timeout(parameters.stimulusduration)
/branch = [trial.ITI]
/recorddata = true
</trial>

to the start of the trial (/ontrialbegin) so you can know the result of the relevant <expressions> before the stimulus presentation starts. Set the marker value /ontrialbegin as well based on the result of those expressions.

You'll have to come up with some encoding scheme for the various possible combinations -- if you want to cram everything into a single marker, keep in mind that you effectively have the decimals 1 to 255 to work with. You could, to keep things relatively simple, use some prefix indicating trial type (e.g. 1=happy, 2=angry) plus the item number, which encodes all the information you want already (according to your expressions), i.e. the marker value 123 would indicate item 23 in a "happy" trial, the marker value 214 would indicate item 14 in an "angry" trial, etc.

Alternatively, you could set up multiple <port> elements -- one indicating trial type, one indicating gender, one indicating intensity, etc. -- and have your <trial>s send them one after the other.

Hi Dave, 

Firstly, thanks for your help and being so quick to respond, I really appreciate it!

I've set up individual <port>'s  for each marker for each condition. I'm still a bit confused about how to get the different markers to display depending on specific values of the stimulus in each trial. 

If, for example, I had ports called angry 30 = an_30, angry 50 = an_50, angry 70 = an_70 and was looking at an 'angry' trial with all intensities mixed in during that trial presentation. At the start of the trial, would I be able to do something like: 

<trial anger>
/ontrialbegin = [
if (expressions.intensity == 1), port.an_30;
if(expressions.intensity == 2), port.an_50;
if(expressions.intensity == 3), port.an_70 
]

/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]

/stimulusframes = [1 = anger]
....

In order to get the trial to send off those specific markers in those specific cases of the trial? 

Thanks again. 


No, if you set things up like this, you would use the insertstimulusframe() function /ontrialbegin to insert the applicable port stimulus into the trial's stimulus presentation sequence. I.e. something like this:

<trial anger>
/ontrialbegin = [values.emotion = "anger"; values.intensity = 1]
/ontrialbegin = [values.stimulusitem = picture.anger.nextvalue]
/ontrialbegin = [values.encoder = picture.anger.nextvalue]
/ontrialbegin = [
if (expressions.intensity == 1) trial.anger.insertstimulusframe(port.an_30, 1);
if (expressions.intensity == 2) trial.anger.insertstimulusframe(port.an_50, 1);
if (expressions.intensity == 3) trial.anger.insertstimulusframe(port.an_70, 1);
]
/ ontrialend = [
trial.anger.resetstimulusframes();
]

/stimulusframes = [1 = anger]
...
</trial>

By SCHAMP - 4/16/2019

Thanks for that- I've put in all your suggestions and the script is running without errors on its own. 

However, when I try and run the script in tandem with Labchart, I keep getting this error:

"Unable to obtain the address for parallel port 3. Line 228, File win\ParallelPort.cpp"

I've checked the device manager settings, and the port is definitely LPT3. In addition, when I test sending signals using the parallel port monitor and specify the port address (3FD8) directly, Inquisit seems to have no problems finding LPT3, and is able to send signals to Labchart. 
Other scripts we have produced using E-prime that also signal to Labchart via the parallel port are also working and sending signals, so it doesn't seem to be a fault with the port itself. 

Do you have any idea why the address is unable to be found? 

Thanks!! 
By SCHAMP - 4/16/2019

SCHAMP - Tuesday, April 16, 2019
Thanks for that- I've put in all your suggestions and the script is running without errors on its own. 

However, when I try and run the script in tandem with Labchart, I keep getting this error:

"Unable to obtain the address for parallel port 3. Line 228, File win\ParallelPort.cpp"

I've checked the device manager settings, and the port is definitely LPT3. In addition, when I test sending signals using the parallel port monitor and specify the port address (3FD8) directly, Inquisit seems to have no problems finding LPT3, and is able to send signals to Labchart. 
Other scripts we have produced using E-prime that also signal to Labchart via the parallel port are also working and sending signals, so it doesn't seem to be a fault with the port itself. 

Do you have any idea why the address is unable to be found? 

Thanks!! 

Not to worry problem solved!!! I tried specifying the port address directly in defaults and it appears to be working!!!

By Dave - 4/16/2019

SCHAMP - Tuesday, April 16, 2019
SCHAMP - Tuesday, April 16, 2019
Thanks for that- I've put in all your suggestions and the script is running without errors on its own. 

However, when I try and run the script in tandem with Labchart, I keep getting this error:

"Unable to obtain the address for parallel port 3. Line 228, File win\ParallelPort.cpp"

I've checked the device manager settings, and the port is definitely LPT3. In addition, when I test sending signals using the parallel port monitor and specify the port address (3FD8) directly, Inquisit seems to have no problems finding LPT3, and is able to send signals to Labchart. 
Other scripts we have produced using E-prime that also signal to Labchart via the parallel port are also working and sending signals, so it doesn't seem to be a fault with the port itself. 

Do you have any idea why the address is unable to be found? 

Thanks!! 

Not to worry problem solved!!! I tried specifying the port address directly in defaults and it appears to be working!!!


Great you were able to solve the problem. For anybody else running into a similar problem, if the parallel port on a given system has a non-standard base address (this is often the case when the port is on a separate add-on board instead of integrated on the system's mainboard), you may need to specify the base address in the script's <defaults> with the /lptaddresses attribute for the script to be able to locate the port:

https://www.millisecond.com/support/docs/v5/html/language/attributes/lptaddresses.htm

i.e.

<defaults>
/ lptaddresses = (lpt3=3FD8)
...
</defaults>