Howdy, Stranger!

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

Supported by

gabor patches in a code (v 4.0.4/5)

Hi everyone

I'm trying to create an enumeration task with equal luminance for all conditions and for that I want to use Gabor elements. I used Sigmund AI to write the code, but whatever I'm doing, it always sends errors about wrong use of colors. Every time Sigmund corrects it, I'm getting the same error, so I'm in this terrible loop.

Is it a bug? Is it me? I'll appreciate any insight...


Best,

Tali

Comments

  • edited March 22

    Hi @labovich,

    I couldn't recreate your error with colour unfortunately. I got some errors about your canvas and keyboard items instead. Here's a corrected version that goes through your loop without any issue, but with the values you set in the script, the patches show up in the right corner of the screen, which I'm pretty sure isn't what you had in mind.

    Can you tell me what the gabor patches should look like? Do you still get the error about colours with this version? If yes, could you send it to me?

    Claire

  • Hi @cvanbuck

    Thank you so much for the code!

    I tried to run it (current version, windows 10), and right after the welcome slide got this error message:


    Traceback (most recent call last):
      File "<new_inline_script.prepare>", line 68, in <module>
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\canvas.py", line 1014, in gabor
        self += Gabor(x, y, orient, freq, env=env, size=size,
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\canvas.py", line 382, in __iadd__
        self['stim%d' % self._stimnr] = element
        ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\canvas.py", line 351, in __setitem__
        value = value.construct(self)
                ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\canvas_elements.py", line 36, in construct
        return cls(canvas, *self._args, **self._kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\_gabor\gabor.py", line 29, in __init__
        Element.__init__(self, canvas, x=x, y=y, orient=orient, freq=freq,
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\_element\element.py", line 60, in __init__
        self.prepare()
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\_gabor\legacy.py", line 30, in prepare
        im = canvas._gabor(
             ^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\canvas.py", line 1171, in _gabor
        col1 = _color(col1)
               ^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_canvas\canvas.py", line 1121, in _color
        return Legacy(None, col).backend_color
               ^^^^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_color\color.py", line 66, in __init__
        self.hexcolor = self.to_hex(self.colorspec)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\openexp\_color\color.py", line 99, in to_hex
        raise InvalidColor(colorspec)
    libopensesame.exceptions.InvalidColor: 
    Error: InvalidColor
    
    Invalid color specification: #ffffff
    
    This error occurred in the prepare phase of item new_inline_script.
    


  • edited March 23

    Hi @labovich,

    I see; have you tried putting 'white' (between quotes) instead of #ffffff already? (for the col1 parameter)

    Claire

  • yes...

    Error: PythonError

    Error while executing inline script (prepare phase)

    This error occurred on line 99 in the prepare phase of item new_inline_script.

    Traceback (most recent call last):
      File "
    


  • edited March 23

    Weird... Both work for me... Maybe try uninstalling Opensesame completely, and reinstalling it with the installer package if this hasn't been done before? Are you up-to-date with your Python version too?

  • Thanks @cvanbuck ! re-installing actually worked!

  • edited March 23

    No worries, it might just have been some corrupted files or whatever, glad it works now! :)

Sign In or Register to comment.