예제 #1
0
 def updateProgress(self,bid):
     """
     Only call this once an action (or structural scan) is done.
     """
     # do nothing if progress > bid (because we're redoing something)
     curProg= lib.get_node(self.json, self.vNodePath + j.VPROGRESS)
     if curProg == "":    # beginning of a visit, or we're in redo mode.
         bt.setProgress(bid, bt.get_visit(bid,self.json))
     elif bt.compareBids(curProg, bid):   # step
         print "new progress will be",bid
         bt.setProgress(bid, bt.get_visit(bid,self.json))
     else:
         print "completed", bid, ", but that's less than", curProg
     return
예제 #2
0
def checkVisitDir(subject,visit,group,myJson):    
    v = int(visit)
    maxV = len(VISIT_LIST)  ## off-by-one error???
    if v > maxV:   ##obo danger
        print "ERROR checkVisitDir: requested",v, "but the max visit number is", maxV
        raise Exception("Invalid visit number requested.")
    if v < 0:  ## supports visits[-1] indexing
        v = maxV + 1 + v
    subjDir = checkSubjDir(subject)  # checks/creates subjDir
    myVisitDir = getVisitDir(subject, v)
    if not os.path.exists(myVisitDir):
        raise OSError("Can't find this visit directory! %s"%myVisitDir)
    vType = get_node(bt.get_visit(v, myJson), VTYPE)
    # for realtime visits, verify murfi templates (in 'scripts' directory) exist
    if vType == 'realtime':
        # first check that localizer masks are present
        if not os.path.exists(os.path.join(subjDir, 'mask')):
            print "You can't do a realtime run until there are subject masks!"
            v = 0
            return getVisitDir(subject, v), v
        murfiDir = os.path.abspath(os.path.join(myVisitDir, "scripts"))
        if not os.path.exists(murfiDir):
            ### this is dumb. i should make it an importable library.
            print "Trying to create rt session for visit", v
            subprocess.Popen(["python", "createRtSession.py", subject, str(v), 'none', group], cwd=RTSCRIPTSDIR)
    return myVisitDir, v
예제 #3
0
 def updateProgress(self,bid):
     """
     Don't do this until we're done with this action!
     TODO: figure out when RT runs and psychopy stuff is done
     """
     print "new progress will be",bid
     bt.setProgress(bid, bt.get_visit(bid,self.json))
     return