Attention
To run locally, the code for these interactive demos requires a Jupyter Notebook environment, and the Panel extension.
Text#
stimupy.components.texts.text()
import param
class TextParams(param.Parameterized):
# Image size parameters
height = param.Integer(default=10, bounds=(1, 20), doc="Height in degrees")
width = param.Integer(default=10, bounds=(1, 20), doc="Width in degrees")
ppd = param.Integer(default=20, bounds=(1, 40), doc="Pixels per degree")
# Text parameters
text_content = param.String(default="Hello World", doc="Text content")
fontsize = param.Integer(default=30, bounds=(1, 60), doc="Font size")
align = param.Selector(default="center", objects=["left", "center", "right"], doc="Text alignment")
# direction = param.Selector(default="ltr", objects=["ltr", "rtl"], doc="Text direction")
# Intensity parameters
intensity_text = param.Number(default=1.0, bounds=(0, 1), step=0.01, doc="Text intensity")
intensity_background = param.Number(default=0.0, bounds=(0, 1), step=0.01, doc="Background intensity")
# Additional parameters
add_mask = param.Boolean(default=False, doc="Add mask to visualization")
def get_stimulus_params(self):
return {
"text": self.text_content,
"visual_size": (self.height, self.width),
"ppd": self.ppd,
"intensity_text": self.intensity_text,
"intensity_background": self.intensity_background,
"fontsize": self.fontsize,
"align": self.align,
# "direction": self.direction,
}
from stimupy.components.texts import text
from stimupy._docs.display_stimulus import InteractiveStimDisplay
# Create and display the interactive text
text_params = TextParams()
disp = InteractiveStimDisplay(text, text_params)
disp.layout