Issue with passing Parameters between different scripts in batch


Author
Message
gjp223
gjp223
New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)
Group: Forum Members
Posts: 4, Visits: 36
Hello, I'm trying to prepare an experiment that consists of three different tasks/steps, each running in a different script. The first task is a simple learning task, the second one is a staircase to establish participants' visual detection threshold. Finally, I need to pass the final threshold value from the staircase script to the main task (third task). This is a crucial part of the experiment: I need to pick a specific main task script based on participants' threshold value and to do so I produced several main task scripts, each one picking the stimuli at the appropriate threshold level. I've already checked forum discussions and the guide about passing values and parameters between different scripts, but it doesn't seem to work for me. Despite the threshold value generated at the end of the staircase task is always in the appropriate range for one of my main task scripts, whenever the staircase ends I only see a series of white flickering screens, as if every single script is aborted. Do you have any idea about the potential issue? Or do you think there is a better solution?
I’ve attached the code below. I apologise if I’m missing something trivial.

In the staircase, I defined:
<values>
/DiffThreshold1 = 0
</values>

and final trial:
<trial thresholds>
/trialduration = 0
/recorddata = true
/ ontrialend = [
    values.DiffThreshold1 = expressions.DiffThreshold
]
</trial>

The threshold value can range from 15  to 29 (I'm excluding participants that fall below or above). I rounded the final threshold value in order to get two possible values per final script (eg 15 or 15.5). 

This is how I set the main task for passing the threshold value (eg maintask_15.iqx): 
<parameters>
/ DiffThreshold1 = 0
</parameters>

<expt>
/ onexptbegin = [
    if (parameters.DiffThreshold1!= 15.5 || parameters.DiffThreshold1!= 15) script.abort(false)
]
/ blocks = [1=cardtask; 2=balltask; 3=audiocheck;]
</expt>

<expt>
/blocks = [1 = blockedtask_congruent; 2=blockedtask_incongruent; 3= imagery]
/onexptend = [values.completed = 1]
</expt>



This is my batch:
<parameters>
/ DiffThreshold1 = 0
</parameters>

<values>
/ DiffThreshold1 = 0
</values>

<batch assoc>
/ file = "learningtsk.iqx"
/ file = "stairc.iqx"
/ file = "maintask_15.iqx"
/ file = "maintask_16.iqx"
/ file = "maintask_17.iqx"
/ file = "maintask_18.iqx"
/ file = "maintask_19.iqx"
/ file = "maintask_20.iqx"
/ file = "maintask_21.iqx"
/ file = "maintask_22.iqx"
/ file = "maintask_23.iqx"
/ file = "maintask_24.iqx"
/ file = "maintask_25.iqx"
/ file = "maintask_26.iqx"
/ file = "maintask_27.iqx"
/ file = "finaltask_28.iqx"
/ file = "maintask_29.iqx"
/ onscriptend = [
    if (batch.assoc.currentscript == "stairc.iqx")
    {
        parameters.DiffThreshold1 = values.DiffThreshold1;
    }
]
</batch>



Many thanks for your help.
Dave
Dave
Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)
Group: Administrators
Posts: 11K, Visits: 67K
gjp223 - 2/28/2021
Hello, I'm trying to prepare an experiment that consists of three different tasks/steps, each running in a different script. The first task is a simple learning task, the second one is a staircase to establish participants' visual detection threshold. Finally, I need to pass the final threshold value from the staircase script to the main task (third task). This is a crucial part of the experiment: I need to pick a specific main task script based on participants' threshold value and to do so I produced several main task scripts, each one picking the stimuli at the appropriate threshold level. I've already checked forum discussions and the guide about passing values and parameters between different scripts, but it doesn't seem to work for me. Despite the threshold value generated at the end of the staircase task is always in the appropriate range for one of my main task scripts, whenever the staircase ends I only see a series of white flickering screens, as if every single script is aborted. Do you have any idea about the potential issue? Or do you think there is a better solution?
I’ve attached the code below. I apologise if I’m missing something trivial.

In the staircase, I defined:
<values>
/DiffThreshold1 = 0
</values>

and final trial:
<trial thresholds>
/trialduration = 0
/recorddata = true
/ ontrialend = [
    values.DiffThreshold1 = expressions.DiffThreshold
]
</trial>

