Repository: psychopy/psychopy

Issue:
builder: blank start time -> syntax error
its possible to create syntax like this if the start time is blank
 if t>= and wait_for_scanner.status==NOT_STARTED:



Discussion:

Resolving patch:
diff --git a/psychopy/app/builder/components/_base.py b/psychopy/app/builder/components/_base.py
--- a/psychopy/app/builder/components/_base.py
+++ b/psychopy/app/builder/components/_base.py
@@ -58,6 +58,8 @@ def writeStartTestCode(self,buff):
         """Test whether we need to start
         """
         if self.params['startType'].val=='time (s)':
+            if not self.params['startVal'].val.strip():
+                self.params['startVal'].val = '0.0'
             buff.writeIndented("if t>=%(startVal)s and %(name)s.status==NOT_STARTED:\n" %(self.params))
         elif self.params['startType'].val=='frame N':
             buff.writeIndented("if frameN>=%(startVal)s and %(name)s.status==NOT_STARTED:\n" %(self.params))
diff --git a/psychopy/hardware/emulator.py b/psychopy/hardware/emulator.py
--- a/psychopy/hardware/emulator.py
+++ b/psychopy/hardware/emulator.py
@@ -69,7 +69,8 @@ def __init__(self, TR=1.0, volumes=10, sync='5', skip=0, sound=False):
                 sync:    character used as flag for sync timing, default='5'
                 skip:    how many frames to silently omit initially during T1 
                          stabilization, no sync pulse. Not needed to test script
-                         timing, but will give more accurate feel to start of run
+                         timing, but will give more accurate feel to start of run.
+                         aka "discdacqs".
                 sound:   play a tone, slightly shorter duration than TR
         """
         if TR < 0.1: 
@@ -214,6 +215,7 @@ def launchScan(win, settings, globalClock=None, simResponses=None,
     except ValueError:
         raise ValueError("wait_timeout must be number-like, but instead it was %s." % str(wait_timeout))
     runInfo = "vol: %(volumes)d  TR: %(TR).3fs  skip: %(skip)d  sync: '%(sync)s'" % (settings)
+    logging.exp('launchScan: ' + runInfo)
     instr = visual.TextStim(win, text=instr, height=.05, pos=(0,0), color=.4)
     parameters = visual.TextStim(win, text=runInfo, height=.05, pos=(0,-0.5), color=.4)
     
@@ -259,6 +261,7 @@ def launchScan(win, settings, globalClock=None, simResponses=None,
             raise TimeoutError('Waiting for scanner has timed out in %.3f seconds.' % wait_timeout)
     if globalClock:
         globalClock.reset()
+    logging.exp('launchScan: start of scan')
     win.flip() # blank the screen on first sync pulse received
     elapsed = 1 # one sync pulse has been caught so far
     
diff --git a/psychopy/microphone.py b/psychopy/microphone.py
--- a/psychopy/microphone.py
+++ b/psychopy/microphone.py
@@ -17,8 +17,6 @@
 
 __author__ = 'Jeremy R. Gray'
 
-ONSET_TIME_HERE = '!ONSET_TIME_HERE!'
-
 global haveMic
 haveMic = False # goes True in switchOn, if can import pyo; goes False in switchOff
 
@@ -101,7 +99,7 @@ def __init__(self, name='mic', file='', saveDir='', sampletype=0):
         if file:
             self.wavOutFilename = file
         else:
-            self.wavOutFilename = os.path.join(self.saveDir, name + ONSET_TIME_HERE +'.wav')
+            self.wavOutFilename = os.path.join(self.saveDir, name + '.wav')
         if not self.saveDir:
             self.wavOutFilename = os.path.abspath(self.wavOutFilename)
         else:
@@ -146,9 +144,10 @@ def record(self, sec, file='', block=True):
         logging.data('%s: Record: onset %.3f, capture %.3fs' %
                      (self.loggingId, self.onset, self.duration) )
         if not file:
-            self.savedFile = self.wavOutFilename.replace(ONSET_TIME_HERE, '-%.3f' % self.onset)
+            onsettime = '-%.3f' % self.onset
+            self.savedFile = onsettime.join(os.path.splitext(self.wavOutFilename))
         else:
-            self.savedFile = os.path.abspath(file).strip('.wav')+'.wav'
+            self.savedFile = os.path.abspath(file).strip('.wav') + '.wav'
         
         t0 = core.getTime()
         self.recorder.run(self.savedFile, self.duration, self.sampletype)


Test patch: