Skip to content

Commit

Permalink
figth globals: curTipMask implementing #8
Browse files Browse the repository at this point in the history
introduce Instruction self.robot = Rbt.Robot.current to replace
 - Instruction_Base curTipMask to Rbt.tipsMask[self.robot.curArm().nTips]
 - arm Pipette.LiHa1 to self.robot.curArm(arm).index
 - Lab.def_LabW
 - Rbt.Robot.current to self.robot
  • Loading branch information
qPCR4vir committed Jul 5, 2018
1 parent 0a09472 commit c707e43
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 44 deletions.
1 change: 1 addition & 0 deletions EvoScriPy/EvoMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def __init__(self, index, nTips , arms=None):
self.set_as_current()

def exec(self, instr):
assert (self.robot is instr.robot)
self.set_as_current()
instr.actualize_robot_state()

Expand Down
24 changes: 12 additions & 12 deletions EvoScriPy/Instruction_Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Instruction:
def __init__(self, name):
self.name = name
self.arg = []
self.robot = Rbt.Robot.current

def validateArg(self):
self.arg = []
Expand Down Expand Up @@ -136,8 +137,6 @@ def __init__(self, commandname):
Device.__init__(self, "Te-MagS", commandname)


def_TipMask = 15 # todo revise. here? use Robot?
curTipMask = def_TipMask
def_liquidClass = "Water free" #"Buffer free DITi 1000-AVR" # "AVR-Water free DITi 1000" # "Water free dispense DiTi 1000"
def_vol = [0]*12
def_LoopOp = []
Expand All @@ -147,7 +146,7 @@ def __init__(self, commandname):
class Pipette(Instruction):
LiHa1 = 0
LiHa2 = 1
def __init__(self, name, tipMask = curTipMask,
def __init__(self, name, tipMask = None,
labware = None,
spacing = 1, # todo how to use???
wellSelection = None, # todo how to use???
Expand Down Expand Up @@ -180,13 +179,14 @@ def __init__(self, name, tipMask = curTipMask,
:param arm:
"""
Instruction.__init__(self, name)
self.tipMask=tipMask
self.robot.curArm(arm)
self.tipMask = tipMask if tipMask is not None else Rbt.tipsMask[self.robot.curArm().nTips]
self.labware=labware or Lab.def_LabW # todo what def???
self.spacing = spacing
self.loopOptions = LoopOptions
self.RackName = RackName
self.Well = Well
self.arm = arm
self.arm = self.robot.curArm().index # todo revise eliminate and use self.robot.curArm().index directly?
# noOfLoopOptions,
# loopName,
# action,
Expand Down Expand Up @@ -214,16 +214,16 @@ def exec(self, mode=None):


class Pipetting(Pipette):
def __init__(self, name, tipMask = curTipMask,
def __init__(self, name, tipMask = None,
liquidClass = def_liquidClass,
volume = def_vol,
labware = Lab.def_LabW, # todo ??????
labware = None, # todo ??????
spacing = 1,
wellSelection= None,
LoopOptions = def_LoopOp,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
Pipette.__init__(self, name, tipMask ,
labware ,
spacing ,
Expand All @@ -237,7 +237,7 @@ def __init__(self, name, tipMask = curTipMask,

def validateArg(self):
Pipette.validateArg(self)
nTips = Rbt.Robot.current.curArm().nTips # todo FIX arm is arg
nTips = self.robot.curArm().nTips # todo FIX arm is arg
self.arg[1:1] = [string1(self.liquidClass)] + expr(nTips, self.volume).split() + [int(0)] * (
12 - nTips) # arg 2, 3 - 14
return True
Expand All @@ -247,12 +247,12 @@ def actualize_robot_state(self):
pass

def pipette_on_iRobot(self,action):
self.volume, self.tipMask = Rbt.Robot.current.pipette(action, self.volume,
self.volume, self.tipMask = self.robot.pipette(action, self.volume,
self.labware, self.tipMask )


class DITIs(Instruction):
def __init__(self, name, tipMask=curTipMask, options=0, arm=Pipette.LiHa1):
def __init__(self, name, tipMask=None, options=0, arm=Pipette.LiHa1):
"""
:param name: str, instruction
Expand All @@ -262,7 +262,7 @@ def __init__(self, name, tipMask=curTipMask, options=0, arm=Pipette.LiHa1):
"""
Instruction.__init__(self, name)
self.options = options
self.tipMask = tipMask
self.tipMask = tipMask if tipMask is not None else Rbt.tipsMask[self.robot.curArm().nTips]
self.arm = arm

def validateArg(self):
Expand Down
64 changes: 32 additions & 32 deletions EvoScriPy/Instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class aspirate(Pipetting):
""" A.15.4.1 Aspirate command (Worklist: Aspirate) A - 125
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
liquidClass = def_liquidClass,
volume = def_vol,
labware = None,
Expand All @@ -26,7 +26,7 @@ def __init__(self, tipMask = curTipMask,
LoopOptions = def_LoopOp,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
"""
Expand Down Expand Up @@ -60,7 +60,7 @@ def action():
class dispense(Pipetting):
""" A.15.4.2 Dispense (Worklist: Dispense)
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
liquidClass = def_liquidClass,
volume = def_vol,
labware = None,
Expand All @@ -69,7 +69,7 @@ def __init__(self, tipMask = curTipMask,
LoopOptions = def_LoopOp,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
Pipetting.__init__(self, 'Dispense',
tipMask,
liquidClass,
Expand All @@ -89,7 +89,7 @@ def action():
class mix(Pipetting):
""" A.15.4.3 Mix (Worklist: Mix)
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
liquidClass = def_liquidClass,
volume = def_vol,
labware = None,
Expand All @@ -99,7 +99,7 @@ def __init__(self, tipMask = curTipMask,
LoopOptions = def_LoopOp,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
Pipetting.__init__(self, 'Mix',
tipMask,
liquidClass,
Expand Down Expand Up @@ -132,7 +132,7 @@ class wash_tips(Pipette): # TODO revise def values of arg, h
DITIs several times to renew the system liquid column in the DITI adapters. This
ensures maximum pipetting accuracy.
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
WashWaste = None,
WashCleaner = None,
wasteVol = 100,
Expand All @@ -147,7 +147,7 @@ def __init__(self, tipMask = curTipMask,
atFrequency = 0,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
"""
:param tipMask:
Expand Down Expand Up @@ -217,7 +217,7 @@ def validateArg(self):
return True

class getDITI(DITIs):
def __init__(self, tipMask, type, options=0, arm= Pipette.LiHa1):
def __init__(self, tipMask, type, options=0, arm= None):
""" A.15.4.5 Get DITIs (Worklist: GetDITI) ...
The Get DITIs command is used to pick up DITIs (disposable tips) of the specified
type from a DITI rack. Freedom EVOware keeps track of their position on the
Expand Down Expand Up @@ -256,10 +256,10 @@ class getDITI2(DITIs):
including the rack and the site (that is - the labware).
It need a labware type and it know where to pick the next tip.
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
LabwareTypeName = None,
options = 0,
arm = Pipette.LiHa1,
arm = None,
AirgapVolume = 0,
AirgapSpeed = def_AirgapSpeed ):
"""
Expand Down Expand Up @@ -307,11 +307,11 @@ class dropDITI(Pipette):
""" A.15.4.6 Drop DITIs command (Worklist: DropDITI). pag A - 130 and 15 - 14
"""

def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
labware = None,
AirgapVolume= 0,
AirgapSpeed = def_AirgapSpeed ,
arm = Pipette.LiHa1): #, conditional=True):
arm = None): #, conditional=True):
"""
:param conditional: exec only if there are some tip to droop.
:param tipMask:
Expand Down Expand Up @@ -437,12 +437,12 @@ class pickUp_DITIs(Pipette):
used and put back into a DITI rack with the Set DITIs Back command. You must
specify the DITIs you want to pick up.
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
labware = None,
wellSelection= None,
LoopOptions = def_LoopOp,
type = None,
arm = Pipette.LiHa1,
arm = None,
RackName = None,
Well = None):
Pipette.__init__(self, 'PickUp_DITIs',
Expand Down Expand Up @@ -473,11 +473,11 @@ class pickUp_DITIs2(Pipette):
used and put back into a DITI rack with the Set DITIs Back command. You must
specify the DITIs you want to pick up.
"""
def __init__(self, tipMask = curTipMask,
def __init__(self, tipMask = None,
labware = None,
wellSelection= None,
LoopOptions = def_LoopOp,
arm = Pipette.LiHa1, # last parameter
arm = None, # last parameter
RackName = None,
Well = None):
Pipette.__init__(self, 'PickUp_DITIs2',
Expand Down Expand Up @@ -506,11 +506,11 @@ class set_DITIs_Back(Pipette):
return used DITIs to specified positions on a DITI rack for later use.
This command requires the Lower DITI Eject option.
"""
def __init__(self , tipMask , #= curTipMask,
def __init__(self , tipMask , #= None,
labware , #= None,
wellSelection= None,
LoopOptions = def_LoopOp,
arm = Pipette.LiHa1,
arm = None,
RackName = None,
Well = None):
assert isinstance(labware, Lab.DITIrack)
Expand All @@ -534,20 +534,20 @@ def actualize_robot_state(self):
class pickUp_ZipTip(Pipette): # todo implement !!!
""" A.15.4.10 Pickup ZipTip (Worklist: PickUp_ZipTip)
"""
def __init__(self, tipMask = curTipMask ):
def __init__(self, tipMask = None ):
Pipette.__init__(self, 'PickUp_ZipTip' )
assert False, "PickUp_ZipTip not implemented"

class detect_Liquid(Pipetting): # todo get the results !!!
""" A.15.4.11 Detect Liquid (Worklist: Detect_Liquid)
"""
def __init__(self , tipMask = curTipMask,
def __init__(self , tipMask = None,
liquidClass = def_liquidClass,
labware = None,
spacing = 1,
wellSelection= None,
LoopOptions = def_LoopOp,
arm = Pipette.LiHa1,
arm = None,
RackName = None,
Well = None,
read = False):
Expand Down Expand Up @@ -576,9 +576,9 @@ def exec(self, mode=None):
class activate_PMP(Instruction):
""" A.15.4.12 Activate PMP (Worklist: Activate_PMP)
"""
def __init__(self, tipMask = curTipMask ):
def __init__(self, tipMask = None ):
Instruction.__init__(self, "Activate_PMP")
self.tipMask = tipMask
self.tipMask = tipMask if tipMask is not None else Rbt.tipsMask[self.robot.curArm().nTips]

def validateArg(self):
Instruction.validateArg(self)
Expand All @@ -591,9 +591,9 @@ def exec(self, mode=None):
class deactivate_PMP(Instruction):
""" A.15.4.13 Deactivate PMP (Worklist: Deactivate_PMP)
"""
def __init__(self, tipMask = curTipMask ):
def __init__(self, tipMask = None ):
Instruction.__init__(self, "Deactivate_PMP")
self.tipMask = tipMask
self.tipMask = tipMask if tipMask is not None else Rbt.tipsMask[self.robot.curArm().nTips]

def validateArg(self):
Instruction.validateArg(self)
Expand Down Expand Up @@ -641,14 +641,14 @@ class moveLiha(Pipette ):
global_z_travel = 4 # = global z-travel

def __init__(self, zMove, zTarget, offset, speed, # arg 6,7,8,9
tipMask = curTipMask,
tipMask = None,
labware = None,
spacing = 1,
wellSelection= None,
LoopOptions = def_LoopOp,
RackName = None,
Well = None,
arm = Pipette.LiHa1):
arm = None):
"""
:param zMove: int; type of movement:
Expand Down Expand Up @@ -718,9 +718,9 @@ class active_Wash(Instruction):
""" A.15.4.16 Active WashStation (Worklist: Active_Wash)
"""

def __init__(self, wait = True, time=None, arm=Pipette.LiHa1 ):
def __init__(self, wait = True, time=None, arm=None ):
Instruction.__init__(self, "Active_Wash")
self.arm = arm
self.arm = arm if arm is not None else self.robot.curArm().index
self.time = time
self.wait = wait

Expand All @@ -743,14 +743,14 @@ def __init__(self, exportAll = True,
formats = text_with_delimiters,
delete = False,
compress = False,
Raks=[],
Raks=None, # ?????
significantStep = 1):
Instruction.__init__(self, "Export")
self.exportAll = exportAll
self.formats = formats
self.delete = delete
self.compress = compress
self.Raks = Raks
self.Raks = Raks if Raks is not None else []
self.significantStep = significantStep


Expand Down

0 comments on commit c707e43

Please sign in to comment.