The threshold value can range from 15  to 29 (I'm excluding participants that fall below or above). I rounded the final threshold value in order to get two possible values per final script (eg 15 or 15.5). 

This is how I set the main task for passing the threshold value (eg maintask_15.iqx): 
<parameters>
/ DiffThreshold1 = 0
</parameters>

<expt>
/ onexptbegin = [
    if (parameters.DiffThreshold1!= 15.5 || parameters.DiffThreshold1!= 15) script.abort(false)
]
/ blocks = [1=cardtask; 2=balltask; 3=audiocheck;]
</expt>

<expt>
/blocks = [1 = blockedtask_congruent; 2=blockedtask_incongruent; 3= imagery]
/onexptend = [values.completed = 1]
</expt>



This is my batch:
<parameters>
/ DiffThreshold1 = 0
</parameters>

<values>
/ DiffThreshold1 = 0
</values>

<batch assoc>
/ file = "learningtsk.iqx"
/ file = "stairc.iqx"
/ file = "maintask_15.iqx"
/ file = "maintask_16.iqx"
/ file = "maintask_17.iqx"
/ file = "maintask_18.iqx"
/ file = "maintask_19.iqx"
/ file = "maintask_20.iqx"
/ file = "maintask_21.iqx"
/ file = "maintask_22.iqx"
/ file = "maintask_23.iqx"
/ file = "maintask_24.iqx"
/ file = "maintask_25.iqx"
/ file = "maintask_26.iqx"
/ file = "maintask_27.iqx"
/ file = "finaltask_28.iqx"
/ file = "maintask_29.iqx"
/ onscriptend = [
    if (batch.assoc.currentscript == "stairc.iqx")
    {
        parameters.DiffThreshold1 = values.DiffThreshold1;
    }
]
</batch>



Many thanks for your help.

Provide the actual scripts, please.
Dave
Dave
Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)Supreme Being (921K reputation)
Group: Administrators
Posts: 11K, Visits: 67K
Dave - 3/1/2021
gjp223 - 2/28/2021
Hello, I'm trying to prepare an experiment that consists of three different tasks/steps, each running in a different script. The first task is a simple learning task, the second one is a staircase to establish participants' visual detection threshold. Finally, I need to pass the final threshold value from the staircase script to the main task (third task). This is a crucial part of the experiment: I need to pick a specific main task script based on participants' threshold value and to do so I produced several main task scripts, each one picking the stimuli at the appropriate threshold level. I've already checked forum discussions and the guide about passing values and parameters between different scripts, but it doesn't seem to work for me. Despite the threshold value generated at the end of the staircase task is always in the appropriate range for one of my main task scripts, whenever the staircase ends I only see a series of white flickering screens, as if every single script is aborted. Do you have any idea about the potential issue? Or do you think there is a better solution?
I’ve attached the code below. I apologise if I’m missing something trivial.

In the staircase, I defined:
<values>
/DiffThreshold1 = 0
</values>

and final trial:
<trial thresholds>
/trialduration = 0
/recorddata = true
/ ontrialend = [
    values.DiffThreshold1 = expressions.DiffThreshold
]
</trial>

The threshold value can range from 15  to 29 (I'm excluding participants that fall below or above). I rounded the final threshold value in order to get two possible values per final script (eg 15 or 15.5). 

This is how I set the main task for passing the threshold value (eg maintask_15.iqx): 
<parameters>
/ DiffThreshold1 = 0
</parameters>

<expt>
/ onexptbegin = [
    if (parameters.DiffThreshold1!= 15.5 || parameters.DiffThreshold1!= 15) script.abort(false)
]
/ blocks = [1=cardtask; 2=balltask; 3=audiocheck;]
</expt>

<expt>
/blocks = [1 = blockedtask_congruent; 2=blockedtask_incongruent; 3= imagery]
/onexptend = [values.completed = 1]
</expt>



This is my batch:
<parameters>
/ DiffThreshold1 = 0
</parameters>

<values>
/ DiffThreshold1 = 0
</values>

<batch assoc>
/ file = "learningtsk.iqx"
/ file = "stairc.iqx"
/ file = "maintask_15.iqx"
/ file = "maintask_16.iqx"
/ file = "maintask_17.iqx"
/ file = "maintask_18.iqx"
/ file = "maintask_19.iqx"
/ file = "maintask_20.iqx"
/ file = "maintask_21.iqx"
/ file = "maintask_22.iqx"
/ file = "maintask_23.iqx"
/ file = "maintask_24.iqx"
/ file = "maintask_25.iqx"
/ file = "maintask_26.iqx"
/ file = "maintask_27.iqx"
/ file = "finaltask_28.iqx"
/ file = "maintask_29.iqx"
/ onscriptend = [
    if (batch.assoc.currentscript == "stairc.iqx")
    {
        parameters.DiffThreshold1 = values.DiffThreshold1;
    }
]
</batch>



Many thanks for your help.

Provide the actual scripts, please.

One problem with the setup is the use of the logical OR (||) here (from your excerpt of maintask_15.iqx):

<expt>
/ onexptbegin = [
  if (parameters.DiffThreshold1!= 15.5 || parameters.DiffThreshold1!= 15) script.abort(false)
]
/ blocks = [1=cardtask; 2=balltask; 3=audiocheck;]
</expt>

The logical OR means that if EITHER of the conditions is true, the script will be aborted. So, assume parameters.DiffThreshold1 equals15.5. Then

parameters.DiffThreshold1!= 15.5 evaluates to FALSE, but parameters.DiffThreshold1!= 15 evaluates to TRUE, because 15.5 != 15. And since

FALSE || TRUE == TRUE, the script is aborted.

What you actually want, if I'm understand the intention correctly, is a logical AND (&&):

<expt>
/ onexptbegin = [
if (parameters.DiffThreshold1!= 15.5 && parameters.DiffThreshold1!= 15) script.abort(false)
]
/ blocks = [1=cardtask; 2=balltask; 3=audiocheck;]
</expt>

Again, for the sake of example, assume parameters.DiffThreshold1 equals15.5. Then

parameters.DiffThreshold1!= 15.5 evaluates to FALSE, but parameters.DiffThreshold1!= 15 evaluates to TRUE.

FALSE && TRUE == FALSE, i.e. the script is NOT aborted.

In cases, where parameters.DiffThreshold1 falls outside the permissible range, let's say 20, and is thus not equal to 15 AND not equal to 15.5, you get

TRUE && TRUE == TRUE, i.e. the script is aborted.


gjp223
gjp223
New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)New Member (14 reputation)
Group: Forum Members
Posts: 4, Visits: 36
I apologize for my late reply. I ended up merging everything into a single script, but I also tried to run it with your suggested changes and it worked, so good to know for future studies :) Thank you so much for your help!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search