Maria Evjen

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Choosing subet of items to present #6253
    Maria Evjen
    Participant

    Hi Jeremy,

    Yes, it works perfectly now, thank you so much! And you are right that my alt, non and fil trials all follow the same template, so the way you shortened the script works great.

    I really can’t thank you enough for all your help, you are a lifesaver!

    All the best,
    Maria

    in reply to: Choosing subet of items to present #6238
    Maria Evjen
    Participant

    Hi Jeremy,

    I see, that makes sense! I implemented the code above, but I am still having some issues. Now the pictures aren’t showing at all and both the trigger audio file and the target voicing audio file are not playing. Under the Error tab of the Debugger, I am getting the same errors as before saying “No audio to play for element ;sg_voicing” or “No audio to play for element ;pl_voicing” for each test trial. In some trials, the devoicing file is not played either, and as before, the Selector is not working either.

    When I was playing around with it trying to see if I needed to change something, I copied the newAudio and newImage files to the templates in addition to having them in the const declarations like this to see if it helped:

    Template(defaultTable.filter(r => r.Type=="alt" ), row =>
        newTrial( "alt" ,
        newImage("sg_picture", variable.SgPictureFile),
        newImage("pl_picture", variable.PlPictureFile),
        newAudio("sg_voicing", variable.SgVoicingFile),
        newAudio("pl_voicing", variable.PlVoicingFile),
            getVar("phase").test.is("training")
                .success( ...alt_training_trial(row) )
                .failure( ...alt_test_trial(row) )
        )
        .log("phase", getVar("phase") )
        .log( "sg_picture", row.SgPictureFile )
        .log("Item", row.Item)
    )

    When I did this, the test trials ran as they should with both pictures showing, the first picture being removed, and all the sound files playing, but the Selector did not work for the plural target trials. Also, this added the .remove() problem to the training trials for some reason. I don’t know if this helps to figure out what the problem is, but I figured I would include it nevertheless.

    Thanks again!

    Maria

    in reply to: Choosing subet of items to present #6232
    Maria Evjen
    Participant

    Hi!

    Thank you, I have e-mailed you a link to my experiment! And yes, I am realising that my experiment is quite difficult to code, I really couldn’t have done it without all your help!

    The precedeEachWith solution works great, but I’m having difficulties with the Selector in the test trials. I implemented your code above like this:

    const alt_test_trial = variable => [
        getVar("target").test.is("sg")
            .success( 
                newTimer(500)
                    .start()
                    .wait()
                ,
                newImage("pl_picture", variable.PlPictureFile)
                    .print()
                ,
                newTimer(200)
                    .start()
                    .wait()
                ,
                newAudio("pl_voicing", variable.PlVoicingFile)
                    .play()
                ,
                newTimer(2000)
                    .start()
                    .wait()
                ,
                getImage("pl_picture")
                    .remove()
                ,
                newImage("sg_picture", variable.SgPictureFile)
                    .print()
                ,
                newTimer(200)
                    .start()
                    .wait()
                ,
                newAudio("sg_voicing", variable.SgVoicingFile)
                ,
                newAudio("sg_devoicing", variable.SgDevoicingFile)
                ,
                newSelector("target")
                    .log()
                    .add( getAudio("sg_voicing"),getAudio("sg_devoicing") )
                    .shuffle()
                    .test.index( getAudio("sg_voicing"), 0 )
                    .success(
                        getAudio("sg_voicing").play().wait(),
                        getAudio("sg_devoicing").play().wait(),
                        getSelector("target").keys("1","2").wait()
                    )
                    .failure( 
                        getAudio("sg_devoicing").play().wait(),
                        getAudio("sg_voicing").play().wait(),
                        getSelector("target").keys("2","1").wait()
                    )
                ,
                newTimer(500)
                    .start()
                    .wait()
            )
            .failure( 
                newTimer(500)
                    .start()
                    .wait()
                ,
                newImage("sg_picture", variable.SgPictureFile)
                    .print()
                ,
                newTimer(200)
                    .start()
                    .wait()
                ,
                newAudio("sg_voicing", variable.SgVoicingFile)
                    .play()
                ,
                newTimer(2000)
                    .start()
                    .wait()
                ,
                getImage("sg_picture")
                    .remove()
                ,
                newImage("pl_picture", variable.PlPictureFile)
                    .print()
                ,
                newTimer(200)
                    .start()
                    .wait()
                ,
                newAudio("pl_voicing", variable.PlVoicingFile)
                ,
                newAudio("pl_devoicing", variable.PlDevoicingFile)
                ,
                newSelector("target")
                    .log()
                    .add( getAudio("pl_voicing"),getAudio("pl_devoicing") )
                    .shuffle()
                    .test.index( getAudio("pl_voicing"), 0 )
                    .success(
                        getAudio("pl_voicing").play().wait(),
                        getAudio("pl_devoicing").play().wait(),
                        getSelector("target").keys("1","2").wait()
    
                    )
                    .failure( 
                        getAudio("pl_devoicing").play().wait(),
                        getAudio("pl_voicing").play().wait(),
                        getSelector("target").keys("2","1").wait()
    
                    )
            )
    ]

    In addition to the .remove() problem, it appears that the script can’t play the sg_voicing files and the pl_voicing files when these are targets. When I run the experiment, the trigger audio file is played, but both when the target is singular and when it is plural, the voicing files are not played. The sg_devoicing and pl_devoicing files, on the other hand, are played. There are some exceptions though, so that sometimes, it appears randomly, both the voicing and the devoicing file are played, or neither are played, but this seems to be rare. At times more than one item is shown (both images and audio) in one trial as well. When there is a file that can’t be played, the selection with the keys does not work either, I assume this is because the trial is stuck and is not getting to the key assignment part. Do you know why this could be?

    Thanks again!

    Maria

    in reply to: Choosing subet of items to present #6224
    Maria Evjen
    Participant

    Hi again!

    Thank you so much, the stimuli are showing now! But for some reason, it seems like parts of the code in my test trials is not running now, even though it was working outside the const format. Here is an example of my test trials:

    const alt_test_trial = variable => [
        newTimer(500)
            .start()
            .wait()
        ,
        newImage("pl_picture", variable.PlPictureFile)
            .size(300,200)
            .print()
        ,
        newTimer(200)
            .start()
            .wait()
        ,
        newAudio("pl_voicing", variable.PlVoicingFile)
            .play()
        ,
        newTimer(2000)
            .start()
            .wait()
        ,
        getImage("pl_picture")
            .remove()
        ,
        newImage("sg_picture", variable.SgPictureFile)
            .size(200,200)
            .print()
        ,
        newTimer(200)
            .start()
            .wait()
        ,
        newAudio("sg_voicing", variable.SgVoicingFile)
            .play()
        ,
        newTimer(1500)
            .start()
            .wait()
        ,
        newAudio("sg_devoicing", variable.SgDevoicingFile)
            .play()
        ,
        newSelector("target")
            .add( getAudio("sg_voicing") , getAudio("sg_devoicing") )
            .shuffle()
            .keys(          "1"    ,          "2"   )
            .log()
            .wait()
        ,
        newTimer(500)
            .start()
            .wait()
    .log( "sg_picture", variable.SgPictureFile )
    .log("Item", variable.Item)
    ]

    The problem appears to be with getImage(“pl_picture”).remove() and with the shuffle command in the Selector. When I run the experiment, I first want my plural audio and image to be shown before the image will be removed and the singular audio and image will be shown. As it is now, the plural image is not removed and the singular image is just added below the plural image. In addition, it seems like my sg_voicing and sg_devoicing audio files are not being shuffled in the Selector, as the sg_voicing file always ends up being heard first. Also, when I run my experiment and make sure to consistently choose the sg_voicing file, my results file nevertheless says that I have chosen sg_devoicing a lot of the time. I therefore think there must be something wrong with the key assignment and/or the shuffle command in the Selector element.

    I also realised that I have one more design feature in my experiment that I’m not quite sure how to implement. In my testing phase, I would like to have 75% of the trials with a plural trigger and a singular target and 25% of the trials with a singular trigger and a plural target. The example above is of the former type, and I figure that I can make corresponding trials of the latter type by just switching the variables. Then I can define the plural trigger trials as const alt_test_trial_pl and the singular trigger trials as const alt_test_trial_sg for example. But from there on I am stuck, is there any way to implement these two test trial types into the Templates you have suggested?

    Sorry for bombarding you with lots of questions, I really appreciate all your help!

    Maria

    in reply to: Choosing subet of items to present #6206
    Maria Evjen
    Participant

    Hi again,

    Thank you for your reply, it was very helpful! When I run my experiment now, it seems from the Sequence function of the Debugger that the script is successful in choosing the right number of trials for the three different categories in both the training and the testing. It also seems like it chooses the right number of repeat and new items.

    However, the training and test trials are not actually showing up on the screen when I run the experiment. My intro, pause and end trials are showing as normal, but for the training and the testing, only the progress bar is showing up on the screen. I can however see the trials in the Sequence of the Debugger and skip to the different trials through “Reach”, but the stimuli are not showing. When I run my trials outside the const format you suggested, they are running as normal, but when I insert them in the code you suggested above, the stimuli are not shown in the trials. Here is an example of my code inside the const format if that helps with identifying the problem:

    const alt_training_trial = row => [
        Template( defaultTable.filter(r => r.Type=="alt" ),
    
        variable => 
        
        newTrial( "alt",
            newTimer(500)
                .start()
                .wait()
            ,
            newImage("sg_picture", variable.SgPictureFile)
                .size(200,200)
                .print()
            ,
            newTimer(200)
                .start()
                .wait()
            ,
            newAudio("sg_voicing", variable.SgVoicingFile)
                .play()
            ,
            newTimer(1500)
                .start()
                .wait()
            ,
            getImage("sg_picture")
                .remove()
            ,
            newTimer(1000)
                .start()
                .wait()
            ,
            newImage("pl_picture", variable.PlPictureFile)
                .size(300,200)
                .print()
            ,
            newTimer(200)
                .start()
                .wait()
            ,
            newAudio("pl_voicing", variable.PlVoicingFile)
                .play()
            ,
            newTimer(2000)
                .start()
                .wait()
            ,
            getImage("pl_picture")
                .remove()
            ,
            newTimer(200)
                .start()
                .wait()
            ,
            newButton("Neste")
                .print()
                .wait()
        )
        )
    ]

    Maria

    in reply to: Choosing subet of items to present #6202
    Maria Evjen
    Participant

    Hi again,

    Yes, I am generating both the training trials and the test trials from the same rows in my table as I am using some of the same audio files and images in both training and testing. The way you describe the design above is correct!

    Since I don’t have good knowledge of javascript, I am opting for the former option you suggest, but I am having trouble implementing it in my script. More specifically, where does the implementation of the pick function and the sequence you suggested in your earlier reply fit into this script?

    Sorry if this is a very basic question! And thank you for your continued help, I really appreciate it!

    Maria

    in reply to: Choosing subet of items to present #6199
    Maria Evjen
    Participant

    Hi Jeremy,

    Thank you so much for your reply! This is exactly what I want to do, and I’ve managed to implement most of it in my script. I just have one more question: in the training part of the experiment, I have three templates with trials labelled “alt”, “non”, and “fil” (corresponding to your “test” and “filler”) and I have made the following variables:

    alt = randomize(“alt”)
    non = randomize(“non”)
    fil = randomize(“fil”)

    picked_alt = pick(alt, 29)
    picked_non = pick(non, 17)
    picked_fil = pick(fil, 18)

    repeat_alt = pick(randomize(picked_alt), 15)
    repeat_non = pick(randomize(picked_non), 5)
    repeat_fil = pick(randomize(picked_fil), 10)

    I then use rshuffle on the picked_alt, picked_non, and picked_fil variables in my Sequence. This part of the experiment works perfectly!

    My issue is that my testing trials have a different template than my training trials. Parallel to the training phase, my testing phase contains three templates, one for each of “alt”, “non”, and “fil”, but if I label these using the same names as in the training phase, my test trials are getting mixed in with my training trials. But if I label them something else, e.g. “test_alt” etc., I don’t know how to implement these trials in the variables above and still make sure that I can pick the repeat items and the remaining items in my table.

    Thanks in advance!

    Maria

    in reply to: Choosing subet of items to present #6197
    Maria Evjen
    Participant

    Hi!

    This is similar to what I am trying to do as well, and the script you posted for choosing a subset of items has really helped me a lot! I have a few issues though:

    1. With your script I have managed to choose a subset of items from my target and filler stimuli, but I have the same issue as Maddie that when I choose 29 out of 44 items, I’m only getting the 29 first items in my table. I tried to implement your comment with the >= comparison, but I am still only getting the first 29 items. Is there any way to solve this?

    2. I have three categories of stimuli: alternating targets, non-alternating targets, and fillers. In the training part of my experiment, participants will be shown 29 out of 44 alternating targets, 17 out of 22 non-alternating targets, and all 18 fillers. Except for the issue in 1, I have this part solved.

    In the testing part of the experiment, I want to choose 30 alternating targets, 10 non-alternating targets and 10 fillers. Crucially, for both the alternating and the non-alternating targets, I want half of the items in the testing phase to be items that were already shown in training and the other half to be the remaining 15 (for alternating targets) and 5 (for non-alternating targets) items in the table. Do you know if there is any way to implement this?

    I’m quite new to programming and have not used javascript before, so any help is much appreciated!

    Thanks,
    Maria

Viewing 8 posts - 1 through 8 (of 8 total)