portugueslab / stytra

A modular package to control stimulation and track behaviour
http://www.portugueslab.com/stytra/
GNU General Public License v3.0
41 stars 26 forks source link

MovingGrating stimulus and colors #35

Closed MarcoGarb closed 4 years ago

MarcoGarb commented 4 years ago

I have to compliment you for he great work you've done with this program. It is quite intuitive to install and use!

With my very scarce knowledge in programming, I am trying to generate a Moving grating stimulus that features two different colors. To these regards I have two questions for you:

I hope I have been clear enough with my questions. Again congrats for this very nice program!

vigji commented 4 years ago

Hi @MarcoGarb! Thank you very much for trying out our software and giving us feedback! :)

  • I cannot find a way to make the color-choice an editable parameter, nor I can find the correct syntax on the documentation to do so. Is there a way or should I go back to my script any time I want to change things?

Unfortunately, the lightparam package does not provide currently a way to edit color tuples. This might be implemented in the future, but it is definitively a bit of work and low priority. In the meantime, a way around this would be to have 3 int parameters for the R, G and B values that are then combined when instantiating the Stimulus object:

        ...
        self.col1_R = Param(0, limits=(0, 255))
        self.col1_G = Param(0, limits=(0, 255))
        self.col1_B = Param(0, limits=(0, 255))

    def get_stim_sequence(self):
        ...
        color = (self.col1_R, self.col1_G, self.col1_G)
        MovingGratingStimulus(
                df_param=df,
                grating_color_1= color )

...

It is not the most elegant solution but it should work.

  • The PaintGrating stimulus, from which the MovingGrating stimulus is based, features (at least code-wise) the possibility to change both stripes colors. However, when defining them with grating_col_1 and grating_col_2, the stimulus shows only one color and black stripes where the second color should be. Do I get this because with the movement the software cannot actually show two different colors? Is there a way to do this?

I am sorry, this is definitively a bug, as we use in the lab only black as the second color for this stimulus! I am fixing this and will release a patch soon!

MarcoGarb commented 4 years ago

Thank you very much for the clarification!

I will be anxiously waiting for the patch =) Keep up the good work!

vigji commented 4 years ago

I am very sorry this took so long, but I took the chance to update&streamline a bit our deployment pipeline :) It should work now! Let me know that after either pip upgrading or installing latest GitHub version it is fixed.

MarcoGarb commented 4 years ago

Hello! It did not took long at all! I just tested it and It now works perfectly, thanks a lot!

On a side note, I noticed that the script I prepared before the update had:

from stytra import Stytra, Protocol However when running the script after the patch, Protocol could only be found by importing it as such:

from stytra.core import Protocol

Hope this helps =)

vigji commented 4 years ago

Yuuuup, very important to note :D thanks a lot for the report!