Jeremy

Forum Replies Created

Viewing 15 posts - 691 through 705 (of 1,522 total)
  • Author
    Posts
  • in reply to: TypeError error #7412
    Jeremy
    Keymaster

    Hi,

    Glad to hear the new experiment runs better for you, but I actually doubt that the problem has been fixed. I think it has something to do with the timing of creation and preloading of resources, which is different whether your browser uses cached files or not. Creating a new experiment might have simply prevented your browser from using its cache, and it could be that taking the new experiment again later, you encounter the same problem. I’ll let you know if I identify the problem more precisely and, hopefully, fix it

    Jeremy

    in reply to: html layout/event times/selector vs. scale/ compatibility #7411
    Jeremy
    Keymaster

    Hi,

    1) I have seen people use an image of a cross, eg:

    newImage("cross.png").print("center at 50vw","middle at 50vh")
    ,
    newTimer(200).start().wait()
    ,
    getImage("cross.png").remove()

    2) Use the Selector element to make elements clickable on the page. If you want to catch any click anywhere on the page, you could print an empty Canvas of 100vw*100vh at (50vw,50vh) and add that Canvas to a Selector (make sure to delete the Canvas elements when you’re done listening to those clicks)

    The MouseTracker tracks the cursor’s movements, it does not make elements on the page clickable. If you have a Scale element and want to have a historic of choices, pass "all" to the .log command

    As I said above, PennController is an IBEX controller just like DashedSentence, it doesn’t matter whether you run it on the PCIbex Farm or on a dedicated server

    Jeremy

    in reply to: Comprehension questions for some test items in the following? #7404
    Jeremy
    Keymaster

    Add the missing ] before :

    In javascript you can prefix ... to an array so that the array’s elements are direct arguments of the function rather than the array being an argument itself

    (Here it is prefixed to the opening parenthesis of the ternary operator because it returns an array whether the test succeeds of fails)

    Jeremy

    in reply to: html layout/event times/selector vs. scale/ compatibility #7402
    Jeremy
    Keymaster

    Hello HPI,

    1) You will be interested in this guide on adding custom CSS and in the standard css and cssContainer commands

    Delete these CSS rules from Aesthetics/PennController.css and everything will start aligned with the page’s left edge:

    .PennController {
        width: 40em !important; /* controls the witdth of the content area */
        margin-left: 50vw; /* aligns the content area's left edge with the vertical center of the page */
        transform: translateX(-50%); /* aligns the *vertical center* of the content area instead  */
    }

    To remove the spacing on top, delete margin-top: 5em; from the body CSS rule from Aesthetics/global_main.css

    Use the .css/.cssContainer commands, or CSS rules that target all non-interface elements according to the guide above to only apply size/italics/etc. to non-interface elements

    2) Insert .log commands where you think they are relevant, then test-run your experiment and open your results file and calculate reaction times: if you are able to do it, chances are you’re doing things right. It’s your call what elements you log: for example, I rarely log Text elements because they often are not relevant to the timecourse of unfolding events in my trial. If you want to be extra-safe, you can be redundant about which elements you .log, but your results file will rapidly get very big, with submissions taking more time to be saved for each participants and your results file taking longer to be generated

    You can calculate differences between two time points in your experiment using javascript’s Date.now() and use a global Var element to report that value in an extra cell:

    newTrial(
        newVar("rt", 0).global().set(v=>Date.now())
        ,
        newButton("Click me!").print().wait()
        ,
        getVar("rt").set(v=>Date.now()-v)
    )
    .log("RT", getVar("rt"))

    This will add a column named “RT” reporting how many milliseconds elapsed between before the Button was created-then-printed and after it was clicked

    3) I don’t know how to answer that question: the Selector element’s .log command will report which element was selected last. If this is the info you need, then it’s the right way to go

    4) Yes, PennController is an IBEX controller just like DashedSentence is an IBEX controller. Just include PennController.js in the js_includes folder (also, the PCIbex Farm lets you upload resource files to the Resources folder, but the python script server.py won’t serve those from there, so you need to place the audio/image/video files in the www folder instead)

    Jeremy

    in reply to: TypeError error #7401
    Jeremy
    Keymaster

    Hello,

    I am able to run your experiment, but it happened a few times that I refreshed it and the audios wouldn’t preload correctly, despite the zip file being successfully downloaded. In my experience, it happened less with Chrome than with Firefox

    I am not sure what causes this problem, unfortunately. I’ll investigate it

    Jeremy

    in reply to: Comprehension questions for some test items in the following? #7400
    Jeremy
    Keymaster

    Hi,

    You can include a column named FOLLOWUP in your file experiment-pg-norming.csv which you leave empty for the items where you don’t want a follow-up question, and which you fill with your follow-up question for the other items. Then you can do this:

    Template("experiment-pg-norming.csv", row =>
        newTrial( "experiment-"+row.TYPE,
            newText("sentence", row.SENTENCE)
                .cssContainer({"margin-top":"2em", "margin-bottom":"2em"})
                .center()
                .print()
            ,
            // 7-point scale
            newScale(7)
                .before( newText("left", "<div class='fancy'>(very unnatural)</div>") )
                .after( newText("right", "<div class='fancy'>(very natural)</div>") )
                .labelsPosition("top")
                .keys()
                .log()
                .once()
                .color("LightCoral")
                .center()
                .print()
                .wait()
            ,
            // Wait briefly to display which option was selected
            newTimer("wait", 300)
                .start()
                .wait()
            ,
            clear()
            ,
            ...(row.FOLLOWUP ? [
                newText("follow-up", row.FOLLOWUP)
                    .cssContainer({"margin-top":"2em", "margin-bottom":"2em"})
                    .center()
                    .print()
                ,
                newScale("answer-follow-up", "Yes", "No")
                    .button()
                    .print()
                    .wait()
            ] : [
                null
            ])
        )
    )

    Jeremy

    • This reply was modified 2 years, 6 months ago by Jeremy. Reason: added the missing ]
    in reply to: masked priming #7399
    Jeremy
    Keymaster

    Hello Nana,

    There is a blank line in your file 刺激語.csv, which defines a 13th “empty” group besides A-L. When the running counter is a multiple of 13 (which includes the value 0) the Template command generates a single trial from that empty line.

    Solution: delete the empty line

    Jeremy

    in reply to: Select more than one image #7392
    Jeremy
    Keymaster

    That’s because I used a lower case s where I should I have used an upper case S, in those getVar commands

    Jeremy

    in reply to: Select more than one image #7389
    Jeremy
    Keymaster

    Hi,

    The Selector element does not come with the option to be an on/off switch by default, so you need to work around that to get what you want. In this case, you could use the same javascript randomizing method I employed in my other thread’s message, and create a Selector element for each Image element, and keep track of its status with a dedicated Var element, and then you can use a callback command to select/unselect accordingly:

    makeImageSelector = imageName => newSelector("s"+imageName).add(getImage(imageName)).callback(
        getSelector("simage5").unselect(),
        newVar(imageName+"Selected",false).global().set(v=>true-v)
        .test.is(false).success( getSelector("s"+imageName).unselect() )
    )
    // Testing trials for individual mapping
    Template("testing-mapping-individual.csv", row =>
        newTrial("testing-mapping-individual",
            images = [row.image1,row.image2,row.image3,row.image4].sort(v=>0.5-Math.random()),
            newTimer("break", 1000)
                .start()
                .wait()
            ,
            newAudio("audio", row.audio)
                .play()
            ,
            newText("sentence", row.sentence)
                .center()
                .print()
            ,
            newButton("dummy")
            ,
            defaultSelector.frame("solid 2px purple").callback( getButton("dummy").click() ).log()
            ,
            defaultImage.size(200,200)
            ,
            newImage("image1", images[0]),
            makeImageSelector("image1")
            ,
            newImage("image2", images[1]),
            makeImageSelector("image2")
            ,
            newImage("image3", images[2]),
            makeImageSelector("image3")
            ,
            newImage("image4", images[3]),
            makeImageSelector("image4")
            ,
            newImage("image5", 'none.png'),
            newSelector("simage5").add(getImage("image5")).callback(
                getSelector("simage1").unselect(),
                getSelector("simage2").unselect(),
                getSelector("simage3").unselect(),
                getSelector("simage4").unselect(),
                getVar("image1selected").set(false),
                getVar("image2selected").set(false),
                getVar("image3selected").set(false),
                getVar("image4selected").set(false)
            )
            ,
            newCanvas("side-by-side", 600,600)
                .add(  0, 0, getImage("image1"))
                .add(400, 0, getImage("image2"))
                .add(  0, 400, getImage("image3"))
                .add(400, 400, getImage("image4"))
                .add(200, 200, getImage("image5"))
                .center()
                .print()
            ,
            getButton("dummy").wait()
            ,
            newButton("click", "Done!")
                .center()
                .print()
                .wait()
            ,
            getAudio("audio")
                .wait("first")
        )
        .log("item", row.item)
        .log("task", row.task)
        .log("level", row.level)
        .log("label", row.label)
        .log("answer", row.answer)
        .log("image1", images[0])
        .log("image2", images[1])
        .log("image3", images[2])
        .log("image4", images[3])
        .log("image5", 'none.png')
        .log("image1selected", getVar("image1selected"))
        .log("image2selected", getVar("image2selected"))
        .log("image3selected", getVar("image3selected"))
        .log("image4selected", getVar("image4selected"))
    );

    Jeremy

    in reply to: Randomize audios #7388
    Jeremy
    Keymaster

    Hi,

    Yes, you can use plain javascript to randomize the order of the audios. Here’s how I would go about it:

    Template("training.csv", row =>
        newTrial("training",
            audios = [row.audio1,row.audio2,row.audio3].sort(v=>0.5-Math.random()),
            newTimer("break", 1000)
                .start()
                .wait()
            ,
            newImage("image1", row.image1)
                .size(200, 200)
            ,
            newImage("image2", row.image2)
                .size(200, 200)
            ,
            newImage("image3", row.image3)
                .size(200, 200)
            ,
            newCanvas("side-by-side", 700,200)
                .add(  0, 0, getImage("image1"))
                .add(250, 0, getImage("image2"))
                .add(500, 0, getImage("image3"))
                .center()
                .print()
            ,
            newSelector("selection")
                .add(getImage("image1"), getImage("image2"), getImage("image3"))
                .disableClicks()
                .shuffle()
            ,
            newAudio("audio1", audios[0])
                .play()
                .wait()
            ,
            newTimer("break2", 1000)
                .start()
                .wait()
            ,
            newAudio("audio2", audios[1])
                .play()
                .wait()
            ,
            newTimer("break3", 1000)
                .start()
                .wait()
            ,
            newAudio("audio3", audios[2])
                .play()
            ,
            newTimer("break4", 1000)
                .start()
                .wait()
            ,
            getAudio("audio3")
                .wait("first")
        )
        .log("group", row.group)
        .log("item", row.item)
        .log("condition", row.condition)
        .log("audio1", audios[0])
        .log("audio2", audios[1])
        .log("audio3", audios[2])
    )

    Jeremy

    in reply to: Results still slow to access/download? #7385
    Jeremy
    Keymaster

    I’m afraid that information is not available before the SendResults trial by default, but what you can do is name your MediaRecorder elements using it, eg (assuming you retreive the ID from the URL):

    Template( row => 
      // ... code
        newMediaRecorder('record-'+GetURLParameter('id')+'-'+row.Group+'-'+row.Item, "audio")
      // ... code
    

    Jeremy

    in reply to: Pictures taking too long to load #7380
    Jeremy
    Keymaster

    Dear Camelia,

    Did you correct the typo I mentioned in my second message?

    (in my first message, I was assuming that the github repo contained all the files you added to your project, and list.csv was not present in your repo’s chunk_includes folder—my bad)

    Jeremy

    in reply to: Pictures taking too long to load #7378
    Jeremy
    Keymaster

    It looks like I wrote my message as you were posting your second message

    The debugger (once I turn it back on) gives me this error message:

    No column named ‘PrimePictureOther’ found in table list.csv. Did you mean to type ‘TargetPictureLiteral’?

    Once I fix the typo (your colum’s name is actually PrimePictureother1) then there is no preloading issue

    Also, you can delete the PreloadZip line, since your images are now in your project’s Resources folder

    Jeremy

    in reply to: Pictures taking too long to load #7377
    Jeremy
    Keymaster

    Hello,

    You shouldn’t be able to see any picture, since you cannot apply the necessary “granting access” step on GitHub: https://doc.pcibex.net/how-to-guides/managing-resources/#uploading-and-granting-access-to-zip-files
    I see you have a .htaccess file in your ZIP file, but this is not what you should be doing: the .htaccess file should be uploaded to a webserver besides the ZIP file. GitHub is not a valid webserver, so you cannot use the ZIP method by uploading zip files to GitHub

    This means that your zip file will never get downloaded, and your experiment will never have access to the images. Do you ever see any picture displayed at all? I don’t know how that could be. My recommendation is you upload the images directly to your project by dragging them over your project’s Resources folder (it might take a few minutes, because there are many files, and make sure to refresh the page after all uploads appear as completed, to check that no file is actually missing)

    The command CheckPreloaded will simply check that preloading took place, it won’t preload anything by itself (preloading starts automatically at the beginning of the experiment) it will just insert a pause until the resources have preloaded, or a timer has expired (5min by default, iirc)

    There are other problems with your experiment, notably that there is no list.csv file even though you have a Template command that looks for one. You should not turn the debugger off until you are ready to run your first real participant

    Jeremy

    in reply to: Results still slow to access/download? #7374
    Jeremy
    Keymaster

    Hi,

    However, when I download the results file, while there was no significant delay in doing so, it only shows the submissions from up to the second to last participant.

    How many submissions/lines do you have in your results file? There is a 100K-line limit on generating results files: if your results contain more lines than that, you will need to generate multiple results files, using the “from… to…” fields above the “Download” button

    (also, if your experiment’s UploadRecordings trial takes place before your SendResults trial—as it should—there is a possibility that your participant did have their recordings uploaded while their responses were never send to the server, if they closed their tab too early)

    Jeremy

Viewing 15 posts - 691 through 705 (of 1,522 total)