Counterbalancing with 8 different blocks


Author
Message
saviano
saviano
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 6, Visits: 34
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder
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: 13K, Visits: 102K
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

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: 13K, Visits: 102K
Dave - 8/16/2024
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

> I've some issues with the implementation: the images don't follow the list sorting

In your trials, you pull a value from a list returning numbers 1 to 88 in sequence and store that in a variable (values.itemnumber). However, that is all you do. Nowhere in your code do you actually use that variable for item selection in your <picture> stimulus elements.

Instead, you have your <picture> elements sample items randomly without replacement:

<picture testFaces1>
/ items = pictureitems1
/ select = noreplace // sample randomly without replacement
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture >


If you wanted to base selection on values.itemnumber, then you'd obviously have specify so.

/ select = values.itemnumber // select item according to the variable


> and only one trial is shown instead of 88. How can I fix it?

For your various blocks you have some lists that all look like this:

<list test1>
/ items = (trial.selectTrial1)
/ poolsize = parameters.numberTestTrials
</list>


You then have that block take one and only one sample from that list:

<block 1_congruent>
/ stop = [
values.trialcount >= parameters.numberTestTrials
]
/ onblockbegin = [
values.stimDuration = parameters.stimDuration_block;
    values.trialcount = 0;
    values.condition = 1;
]
/ trials = [1 = list.test1] // one sample from list
</block>


So what happens? The list dutifully returns trial.selectTrial1 and that is run. <trial selecTrial1>

<trial selectTrial1>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.1_congruent;
    }
    else if (values.condition == 2){
        return trial.1_incongruent;
    }
]
/ trialduration = parameters.iti
</trial>


branches to <trial 1_congruent>. So that is executed.

<trial 1_congruent>
/ ontrialbegin = [
    if (!values.repeat) {
        values.trialcount += 1;
        values.itemnumber = list.1.nextindex;
    }
]
/ stimulustimes = [0 = testFaces1, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = values.stimDuration

/ responsemessage = (likeds, text.likedsFEED, 180)
/ responsemessage = (dislikesx, text.dislikesxFEED, 180)
</trial>


And then there's nowhere else to go. <trial 1_congruent> doesn't /branch anywhere. At the block level, there are no more trials to run. The one list sample you instructed the block to perform is already done.

You may want to revisit how, by contrast, the practice blocks and trials in your script work. Spot the difference.

Apart from the above, there is a lot of unnecessary complexity and redundancy in your code, and it's not clear why..

Edited Last Month by Dave
saviano
saviano
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 6, Visits: 34
Dave - 8/16/2024
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

What I want to achieve with this code is for the participant to be able to choose for each image whether he likes it or not through two specific buttons (in the code: like, dislike). Basically, there are four lists of 88 images each, each of which needs to be shown following the order in the list. Just FYI, in the code there is also a 5th additional list which is for practice only.There are 8 different groups of participants (expt 1-8). Each of this group has 4 blocks (2,4 for practice and 3,5 for test).
Initially, I created the whole practice part (all the blocks, trials, etc, that include the word "practice") and I tried to write the test part using the practice one as a basis. The two practice blocks work as they should, I'm having trouble with the two test blocks because they show just one trial instead of 88. Tell me if I can give you more info to help you understand and I'm sorry if I wasn't clear enough but I'm completely new to Inquisit and I created the whole practice part through the comment section within this forum and numerous attempts.
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: 13K, Visits: 102K
federico2001 - 8/16/2024
Dave - 8/16/2024
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

What I want to achieve with this code is for the participant to be able to choose for each image whether he likes it or not through two specific buttons (in the code: like, dislike). Basically, there are four lists of 88 images each, each of which needs to be shown following the order in the list. Just FYI, in the code there is also a 5th additional list which is for practice only.There are 8 different groups of participants (expt 1-8). Each of this group has 4 blocks (2,4 for practice and 3,5 for test).
Initially, I created the whole practice part (all the blocks, trials, etc, that include the word "practice") and I tried to write the test part using the practice one as a basis. The two practice blocks work as they should, I'm having trouble with the two test blocks because they show just one trial instead of 88. Tell me if I can give you more info to help you understand and I'm sorry if I wasn't clear enough but I'm completely new to Inquisit and I created the whole practice part through the comment section within this forum and numerous attempts.

I've already explained what is wrong with your test block code and the item selecton
saviano
saviano
New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)New Member (18 reputation)
Group: Forum Members
Posts: 6, Visits: 34
Dave - 8/16/2024
Dave - 8/16/2024
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

> I've some issues with the implementation: the images don't follow the list sorting

In your trials, you pull a value from a list returning numbers 1 to 88 in sequence and store that in a variable (values.itemnumber). However, that is all you do. Nowhere in your code do you actually use that variable for item selection in your <picture> stimulus elements.

Instead, you have your <picture> elements sample items randomly without replacement:

<picture testFaces1>
/ items = pictureitems1
/ select = noreplace // sample randomly without replacement
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture >


If you wanted to base selection on values.itemnumber, then you'd obviously have specify so.

/ select = values.itemnumber // select item according to the variable


> and only one trial is shown instead of 88. How can I fix it?

For your various blocks you have some lists that all look like this:

<list test1>
/ items = (trial.selectTrial1)
/ poolsize = parameters.numberTestTrials
</list>


You then have that block take one and only one sample from that list:

<block 1_congruent>
/ stop = [
values.trialcount >= parameters.numberTestTrials
]
/ onblockbegin = [
values.stimDuration = parameters.stimDuration_block;
    values.trialcount = 0;
    values.condition = 1;
]
/ trials = [1 = list.test1] // one sample from list
</block>


So what happens? The list dutifully returns trial.selectTrial1 and that is run. <trial selecTrial1>

