Passing information from one block of trials to another

Ask questions and discuss programming issues around Tatool Java.
a.rey-mermet
Posts: 39
Joined: Fri Mar 07, 2014 6:21 am
Institution: University of Zurich

Passing information from one block of trials to another

Post by a.rey-mermet » Sun Mar 09, 2014 1:30 pm

Hi!

I am programming a stop-signal experiment in which I want that the last stop-signal delay (i.e., the delay until the stop signal is presented in a no-go trial) used in a block is the first stop-signal delay used in the next block. Currently, the executable programs one trial (which consists of the presentation of the following elements: fixation + stimulus until stop signal + stimulus after stop signal + feedback + blank). The timing presentation of the stimulus until the stop signal is the stop-signal delay, and this stop-signal delay depends on the response accuracy of the last no-go trial (tracking procedure). Participants performed two different blocks with a break between blocks. The number of trials in each block as well as the presentation order of the blocks (i.e., block 1 followed by a break, followed by block 2) are determined by the xlm-file. Now, I want that the last stop-signal delay used in block 1 is also used as the first stop-signal in block 2. How can I do that?

Thanks in advance for your help!
Alodie

StoneJ
Posts: 50
Joined: Thu Aug 29, 2013 10:39 am
Institution: University of Lancaster, UK

Re: Passing information from one block of trials to another

Post by StoneJ » Sun Mar 09, 2014 6:01 pm

If you have an integer property that keeps track of the current stop-signal delay being used then that should still be intact even when you move to a new block of trials.

I'm presuming the executable that runs a trial is the same in both blocks.

James

a.rey-mermet
Posts: 39
Joined: Fri Mar 07, 2014 6:21 am
Institution: University of Zurich

Re: Passing information from one block of trials to another

Post by a.rey-mermet » Mon Mar 10, 2014 6:57 am

Yes, I have an integer property that keeps track of the current stop-signal delay. However, when block 2 starts, the integer starts from zero.
Thus, I must tell the integer property to use the last integer (i.e., the last stop-signal delay) from block 1. But where can I get to this last integer?

StoneJ
Posts: 50
Joined: Thu Aug 29, 2013 10:39 am
Institution: University of Lancaster, UK

Re: Passing information from one block of trials to another

Post by StoneJ » Mon Mar 10, 2014 8:02 am

a.rey-mermet wrote:Yes, I have an integer property that keeps track of the current stop-signal delay. However, when block 2 starts, the integer starts from zero.
Thus, I must tell the integer property to use the last integer (i.e., the last stop-signal delay) from block 1. But where can I get to this last integer?
If I have understood the situation correctly then you can remove whatever sets it to 0 at the start of a block. I am guessing it is some initialisation probably from the XML. You can initiailise the stop-signal from within the executable by having an if statement that only executes when trialCounter == 0 where trialCounter is a variable you declare to keep track of trial number that does not reset when a new block begins.

James

alocher
Posts: 259
Joined: Tue Apr 24, 2012 12:56 pm
Institution: Tatool

Re: Passing information from one block of trials to another

Post by alocher » Mon Mar 10, 2014 12:58 pm

Just to be sure: Are you actually using the same instance of your executable in block 2 that you're using in block 1?
  • If you instantiate your executable once in your xml <bean id='myExecutable' class=bla.bla.MyExecutable...> at the top and then reference that bean in your XML moduleHierarchy wherever you need it <ref bean='myExecutable'> then James' approach should work.
  • If you define the Executable twice <bean id='myExecutable1' class="bla.bla.MyExecutable"..> and <bean id='myExecutable2' class="bla.bla.MyExecutable"..> then you'll have two instances of your Executable which are not sharing their state.

a.rey-mermet
Posts: 39
Joined: Fri Mar 07, 2014 6:21 am
Institution: University of Zurich

Re: Passing information from one block of trials to another

Post by a.rey-mermet » Tue Mar 18, 2014 7:05 am

I define the Executable twice (i.e., in two different beans).

In the meantime, I have perhaps found the solution: I declare my stop-signal variable as a static variable. This works as I want: The stop-signal delay of the last block is used as the first stop-signal of the next block. Do you see any problem with this solution?

cheers,
Alodie

alocher
Posts: 259
Joined: Tue Apr 24, 2012 12:56 pm
Institution: Tatool

Re: Passing information from one block of trials to another

Post by alocher » Tue Mar 18, 2014 12:30 pm

If you create two separate instances (beans), they will not be able to share their state with each other. Whenever you define a static variable that value will not change ever, therefore it will always be the same value in all instances of that class. So I don't see how that value could be passed from one instance to the other. Maybe you can share the xml and java code to shed some more light on this.

a.rey-mermet
Posts: 39
Joined: Fri Mar 07, 2014 6:21 am
Institution: University of Zurich

Re: Passing information from one block of trials to another

Post by a.rey-mermet » Wed Mar 19, 2014 2:29 am

As you wish, I upload the two files (.java and .xml).
Moreover, I give you an output file in which you can see the timing accuracy problem (labeled in yellow).
You do not have the required permissions to view the files attached to this post.

alocher
Posts: 259
Joined: Tue Apr 24, 2012 12:56 pm
Institution: Tatool

Re: Passing information from one block of trials to another

Post by alocher » Sun Mar 23, 2014 8:01 am

I was thinking of a constant and not of a static variable therefore you're right that should probably work. It's not the safest way to do it but if it works for you and you're aware of what you're doing it should be fine.

saprca
Posts: 13
Joined: Sat Jan 26, 2013 9:30 am
Institution: cardiff university

Re: Passing information from one block of trials to another

Post by saprca » Wed Mar 26, 2014 10:32 am

Hi,

I'm trying to achieve the same thing - I need the last SSD in the block to be carried over to the next block as the initial SSD - but I'm not sure from these posts what my best option is.

I have the same executable that I run for each block - but my .xml doesn't run unless I rename them for each block... I'm not sure I have this correct though... do you have an example of calling an executable once and then referencing it?
But I still don't think this solves my problem as I have to initialise the first SSD, and this will be called every time the executable is called.

Thanks
Rachel

Locked

Who is online

Users browsing this forum: No registered users and 1 guest