def shake(self,plate,dur=60,speed=None,accel=5,returnPlate=True,samps=None,force=False): if self.ptcrunning and plate==decklayout.SAMPLEPLATE: self.waitpgm() # Move the plate to the shaker, run for the given time, and bring plate back allsamps=Sample.getAllOnPlate(plate) if samps is None: samps=allsamps if all([x.isMixed() for x in samps]) and not force: logging.notice( "No need to shake "+plate.name+", but doing so anyway.") minspeed=0 maxspeed=2000 for x in samps: (a,b)=x.getmixspeeds() minspeed=max([a,minspeed]) maxspeed=min([b,maxspeed]) if speed is None: if minspeed<maxspeed: speed=max((maxspeed+minspeed)/2,maxspeed-50) # Mix as fast as safely possible (but always above minspeed) else: speed=maxspeed if speed<minspeed-2 or speed>maxspeed+2: others="" for x in allsamps: (a,b)=x.getmixspeeds() if b<minspeed or a>maxspeed: if a is not None and a>0: others+=" {%s: %.1ful,G=%.2f%%,min=%.0f,max=%.0f}"%(x.name,x.volume,x.glycerolfrac()*100,a,b) else: others+=" {%s: %.1ful,G=%.2f%%,max=%.0f}"%(x.name,x.volume,x.glycerolfrac()*100,b) logging.mixwarning("Mixing %s at %.0f RPM; minspeed(%.0f) > maxspeed(%.0f), limits=[%s]"%(plate.name,speed,minspeed,maxspeed,others)) else: logging.notice("Mixing %s at %.0f RPM ( min RPM=%.0f, max RPM=%.f)"%(plate.name, speed, minspeed, maxspeed)) oldloc=plate.curloc self.moveplate(plate,"Shaker",returnHome=False) global __shakerActive __shakerActive=True worklist.pyrun("BioShake\\bioexec.py setElmLockPos") worklist.pyrun("BioShake\\bioexec.py setShakeTargetSpeed%d"%speed) worklist.pyrun("BioShake\\bioexec.py setShakeAcceleration%d"%accel) worklist.pyrun("BioShake\\bioexec.py shakeOn") self.starttimer() Sample.shaken(plate.name,speed) Sample.addallhistory("(S%d@%.0f)"%(dur,speed),onlyplate=plate.name) self.waittimer(dur) worklist.pyrun("BioShake\\bioexec.py shakeOff") self.starttimer() self.waittimer(accel+4) worklist.pyrun("BioShake\\bioexec.py setElmUnlockPos") __shakerActive=False if returnPlate: self.moveplate(plate,oldloc)
def shake(self, plate, dur=60, speed=None, accel=5, returnPlate=True, samps=None): if self.ptcrunning and plate == decklayout.SAMPLEPLATE: self.waitpgm() # Move the plate to the shaker, run for the given time, and bring plate back allsamps = Sample.getAllOnPlate(plate) if samps is None: samps = allsamps if all([x.isMixed() for x in samps]): print "No need to shake ", plate maxvol = max([x.volume for x in allsamps]) minvol = min([x.volume for x in samps if not x.isMixed()] + [200]) (minspeed, maxspeed) = plate.getmixspeeds( minvol * 0.95, maxvol + 5) # Assume volumes could be off if minspeed > maxspeed: print "minspeed(", minspeed, ") > maxspeed (", maxspeed, ")" if speed is None: if minspeed < maxspeed: speed = (maxspeed + minspeed) / 2 else: speed = maxspeed warned = False if speed > maxspeed: print "WARNING: %s plate contains wells with up to %.2f ul, which may spill at %d RPM: " % ( plate.name, maxvol, speed), for x in samps: tmp = plate.getmixspeeds(x.volume, x.volume) if tmp[1] < speed: print "%s[%.1ful, max=%.0f RPM] " % (x.name, x.volume, tmp[1]), print warned = True if globals.verbose and speed < minspeed: print "NOTICE: %s plate contains unmixed wells that may not be mixed at %d RPM: " % ( plate.name, speed), for x in samps: if x.isMixed(): continue tmp = plate.getmixspeeds(x.volume * 0.95, x.volume + 5) if speed < tmp[0]: print "%s[%.1ful, min=%.0f RPM, max=%.0f RPM] " % ( x.name, x.volume, tmp[0], tmp[1]), print warned = True if warned or globals.verbose: print " Mixing %s at %.0f RPM (min unmixed vol=%.0ful -> min RPM=%.0f; max vol=%.0ful -> max RPM=%.f)" % ( plate.name, speed, minvol, minspeed, maxvol, maxspeed) oldloc = plate.curloc self.moveplate(plate, "Shaker", returnHome=False) global __shakerActive __shakerActive = True worklist.pyrun("BioShake\\bioexec.py setElmLockPos") worklist.pyrun("BioShake\\bioexec.py setShakeTargetSpeed%d" % speed) worklist.pyrun("BioShake\\bioexec.py setShakeAcceleration%d" % accel) worklist.pyrun("BioShake\\bioexec.py shakeOn") self.starttimer() Sample.shaken(plate.name, speed) Sample.addallhistory("(S%d@%.0f)" % (dur, speed), onlyplate=plate.name) self.waittimer(dur) worklist.pyrun("BioShake\\bioexec.py shakeOff") self.starttimer() self.waittimer(accel + 4) worklist.pyrun("BioShake\\bioexec.py setElmUnlockPos") __shakerActive = False if returnPlate: self.moveplate(plate, oldloc)
def shake(self,plate,dur=60,speed=None,accel=5,returnPlate=True,samps=None): if self.ptcrunning and plate==decklayout.SAMPLEPLATE: self.waitpgm() # Move the plate to the shaker, run for the given time, and bring plate back allsamps=Sample.getAllOnPlate(plate) if samps is None: samps=allsamps if all([x.isMixed() for x in samps]): print "No need to shake ",plate maxvol=max([x.volume for x in allsamps]) minvol=min([x.volume for x in samps if not x.isMixed() ]+[200]) (minspeed,maxspeed)=plate.getmixspeeds(minvol*0.95,maxvol+5) # Assume volumes could be off if minspeed>maxspeed: print "minspeed(",minspeed,") > maxspeed (",maxspeed,")" if speed is None: if minspeed<maxspeed: speed=(maxspeed+minspeed)/2 else: speed=maxspeed warned=False if speed>maxspeed: print "WARNING: %s plate contains wells with up to %.2f ul, which may spill at %d RPM: "%(plate.name, maxvol, speed), for x in samps: tmp=plate.getmixspeeds(x.volume,x.volume) if tmp[1]<speed: print "%s[%.1ful, max=%.0f RPM] "%(x.name,x.volume,tmp[1]), print warned=True if globals.verbose and speed<minspeed: print "NOTICE: %s plate contains unmixed wells that may not be mixed at %d RPM: "%(plate.name, speed), for x in samps: if x.isMixed(): continue tmp=plate.getmixspeeds(x.volume*0.95,x.volume+5) if speed<tmp[0]: print "%s[%.1ful, min=%.0f RPM, max=%.0f RPM] "%(x.name,x.volume,tmp[0],tmp[1]), print warned=True if warned or globals.verbose: print " Mixing %s at %.0f RPM (min unmixed vol=%.0ful -> min RPM=%.0f; max vol=%.0ful -> max RPM=%.f)"%(plate.name, speed, minvol, minspeed, maxvol, maxspeed) oldloc=plate.curloc self.moveplate(plate,"Shaker",returnHome=False) global __shakerActive __shakerActive=True worklist.pyrun("BioShake\\bioexec.py setElmLockPos") worklist.pyrun("BioShake\\bioexec.py setShakeTargetSpeed%d"%speed) worklist.pyrun("BioShake\\bioexec.py setShakeAcceleration%d"%accel) worklist.pyrun("BioShake\\bioexec.py shakeOn") self.starttimer() Sample.shaken(plate.name,speed) Sample.addallhistory("(S%d@%.0f)"%(dur,speed),onlyplate=plate.name) self.waittimer(dur) worklist.pyrun("BioShake\\bioexec.py shakeOff") self.starttimer() self.waittimer(accel+4) worklist.pyrun("BioShake\\bioexec.py setElmUnlockPos") __shakerActive=False if returnPlate: self.moveplate(plate,oldloc)
def shake(self, plate, dur=60, speed=None, accel=5, returnPlate=True, samps=None, force=False): if self.ptcrunning and plate == decklayout.SAMPLEPLATE: self.waitpgm() # Move the plate to the shaker, run for the given time, and bring plate back allsamps = Sample.getAllOnPlate(plate) if samps is None: samps = allsamps if all([x.isMixed() for x in samps]) and not force: logging.notice("No need to shake " + plate.name + ", but doing so anyway.") minspeed = 0 maxspeed = 2000 for x in samps: (a, b) = x.getmixspeeds() minspeed = max([a, minspeed]) for x in allsamps: (a, b) = x.getmixspeeds() maxspeed = min([b, maxspeed]) if speed is None: if minspeed < maxspeed: speed = max( (maxspeed + minspeed) / 2, maxspeed - 50 ) # Mix as fast as safely possible (but always above minspeed) else: speed = maxspeed if speed < minspeed - 2 or speed > maxspeed + 2: others = "" for x in allsamps: (a, b) = x.getmixspeeds() if b < minspeed or a > maxspeed: if a is not None and a > 0: others += " {%s: %.1ful,G=%.2f%%,min=%.0f,max=%.0f}" % ( x.name, x.volume, x.glycerolfrac() * 100, a, b) else: others += " {%s: %.1ful,G=%.2f%%,max=%.0f}" % ( x.name, x.volume, x.glycerolfrac() * 100, b) logging.mixwarning( "Mixing %s at %.0f RPM; minspeed(%.0f) > maxspeed(%.0f), limits=[%s]" % (plate.name, speed, minspeed, maxspeed, others)) else: logging.notice( "Mixing %s at %.0f RPM ( min RPM=%.0f, max RPM=%.f)" % (plate.name, speed, minspeed, maxspeed)) oldloc = plate.curloc self.moveplate(plate, "Shaker", returnHome=False) global __shakerActive __shakerActive = True worklist.pyrun("BioShake\\bioexec.py setElmLockPos") worklist.pyrun("BioShake\\bioexec.py setShakeTargetSpeed%d" % speed) worklist.pyrun("BioShake\\bioexec.py setShakeAcceleration%d" % accel) worklist.pyrun("BioShake\\bioexec.py shakeOn") self.starttimer() Sample.shaken(plate.name, speed) Sample.addallhistory("(S%d@%.0f)" % (dur, speed), onlyplate=plate.name, type="shake") self.waittimer(dur) worklist.pyrun("BioShake\\bioexec.py shakeOff") self.starttimer() self.waittimer(accel + 4) worklist.pyrun("BioShake\\bioexec.py setElmUnlockPos") __shakerActive = False if returnPlate: self.moveplate(plate, oldloc)