<trial selectTrial1>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.1_congruent;
    }
    else if (values.condition == 2){
        return trial.1_incongruent;
    }
]
/ trialduration = parameters.iti
</trial>


branches to <trial 1_congruent>. So that is executed.

<trial 1_congruent>
/ ontrialbegin = [
    if (!values.repeat) {
        values.trialcount += 1;
        values.itemnumber = list.1.nextindex;
    }
]
/ stimulustimes = [0 = testFaces1, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = values.stimDuration

/ responsemessage = (likeds, text.likedsFEED, 180)
/ responsemessage = (dislikesx, text.dislikesxFEED, 180)
</trial>


And then there's nowhere else to go. <trial 1_congruent> doesn't /branch anywhere. At the block level, there are no more trials to run. The one list sample you instructed the block to perform is already done.

You may want to revisit how, by contrast, the practice blocks and trials in your script work. Spot the difference.

Apart from the above, there is a lot of unnecessary complexity and redundancy in your code, and it's not clear why..

I'm so sorry I wrote my latest reply before seeing you had already answered me! Thank you so much for your help and for taking the time!
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: 13K, Visits: 102K
federico2001 - 8/16/2024
Dave - 8/16/2024
Dave - 8/16/2024
federico2001 - 8/16/2024
Hi everyone,
I'm trying to implement an experiment with 4 lists of 88 images each (1,1R,2,2R) and each list can have two different mappings (one finger in the right and one in the left, or vice versa). There are 8 different blocks in which I try to counterbalance the lists (e.g. block 1= list 1 mapping 1 + list 1R mapping 2; block 2= list 1 mapping 2 + list 1R mapping 1; block 3= list 1R mapping 1 + list 1 mapping 2; etc). The images are shown by the list sorting and cannot be repeated.
I've some issues with the implementation: the images don't follow the list sorting and only one trial is shown instead of 88. How can I fix it?
I tried to attach the ZIP file containing the complete code and the necessary images, but it's too large of a file to be uploaded here, so here is the link to a google drive folder (idk if there was a better way to share the code).
Thank you so much.

google drive folder

You should, at a minimum, explain your implementation attempt with pertinent references to the code (or better yet short, self-contained examples) and explain the reasoning behind it.

It is not generally possible to make sense of code that is largely uncommented and broken in various ways.

> I've some issues with the implementation: the images don't follow the list sorting

In your trials, you pull a value from a list returning numbers 1 to 88 in sequence and store that in a variable (values.itemnumber). However, that is all you do. Nowhere in your code do you actually use that variable for item selection in your <picture> stimulus elements.

Instead, you have your <picture> elements sample items randomly without replacement:

<picture testFaces1>
/ items = pictureitems1
/ select = noreplace // sample randomly without replacement
/ size = (parameters.picSize, parameters.picSize)
/ erase = false
</picture >


If you wanted to base selection on values.itemnumber, then you'd obviously have specify so.

/ select = values.itemnumber // select item according to the variable


> and only one trial is shown instead of 88. How can I fix it?

For your various blocks you have some lists that all look like this:

<list test1>
/ items = (trial.selectTrial1)
/ poolsize = parameters.numberTestTrials
</list>


You then have that block take one and only one sample from that list:

<block 1_congruent>
/ stop = [
values.trialcount >= parameters.numberTestTrials
]
/ onblockbegin = [
values.stimDuration = parameters.stimDuration_block;
    values.trialcount = 0;
    values.condition = 1;
]
/ trials = [1 = list.test1] // one sample from list
</block>


So what happens? The list dutifully returns trial.selectTrial1 and that is run. <trial selecTrial1>

<trial selectTrial1>
/ stimulustimes = [0 = clearScreen, fixation]
/ branch = [
    if (values.condition == 1){
        return trial.1_congruent;
    }
    else if (values.condition == 2){
        return trial.1_incongruent;
    }
]
/ trialduration = parameters.iti
</trial>


branches to <trial 1_congruent>. So that is executed.

<trial 1_congruent>
/ ontrialbegin = [
    if (!values.repeat) {
        values.trialcount += 1;
        values.itemnumber = list.1.nextindex;
    }
]
/ stimulustimes = [0 = testFaces1, likeds, dislikesx]
/ validresponse = (noresponse, likeds, dislikesx)
/ correctresponse = (likeds, dislikesx)
/ timeout = values.stimDuration

/ responsemessage = (likeds, text.likedsFEED, 180)
/ responsemessage = (dislikesx, text.dislikesxFEED, 180)
</trial>


And then there's nowhere else to go. <trial 1_congruent> doesn't /branch anywhere. At the block level, there are no more trials to run. The one list sample you instructed the block to perform is already done.

You may want to revisit how, by contrast, the practice blocks and trials in your script work. Spot the difference.

Apart from the above, there is a lot of unnecessary complexity and redundancy in your code, and it's not clear why..

I'm so sorry I wrote my latest reply before seeing you had already answered me! Thank you so much for your help and for taking the time!

No worries. Since you're new to Inquisit, studying the Programmer's Manual is strongly recommended:
https://www.millisecond.com/support/Inquisit%20Programmer's%20Manual.pdf

The library offers hundreds of well-engineered and -commented task implementations, whose code you can study to gain further insight into how various programming problems can be approached.
https://www.millisecond.com/download/library

When you write code, make sure to always comment it. Do this for the sake of others who might one day want to use or modify your code as well as your own. Trust me, one year from now you will not remember why you wrote the code the way you did unless you commented it. I have made that mistake -- neglecting code commenting -- more times than I care to admit.

If you're interested in removing redundancies from your code, there are a bunch of illustrative examples on fhe forum you can look at, e.g. here: https://forums.millisecond.com/Topic36088.aspx
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search