Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Bug : Variable font size

edited September 2016 in OpenSesame

Hi everyone,
I'm creating a numerical Stroop task in Open Sesame.
In this task, participants have to select the numerically larger number without taking into account the physical size of the numbers.
For example, in the incongruent condition you can have a big "2" and a little "6", and you have to select the 6.

So, in a sketchpad, I wrote [nb1] and [nb2] to display my numbers. In the script, at "font size", I wrote [size_nb1] and [size_nb2] for each number.

The experiment starts well, I get my big and little numbers. My problem is I can't finish the experimental block because, at some point (randomly), the program crashes and I get the following error message :

The experiment did not finish normally for the following reason: font_size should be numeric (float or int), not

Details
item-stack: experiment[run].block_1[run].experimental_sequence_1[run].expe_loop_1[run].trial_sequence_1[prepare].target[prepare]

Do you know what I can do to fix this ?

Thanks for your help

Thomas

Comments

  • Hi Thomas,

    Apparently, one of your font_size values is not a numerical value. Best check your list carefully; maybe there's a value here with a comma instead of a point? (e.g. 13,5 instead of 13.5)

    Cheers

    Josh

  • And you didn't copy the error message completely. Based on the continuation of that error message we would know what the value of font_size was. Could have been a list as well..

    Cheers

  • @sebastiaan I just tried to work out this problem with Thomas, but there seems to be a more serious bug underlying this. Since the canvas.text() command doesn't come with a size argument, one has to set the font size manually, for example with canvas.set_font(), or in the script of a sketchpad with the parameter font_size. I tried both, but the experiment simply ends at a random point with the incomplete error report "font_size should be numeric (float or int), not".

    When using a sketchpad, there will already be the following warning (before running the experiment): "Font size '[specific_trial_value]' is invalid or variably defined, using 18". When running the experiment, it doesn't use size 18; it actually does use the specific_trial_value - until it crashes.

    Any idea how to solve this?

    Cheers

    Joshua

  • Hi,
    Since that I could'nt manage to get my experiment run by displaying text, I choose to try a different way to do things.
    So now I use the same approach as in the gaze cuing tutorial. I'm still using a sketchap, but now I use images​ instead of text.

    I created a variable "[scale_OP]", which can be "1.0" or "0.6".
    The script in my sketchpad is :
    set duration 0
    set description "Displays stimuli"
    draw image center=1 file="OP_[OP1].png" scale="[scale_OP1]" show_if=always x=-64 y=0 z_index=0
    draw image center=1 file="OP_[OP2].png" scale="[scale_OP2]" show_if=always x=64 y=0 z_index=0

    Nevertheless, I still have an error message, randomly during the experiment.
    I get this error message :

    Stopped
    The experiment did not finish normally for the following reason:

    Unexpected error
    Details

    item-stack: experiment[run].block_2[run].experiment_sequence_2[run].expe_block_2[run].trial_sequence_2[prepare].target[prepare]
    exception message: The picture file 'OP_.png' does not exist
    time: Wed Sep 14 16:26:00 2016
    exception type: IOError

    Do you have an idea of what can be wrong here ?

    Again, thanks for your help,

  • Hi Thomas,

    It seems the variable OP1 or OP2 has no value and so you get this error:

    exception message: The picture file 'OP_.png' does not exist

    Possibly you define this variable OP1 or OP2 in a loop item where there is an empty entry (an empty cell in the loop table)?

    Best,
    Jarik

  • Hi Jarik,
    I verified the variables OP1 and OP2 and there is no empty cells in the loop table.
    Moreover, the problems appears randomly during the experiment (e.g., after 9 items; after 42 items), and not specifically at some point.
    I tried to change the values from "2" to "2.0" but the problem remains.
    Best,
    Thomas

  • Could you upload your experiment? Maybe I can take a quick look.

    Best,
    Jarik

  • Hi Thomas,

    What a smart way to send your experiment via a private message and thanks for the approval to share the solution publicly here so others can benefit.

    The thing is the last cycle (or row) 130 is completely empty and the Order is set to random so this explains the error and the random behavior. I guess you want to set the number of Cycles to 129

    Best,
    Jarik

  • @sebastiaan I just tried to work out this problem with Thomas, but there seems to be a more serious bug underlying this. Since the canvas.text() command doesn't come with a size argument, one has to set the font size manually, for example with canvas.set_font(), or in the script of a sketchpad with the parameter font_size. I tried both, but the experiment simply ends at a random point with the incomplete error report "font_size should be numeric (float or int), not".

    This conversation slipped under the radar for me. Just to chip in on this one comment: There actually is a style keyword font_size, but it's missing from the documentation. But the following should work (untested, typing from my tablet):

    c = canvas()
    c.text('some text', font_size=10)
    c.show()
    

    In any case, I'll take a look at what's going on, and whether there's indeed a bug.

  • Hi guys,

    I cannot find any bug in specifying variable font sizes, neither in an inline_script nor in a sketchpad. So the problem is likely something else, such as (as the error message also says, and as Jarik's screenshot suggests) that you've specified an empty value.

    That being said, I did spot one minor bug while looking into this: When specifying a variable font size in a sketchpad and then editing the text, the font size is reset to a default (non-variable) value. But that's not the cause of the issue here.

    Cheers,
    Sebastiaan

Sign In or Register to comment.