Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/psychopy/psychopy
Browse files Browse the repository at this point in the history
* 'master' of git://github.com/psychopy/psychopy:
  FF: still didn't get the import of numpy functions correct
  FF: forgot to add numpy imports to handle new deg2cm with correctFlat=True
  FF: rewritten and tested deg2cm with support for flat-correction
  ENH: Builder moved info dialog stuff to Component Settings>BasicSettings
  DOCS: updated version ready for release
  FF: new buglet in window creation from Builder when units are not from prefs
  FF: minor fixes to window to handle corner cases of new units and shaders code
  FF: forgot to import numpy for monitorunittools
  DOCS: changelog
  ENH: added 'degFlat' and 'degPosFlat' units options for stimuli
  REF: refactored convertToPix() to use a dict of functions (Sol's idea)
  ENH: plaid demo should use blendMode='add'
  FF: in Builder, for blendMode='add' you also need useFBO=True
  FF: blendMode='add' wasn't scaled correctly - needed adjustment to shaders
  ENH: Builder timing now stops at t-win.monitorFramePeriod*0.75 rather than t
  BF: visual.py should have the openWindows list in its namespace
  ENH: Builder ExpSettings now supports blendMode=add/avg but the FBO isn't working correctly
  • Loading branch information
jeremygray committed Feb 25, 2014
2 parents 64b2188 + 53c4e85 commit 30e2a59
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 71 deletions.
2 changes: 1 addition & 1 deletion buildExeInstaller.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Section "PsychoPy" PsychoPy

;Store installation folder
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayName" "PsychoPy2 (Standalone)"
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayVersion" "1.78.00"
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayVersion" "1.80.00"
WriteRegStr HKLM "${REG_UNINSTALL}" "DisplayIcon" "$INSTDIR\app\Resources\psychopy.ico"
WriteRegStr HKLM "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""

Expand Down
34 changes: 31 additions & 3 deletions docs/source/builder/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,38 @@ The settings menu can be accessed by clicking the icon at the top of the window.
Settings
==========

Basic settings
~~~~~~~~~~~~~~~

Experiment name:
A name that will be stored in the metadata of the data file.

Show info dlg:
If this box is checked then a dialog will appear at the beginning of the experiment allowing the `Experiment Info` to be changed.

Experiment Info:
This is a python dictionary object that stores information about the current experiment (up to 7 fields can be used). This information will be saved with any data files and so can be used for storing information about the current run of the study. The information stored here can also be used within the experiment. For example, if the `Experiment Info` was {'participant':'jwp', 'ori':10} then Builder :doc:`components` could access expInfo['ori'] to retrieve the orientation set here. Obviously this is a useful way to run essentially the same experiment, but with different conditions set at run time.
This information will be presented in a dialog box at the start and will be saved with any data files and so can be used for storing information about the current run of the study. The information stored here can also be used within the experiment. For example, if the `Experiment Info` included a field called `ori` then Builder :doc:`components` could access expInfo['ori'] to retrieve the orientation set here. Obviously this is a useful way to run essentially the same experiment, but with different conditions set at run-time.

Enable escape:
If ticked then the `Esc` key can be used to exit the experiment at any time (even without a keyboard component)

Data settings
~~~~~~~~~~~~~~~~

.. _dataFileName:

Data filename: (new in version 1.80.00):
A :ref:`formatted string <formattedStrings>` to control the base filename and path, often based on variables such as the date and/or the participant. This base filename will be given the various extensions for the different file types as needed. Examples::
# all in data folder: data/JWP_memoryTask_2014_Feb_15_1648
'data/%s_%s_%s' %(expInfo['participant'], expName, expInfo['date'])
# group by participant folder: data/JWP/memoryTask-2014_Feb_15_1648
'data/%s/%s-%s' %(expInfo['participant'], expName, expInfo['date'])
# put into dropbox: ~/dropbox/data/memoryTask/JWP-2014_Feb_15_1648
# on windows you may need to replace ~ with your hom directory
'~/dropbox/data/%s/%s-%s' %(expName, expInfo['participant'], expInfo['date'])

Save Excel file:
If this box is checked an Excel data file (.xlsx) will be stored.
Expand All @@ -29,6 +56,9 @@ Save log file
Logging level
How much detail do you want to be output to the log file, if it is being saved. The lowest level is `error`, which only outputs error messages; `warning` outputs warnings and errors; `info` outputs all info, warnings and errors; `debug` outputs all info that can be logged. This system enables the user to get a great deal of information while generating their experiments, but then reducing this easily to just the critical information needed when actually running the study. If your experiment is not behaving as you expect it to, this is an excellent place to begin to work out what the problem is.

Screen settings
~~~~~~~~~~~~~~~~

Monitor
The name of the monitor calibration. Must match one of the monitor names from :doc:`../general/monitors`.

Expand All @@ -43,5 +73,3 @@ Window size:

Units
The default units of the window (see :doc:`../general/units`). These can be overridden by individual :doc:`components`.


16 changes: 16 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ PsychoPy 1.80
PsychoPy 1.80.00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Improvements to user interface:
* the glitch that prevented scrolling the Routine view is gone (win32)
* dialog boxes in the Builder now have tabs for categories of controls
* Code Components have much more space for each piece of code (again due to tabs)
* ADDED: In Builder you can now customise the data filename/path in the Experiment Settings. Any variables in the `expInfo` dialog box can be used to create this path. See :ref:`dataFileName` for further info
* ADDED: support for advanced rendering modes. Can now 'add' rather than average when using transparency. This is better for visual compound stimuli like plaids, and essential for colored anaglyph stimuli where the resulting image needs to be the sum of the left and right eye images.
* ADDED: new visual unit options: 'degFlatPos' and 'degFlat' provide more accurate conversions from degrees to pixels for drawing stimuli (although they're more accurate, accounting for the flat screen, they may look strange because 1 degree gets larger with greater eccentricity on a flat screen). The previous unit 'deg' still exists and remains default as, for many studies, these remain desirable
* ADDED: wider support for the functions `contains` and `overlaps`. Most stimuli now have these methods. Also they can now be used irrespective of whether the stimulus and other object have the same units (they used only to work for units of pix)
* ADDED: support for other shapes in the Aperture stimulus (and its Builder Component). You can either specify the number of vertices `nVert` and a `size` to get a regular polygon aperture, or you can provide a set of arbitrary vertices as your `shape` argument
* :blue:`CHANGED: Size of 'square' or 'triangle' apertures used to represent the radius of the circle on which their vertices lay. It is now a height/width as you would more likely expect. This means aperture code in scripts may need rewriting to be smaller.`
* IMPROVED: stimulus duration is now more precise when using `duration (s)` or `time (s)` although using `nFrames` option is still advised for brief stimuli
* IMPROVED: there are now fewer irrelevant lines in the log file as stimuli are initially created
* FIXED: variable names in Builder are now case-sensitive again (they were being forced to lower case when importing csv files)
* FIXED: incorrect equation for the Cumulative Normal fitting function
* FIXED: If your variable had a new line character in it this was causing a new line to be started in the csv data file. These are now handled correctly

* ADDED: RatingScale markerStart position can be arbitrary, e.g., can start between items or beyond the end of scale
* ADDED: RatingScale tickHeight can be used to control the height of tickMarks, including no tick marks (tickHeight=0)
* ADDED: RatingScale marker='hover' is similar to HTML-style hovering over clickable elements
Expand Down
17 changes: 16 additions & 1 deletion psychopy/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,27 @@ PsychoPy 1.80
PsychoPy 1.80.00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Improvements to user interface:
* the glitch that prevented scrolling the Routine view is gone (win32)
* dialog boxes in the Builder now have tabs for categories of controls
* Code Components have much more space for each piece of code (again due to tabs)
* ADDED: In Builder you can now customise the data filename/path in the Experiment Settings. Any variables in the `expInfo` dialog box can be used to create this path
* ADDED: support for advanced rendering modes. Can now 'add' rather than average when using transparency. This is better for visual compound stimuli like plaids, and essential for colored anaglyph stimuli where the resulting image needs to be the sum of the left and right eye images.
* ADDED: new visual unit options: 'degFlatPos' and 'degFlat' provide more accurate conversions from degrees to pixels for drawing stimuli (although they're more accurate, accounting for the flat screen, they may look strange because 1 degree gets larger with greater eccentricity on a flat screen). The previous unit 'deg' still exists and remains default as, for many studies, these remain desirable
* ADDED: wider support for the functions `contains` and `overlaps`. Most stimuli now have these methods. Also they can now be used irrespective of whether the stimulus and other object have the same units (they used only to work for units of pix)
* ADDED: support for other shapes in the Aperture stimulus (and its Builder Component). You can either specify the number of vertices `nVert` and a `size` to get a regular polygon aperture, or you can provide a set of arbitrary vertices as your `shape` argument
* CHANGED: Size of 'square' or 'triangle' apertures used to represent the radius of the circle on which their vertices lay. It is now a height/width as you would more likely expect. This means aperture code in scripts may need rewriting to be smaller.
* IMPROVED: stimulus duration is now more precise when using `duration (s)` or `time (s)` although using `nFrames` option is still advised for brief stimuli
* IMPROVED: there are now fewer irrelevant lines in the log file as stimuli are initially created
* FIXED: variable names in Builder are now case-sensitive again (they were being forced to lower case when importing csv files)
* FIXED: incorrect equation for the Cumulative Normal fitting function
* FIXED: If your variable had a new line character in it this was causing a new line to be started in the csv data file. These are now handled correctly

*psychopy.visual.RatingScale Changes* :

* ADDED: RatingScale markerStart position can be arbitrary, e.g., can start between items or beyond the end of scale
* ADDED: RatingScale tickHeight can be used to control the height of tickMarks, including no tick marks (tickHeight=0)
* ADDED: RatingScale marker='hover' is similar to HTML-style hovering over clickable elements

* CHANGED: Builder: remove option: choiceLabelsAboveLine; change lowAnchorText, highAnchorText -> labels
* CHANGED: skipping a rating now adds None as the final element in the history
* CHANGED: the default minTime is shorter, now 0.4s
Expand Down
2 changes: 1 addition & 1 deletion psychopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#--------------------------------------------------------------------------

#version info for PsychoPy
__version__='1.79.01'
__version__='1.80.00'
__license__='GNU GPLv3 (or more recent equivalent)'
__author__='Jonathan Peirce'
__author_email__='jon@peirce.org.uk'
Expand Down
14 changes: 8 additions & 6 deletions psychopy/_shadersPyglet.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def compileShader( source, shaderType ):
void main() {
vec4 textureFrag = texture2D(texture,gl_TexCoord[0].st);
gl_FragColor.rgb = textureFrag.rgb;
//! if too high then show red/black noise
if ( gl_FragColor.r>1.0 || gl_FragColor.g>1.0 || gl_FragColor.b>1.0) {
gl_FragColor.rgb = vec3 (rand(gl_TexCoord[0].st), 0, 0);
}
//! if too low then show red/black noise
else if ( gl_FragColor.r<0.0 || gl_FragColor.g<0.0 || gl_FragColor.b<0.0) {
gl_FragColor.rgb = vec3 (0, 0, rand(gl_TexCoord[0].st));
}
Expand All @@ -106,11 +108,11 @@ def compileShader( source, shaderType ):
gl_FragColor.a = gl_Color.a*textureFrag.a;
}
'''
fragSignedColorTex_withFBO = '''
fragSignedColorTex_adding = '''
uniform sampler2D texture;
void main() {
vec4 textureFrag = texture2D(texture,gl_TexCoord[0].st);
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0);
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0)*0.5;
gl_FragColor.a = gl_Color.a * textureFrag.a;
}
'''
Expand All @@ -133,13 +135,13 @@ def compileShader( source, shaderType ):
gl_FragColor.rgb = (textureFrag.rgb* (gl_Color.rgb*2.0-1.0)+1.0)/2.0;
}
'''
fragSignedColorTexMask_withFBO = '''
fragSignedColorTexMask_adding = '''
uniform sampler2D texture, mask;
void main() {
vec4 textureFrag = texture2D(texture,gl_TexCoord[0].st);
vec4 maskFrag = texture2D(mask,gl_TexCoord[1].st);
gl_FragColor.a = gl_Color.a * maskFrag.a * textureFrag.a;
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0);
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0)*0.5;
}
'''
fragSignedColorTexMask1D = '''
Expand All @@ -152,14 +154,14 @@ def compileShader( source, shaderType ):
gl_FragColor.rgb = (textureFrag.rgb* (gl_Color.rgb*2.0-1.0)+1.0)/2.0;
}
'''
fragSignedColorTexMask1D_withFBO = '''
fragSignedColorTexMask1D_adding = '''
uniform sampler2D texture;
uniform sampler1D mask;
void main() {
vec4 textureFrag = texture2D(texture,gl_TexCoord[0].st);
vec4 maskFrag = texture1D(mask,gl_TexCoord[1].s);
gl_FragColor.a = gl_Color.a * maskFrag.a*textureFrag.a;
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0);
gl_FragColor.rgb = textureFrag.rgb * (gl_Color.rgb*2.0-1.0)*0.5;
}
'''
vertSimple = """
Expand Down
4 changes: 2 additions & 2 deletions psychopy/app/builder/components/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def writeStopTestCode(self,buff):
"""Test whether we need to stop
"""
if self.params['stopType'].val=='time (s)':
buff.writeIndented("elif %(name)s.status == STARTED and t >= %(stopVal)s:\n" %(self.params))
buff.writeIndented("elif %(name)s.status == STARTED and t >= (%(stopVal)s-win.monitorFramePeriod*0.75): #most of one frame period left\n" %(self.params))
#duration in time (s)
elif self.params['stopType'].val=='duration (s)' and self.params['startType'].val=='time (s)':
buff.writeIndented("elif %(name)s.status == STARTED and t >= (%(startVal)s + %(stopVal)s):\n" %(self.params))
buff.writeIndented("elif %(name)s.status == STARTED and t >= (%(startVal)s + (%(stopVal)s-win.monitorFramePeriod*0.75)): #most of one frame period left\n" %(self.params))
elif self.params['stopType'].val=='duration (s)':#start at frame and end with duratio (need to use approximate)
buff.writeIndented("elif %(name)s.status == STARTED and t >= (%(name)s.tStart + %(stopVal)s):\n" %(self.params))
#duration in frames
Expand Down
39 changes: 25 additions & 14 deletions psychopy/app/builder/components/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SettingsComponent:
"""This component stores general info about how to run the experiment"""
def __init__(self, parentName, exp, expName='', fullScr=True, winSize=[1024,768], screen=1, monitor='testMonitor', showMouse=False,
saveLogFile=True, showExpInfo=True, expInfo="{'participant':'', 'session':'001'}",units='use prefs',
logging='exp', color='$[0,0,0]', colorSpace='rgb', enableEscape=True,
logging='exp', color='$[0,0,0]', colorSpace='rgb', enableEscape=True, blendMode='avg',
saveXLSXFile=False, saveCSVFile=False, saveWideCSVFile=True, savePsydatFile=True,
savedDataFolder='', filename="'xxxx/%s_%s_%s' %(expInfo['participant'], expName, expInfo['date'])"):
self.type='Settings'
Expand All @@ -25,13 +25,24 @@ def __init__(self, parentName, exp, expName='', fullScr=True, winSize=[1024,768]
print filename[0:5]
#params
self.params={}
self.order=['expName','Show info dlg','Experiment info','filename',
self.order=['expName','Show info dlg','Experiment info',
'Data filename',
'Save excel file','Save csv file','Save wide csv file','Save psydat file','Save log file','logging level',
'Monitor','Screen', 'Full-screen window','Window size (pixels)',
'color','colorSpace','Units',]
#basic params
self.params['expName']=Param(expName, valType='str', allowedTypes=[],
hint="Name of the entire experiment (taken by default from the filename on save)",
label="Experiment name")
self.params['Show info dlg']=Param(showExpInfo, valType='bool', allowedTypes=[],
hint="Start the experiment with a dialog to set info (e.g.participant or condition)",
categ='Basic')
self.params['Enable Escape']=Param(enableEscape, valType='bool', allowedTypes=[],
hint="Enable the <esc> key, to allow subjects to quit / break out of the experiment")
self.params['Experiment info']=Param(expInfo, valType='code', allowedTypes=[],
hint="The info to present in a dialog box. Right-click to check syntax and preview the dialog box.",
categ='Basic')
#data params
self.params['Data filename']=Param(filename, valType='code', allowedTypes=[],
hint="Code to create your custom file name base. Don't give a file extension - this will be added.",
categ='Data')
Expand All @@ -58,6 +69,11 @@ def __init__(self, parentName, exp, expName='', fullScr=True, winSize=[1024,768]
allowedVals=['use prefs', 'deg','pix','cm','norm','height'],
hint="Units to use for window/stimulus coordinates (e.g. cm, pix, deg)",
categ='Screen')
self.params['blendMode']=Param(blendMode, valType='str', allowedTypes=[],
label='Blend mode',
allowedVals=['add','avg'],
hint="Should new stimuli be added or averaged with the stimuli that have been drawn already",
categ='Screen')
self.params['Show mouse']=Param(showMouse, valType='bool', allowedTypes=[],
hint="Should the mouse be visible on screen?",
categ='Screen')
Expand All @@ -78,14 +94,6 @@ def __init__(self, parentName, exp, expName='', fullScr=True, winSize=[1024,768]
self.params['Save psydat file']=Param(savePsydatFile, valType='bool', allowedVals=[True],
hint="Save data from loops in psydat format. This is useful for python programmers to generate analysis scripts.",
categ='Data')
self.params['Show info dlg']=Param(showExpInfo, valType='bool', allowedTypes=[],
hint="Start the experiment with a dialog to set info (e.g.participant or condition)",
categ='Data')
self.params['Enable Escape']=Param(enableEscape, valType='bool', allowedTypes=[],
hint="Enable the <esc> key, to allow subjects to quit / break out of the experiment")
self.params['Experiment info']=Param(expInfo, valType='code', allowedTypes=[],
hint="The info to present in a dialog box. Right-click to check syntax and preview the dialog box.",
categ='Data')
self.params['logging level']=Param(logging, valType='code',
allowedVals=['error','warning','data','exp','info','debug'],
hint="How much output do you want in the log files? ('error' is fewest messages, 'debug' is most)",
Expand Down Expand Up @@ -188,11 +196,14 @@ def writeWindowCode(self,buff):
size=self.params['Window size (pixels)']
buff.writeIndented("win = visual.Window(size=%s, fullscr=%s, screen=%s, allowGUI=%s, allowStencil=%s,\n" %
(size, fullScr, screenNumber, allowGUI, allowStencil))
buff.writeIndented(" monitor=%(Monitor)s, color=%(color)s, colorSpace=%(colorSpace)s" %(self.params))
buff.writeIndented(" monitor=%(Monitor)s, color=%(color)s, colorSpace=%(colorSpace)s,\n" %(self.params))
if self.params['blendMode'].val:
buff.writeIndented(" blendMode=%(blendMode)s, useFBO=True,\n" %(self.params))

if self.params['Units'].val=='use prefs': unitsCode=""
else: unitsCode=", units=%s" %self.params['Units']
buff.write(unitsCode+")\n")
if self.params['Units'].val=='use prefs':
buff.write(" )\n")
else:
buff.write(" units=%s)\n" %self.params['Units'])

if 'microphone' in self.exp.psychopyLibs: # need a pyo Server
buff.writeIndentedLines("\n# Enable sound input/output:\n"+
Expand Down
Loading

0 comments on commit 30e2a59

Please sign in to comment.