Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Builder not correctly updating code when options are changed #6250

Open
MichaelWoodc opened this issue Feb 19, 2024 · 3 comments
Open
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior.

Comments

@MichaelWoodc
Copy link

PsychoPy Version

2023.2.3

What OS are your PsychoPy running on?

Windows 10

Bug Description

When updating the experiment in builder, the code doesn't get updated automatically. Please see that the sizes for both different stim are the same:
Screen Shot 02-19-24 at 12 04 PM 001
Screen Shot 02-19-24 at 12 04 PM
But, the result is this in code:

"
option1Image = visual.ImageStim(
win=win,
name='option1Image',
image='fordvferrari1.jpg', mask=None, anchor='center',
ori=0.0, pos=((-win.size[0]/3), 0), size=1.0,
color=[1,1,1], colorSpace='rgb', opacity=None,
flipHoriz=False, flipVert=False,
texRes=128.0, interpolate=True, depth=-3.0)

option3Image = visual.ImageStim(
    win=win,
    name='option3Image', 
    image='fordvferrari1.jpg', mask=None, anchor='center',
    ori=0.0, pos=(win.size[0]/3, 0), size=(win.size[0]/5,None),
    color=[1,1,1], colorSpace='rgb', opacity=None,
    flipHoriz=False, flipVert=False,
    texRes=128.0, interpolate=True, depth=-7.0)

"

The result visually for this issue is:
sizediff

its a very small issue in the case of these images, but you can see the difference. Please see attached code files:
test.zip

Expected Behaviour

I would expect the image sizes to update in the code after updating them in the builder

Steps to Reproduce

  1. open provided code
  2. run experiment
  3. screenshot images, notice how two identical ones are different sizes.
  4. generate python script and also notice the differences
    ...

Additional context

No response

@MichaelWoodc MichaelWoodc added the 🐞 bug Issue describes a bug (crash or error) or undefined behavior. label Feb 19, 2024
@peircej
Copy link
Member

peircej commented Feb 22, 2024

You have set the size of option1Image to be set every repeat rather than constant. When you do this the size is initially set to a fixed arbitrary value (in this case a value of 1) and only gets set to (win.size[0]/5,None) when the trial Routine actually begins (on each repeat of the loop). Your option3Image is set to constant so it gets its size setting applied when it is initialised.

So the image init code being written here is exactly as expected, but the code change you're looking for is not where you expected.

Now, there's still a question of why are the images are a different size when set during init or set later, and that's one we'll need to investigate 🤔

@MichaelWoodc
Copy link
Author

You have set the size of option1Image to be set every repeat rather than constant. When you do this the size is initially set to a fixed arbitrary value (in this case a value of 1) and only gets set to (win.size[0]/5,None) when the trial Routine actually begins (on each repeat of the loop). Your option3Image is set to constant so it gets its size setting applied when it is initialised.

So the image init code being written here is exactly as expected, but the code change you're looking for is not where you expected.

Now, there's still a question of why are the images are a different size when set during init or set later, and that's one we'll need to investigate 🤔

Sharp eye! I hadn't noticed that! I'm editing everything next week, I'll see if changing those things you pointed out on my end can have a different effect. Thanks!

@MichaelWoodc
Copy link
Author

I am thinking these issues may be related. The experiment I had been working on utilized Emotiv EEG components. I had to do some changes and disabled the Emotiv EEG components. After re-enabling them, I consistently recieved errors that cortex_rec_2 is not defined, or something along those lines. After creating an identical experiment from scratch it works!

I think that I am experiencing these issues when I disable a component for testing, then reenable it after, but I'm not entirely sure yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior.
Projects
None yet
Development

No branches or pull requests

2 participants