Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# only use _localized values for label values, nothing functional:
_localized = {'expName': _translate("Experiment name"),
'Show info dlg': _translate("Show info dialog"),
'Enable Escape': _translate("Enable Escape key"),
'Experiment info': _translate("Experiment info"),
'Data filename': _translate("Data filename"),
'Full-screen window': _translate("Full-screen window"),
'Window size (pixels)': _translate("Window size (pixels)"),
'Screen': _translate('Screen'),
'Monitor': _translate("Monitor"),
'color': _translate("Color"),
'colorSpace': _translate("Color space"),
'Units': _translate("Units"),
'blendMode': _translate("Blend mode"),
'Show mouse': _translate("Show mouse"),
'Save log file': _translate("Save log file"),
'Save wide csv file':
_translate("Save csv file (trial-by-trial)"),
'Save csv file': _translate("Save csv file (summaries)"),
'Save excel file': _translate("Save excel file"),
'Save psydat file': _translate("Save psydat file"),
'logging level': _translate("Logging level"),
'Use version': _translate("Use PsychoPy version"),
'Completed URL': _translate("Completed URL"),
'Incomplete URL': _translate("Incomplete URL"),
'Output path': _translate("Output path"),
'JS libs': _translate("JS libs"),
'Force stereo': _translate("Force stereo"),
'Export HTML': _translate("Export HTML")}
thisFolder = os.path.split(__file__)[0]
#
hint=_translate("Specifies the minimum step size "
"(0 for a continuous scale, 1 for integer "
"rating scale)"),
label=_translate('Granularity'))
self.params['forceEndRoutine'] = Param(
forceEndRoutine, valType='bool', allowedTypes=[],
updates='constant', allowedUpdates=[],
hint=_translate("Should setting a rating (releasing the mouse) "
"cause the end of the routine (e.g. trial)?"),
label=_localized['forceEndRoutine'])
self.params['pos'] = Param(
pos, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate("x,y position on the screen"),
label=_localized['pos'])
self.params['size'] = Param(
size, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate(
"Size on screen. e.g. (500,10) pix for horizontal,"
"(10,500) pix for vertical"),
label=_localized['size'])
# advanced params:
self.params['flip'] = Param(
flip, valType='bool',
updates='constant', allowedUpdates=[],
hint=_translate(
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import absolute_import, print_function
from os import path
from psychopy.experiment.components import BaseVisualComponent, Param, getInitVals, _translate
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'dots.png')
tooltip = _translate('Dots: Random Dot Kinematogram')
# only use _localized values for label values, nothing functional:
_localized = {'nDots': _translate('Number of dots'),
'dir': _translate('Direction'),
'speed': _translate('Speed'),
'coherence': _translate('Coherence'),
'dotSize': _translate('Dot size'),
'dotLife': _translate('Dot life-time'),
'signalDots': _translate('Signal dots'),
'noiseDots': _translate('Noise dots'),
'fieldShape': _translate('Field shape'),
'fieldSize': _translate('Field size'),
'fieldPos': _translate('Field position'),
'refreshDots':_translate('Dot refresh rule')}
class DotsComponent(BaseVisualComponent):
"""An event class for presenting Random Dot stimuli"""
def __init__(self, exp, parentName, name='dots',
nDots=100,
from builtins import map
from os import path
import re
from psychopy.experiment.components import BaseComponent, Param, _translate
__author__ = 'Jeremy Gray'
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'ratingscale.png')
tooltip = _translate('Rating scale: obtain numerical or categorical '
'responses')
# only use _localized values for label values, nothing functional:
_localized = {'visualAnalogScale': _translate('Visual analog scale'),
'categoryChoices': _translate('Category choices'),
'scaleDescription': _translate('Scale description'),
'low': _translate('Lowest value'),
'high': _translate('Highest value'),
'labels': _translate('Labels'),
'marker': _translate('Marker type'),
'markerStart': _translate('Marker start'),
'size': _translate('Size'),
'pos': _translate('Position [x,y]'),
'tickHeight': _translate('Tick height'),
'disappear': _translate('Disappear'),
'forceEndRoutine': _translate('Force end of Routine'),
'showAccept': _translate('Show accept'),
'singleClick': _translate('Single click'),
'storeHistory': _translate('Store history'),
'storeRating': _translate('Store rating'),
'storeRatingTime': _translate('Store rating time'),
from builtins import super # provides Py3-style super() using python-future
from os import path
from psychopy.experiment.components import BaseComponent, Param, _translate
from psychopy.experiment import valid_var_re
import re
# the absolute path to the folder containing this path
thisFolder = path.abspath(path.dirname(__file__))
iconFile = path.join(thisFolder, 'joystick.png')
tooltip = _translate('Joystick: query joystick position and buttons')
# only use _localized values for label values, nothing functional:
_localized = {'saveJoystickState': _translate('Save joystick state'),
'forceEndRoutineOnPress': _translate('End Routine on press'),
'timeRelativeTo': _translate('Time relative to'),
'Clickable stimuli': _translate('Clickable stimuli'),
'Store params for clicked': _translate('Store params for clicked'),
'deviceNumber': _translate('Device number'),
'allowedButtons': _translate('Allowed Buttons')}
class JoystickComponent(BaseComponent):
"""An event class for checking the joystick location and buttons
at given timepoints
"""
categories = ['Responses']
targets = ['PsychoPy']
def __init__(self, exp, parentName, name='joystick',
startType='time (s)', startVal=0.0,
stopType='duration (s)', stopVal='',
startEstim='', durationEstim='',
self.params['startExpValue'] = Param(
startExpValue, valType='code', allowedTypes=[], updates='constant',
hint=hnt,
label=_localized['startExpValue'])
hnt = _translate("Set the value for the beginning of each routine.")
self.params['startRoutineValue'] = Param(
startRoutineValue, valType='code', allowedTypes=[], updates='constant',
hint=hnt,
label=_localized['startRoutineValue'])
hnt = _translate("Set the value for the beginning of every screen refresh.")
self.params['startFrameValue'] = Param(
startFrameValue, valType='code', allowedTypes=[],
hint=hnt,
label=_localized['startFrameValue'])
# Save options
hnt = _translate('Save the experiment start value in data file.')
self.params['saveStartExp'] = Param(
False, valType='bool',
updates='constant',
hint=hnt,
label=_localized['saveStartExp'],
categ='Save')
hnt = _translate('Save the experiment end value in data file.')
self.params['saveEndExp'] = Param(
False, valType='bool',
updates='constant',
hint=hnt,
label=_localized['saveEndExp'],
categ='Save')
hnt = _translate('Save the routine start value in data file.')
self.params['saveStartRoutine'] = Param(
False, valType='bool',
# only use _localized values for label values, nothing functional:
_localized = {'visualAnalogScale': _translate('Visual analog scale'),
'categoryChoices': _translate('Category choices'),
'scaleDescription': _translate('Scale description'),
'low': _translate('Lowest value'),
'high': _translate('Highest value'),
'labels': _translate('Labels'),
'marker': _translate('Marker type'),
'markerStart': _translate('Marker start'),
'size': _translate('Size'),
'pos': _translate('Position [x,y]'),
'tickHeight': _translate('Tick height'),
'disappear': _translate('Disappear'),
'forceEndRoutine': _translate('Force end of Routine'),
'showAccept': _translate('Show accept'),
'singleClick': _translate('Single click'),
'storeHistory': _translate('Store history'),
'storeRating': _translate('Store rating'),
'storeRatingTime': _translate('Store rating time'),
'customize_everything': _translate('Customize everything :')}
class RatingScaleComponent(BaseComponent):
"""A class for presenting a rating scale as a builder component
"""
categories = ['Responses']
def __init__(self, exp, parentName,
name='rating',
scaleDescription='',
categoryChoices='',
visualAnalogScale=False,
hint=msg,
label=_localized['noiseType'], categ=" Noise")
msg = _translate("Apply filter to noise sample? "
"[Butterworth, Gabor, Isoptopic]. A filter with parameters taken from "
"the either the Filtered (Butterworth) or Gabor/Isotropic tab will be applied to OTHER "
"noise types. [NOTE: if noise of the same type as the filter is requested the filter "
"is applied, once only, to a white noise sample.]")
self.params['filter'] = Param(
filter, valType='str', allowedTypes=[], allowedVals=['None','Butterworth','Gabor','Isotropic'],
updates='constant',
allowedUpdates=[],
hint=msg,
label=_localized['filter'], categ=" Noise")
msg = _translate("Which image component should be randomised? "
"[Amplitude,Phase]. Randomizing amplitude will keep the phase spectrum of "
"the image but set the amplitude spectrum to random values [0...1]. This keeps spatial structure in tact. "
"Randoming the phase spectrum will keep the amplitude spectrum of the image but set "
"the phase spectrum to random values [-pi...pi] in radians. This makes a noise sample with no obvious structure. ")
self.params['imageComponent'] = Param(
imageComponent, valType='str', allowedTypes=[], allowedVals=['Phase','Amplitude'],
updates='constant',
allowedUpdates=[],
hint=msg,
label=_localized['imageComponent'], categ="Image noise")
msg = _translate("(Binary, Normal and Uniform only) Size of noise elements in the stimulus units.")
self.params['noiseElementSize'] = Param(
noiseElementSize, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat', 'set every frame'],
self.targets = ['PsychoPy', 'PsychoJS']
# params
self.order = ['name',
'size', 'pos',
'ticks', 'labels', 'granularity',
'font','flip','color','styles',
]
# normal params:
# = the usual as inherited from BaseVisual plus:
self.params['ticks'] = Param(
ticks, valType='list', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Tick positions (numerical) on the scale, "
"separated by commas"),
label=_localized['ticks'])
self.params['labels'] = Param(
labels, valType='list', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Labels for the tick marks on the scale, "
"separated by commas"),
label=_localized['labels'])
self.params['granularity'] = Param(
granularity, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat'],
hint=_translate("Specifies the minimum step size "
"(0 for a continuous scale, 1 for integer "
"rating scale)"),
hint=_translate("Should setting a rating (releasing the mouse) "
"cause the end of the routine (e.g. trial)?"),
label=_localized['forceEndRoutine'])
self.params['pos'] = Param(
pos, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate("x,y position on the screen"),
label=_localized['pos'])
self.params['size'] = Param(
size, valType='code', allowedTypes=[],
updates='constant',
allowedUpdates=['constant', 'set every repeat',
'set every frame'],
hint=_translate(
"Size on screen. e.g. (500,10) pix for horizontal,"
"(10,500) pix for vertical"),
label=_localized['size'])
# advanced params:
self.params['flip'] = Param(
flip, valType='bool',
updates='constant', allowedUpdates=[],
hint=_translate(
"By default the labels will be on the bottom or "
"left of the scale, but this can be flipped to the "
"other side."),
label=_translate('Flip'),
categ='Appearance')
self.params['color'] = Param(
color, valType='str',