labrobot/gui/labrobot.py
2021-11-03 15:37:17 +01:00

92 lines
2.2 KiB
Python

class LabPis:
""" Point in Lab Space | e.g. Point of a pipette tip"""
default_x = 0
default_y = 0
default_z = 0
default_e = 0 # e.g piston position
default_id = 0
def __init__(self, x=default_x,y=default_y,z=default_z,id=default_id,e=default_e):
self.x = x
self.y = y
self.z = z
self.e = e
self.id = id
def __str__(self) -> str:
return(f'<id= {self.id}|x={self.x}|y={self.y}|z={self.z}|e={self.e}>')
class LabPip(LabPis):
default_vol = 1000 # pipette volume
default_top = 20 # piston top position
default_hub = 10 # piston max hub
default_fe = 2000 # speed piston
def __init__(self, x=LabPis.default_x, y=LabPis.default_y, z=LabPis.default_z, id=LabPis.default_id, e=LabPis.default_e,
vol=default_vol,hub=default_hub,fe=default_fe,top=default_top):
super().__init__(x=x, y=y, z=z, id=id, e=e)
self.vol = vol
self.fe = fe
self.hub = hub
self.top = top
def __str__(self) -> str:
return super().__str__()[:-1]+f'|top={self.top}|hub={self.hub}|vol={self.vol}|fe={self.fe}>'
def sendE(self):
return f'<G1 P{self.e} F{self.fe}>\n'
def sendXYZ(self):
return f'<G1 X{self.x} X{self.y} Z{self.z} F{self.fe}>\n'
def go_top(self):
self.e=self.top
return self.sendE()
def get_tip(self,x,y,z):
self.x = x
self.y = y
self.z = z
return self.go_top() + self.sendXYZ()
def up(self):
self.z = 0
return self.sendXYZ()
class LabPipBlock():
""" Pipettenblock description"""
def __init__(self,xoffset,yoffset,anz,rows,deltax,deltay):
self.xoffset = xoffset
self.yoffset = yoffset
self.anz = anz
self.rows = rows
self.deltax = deltax
self.deltay = deltay
self.akt = 0
def next(self):
if self.akt == self.anz:
return f'No more tips !!'
else :
pass
#Job 100myl of A in Vial 1
v1 = LabPis(200,200,100,21)
a1 = LabPis(100,100,100,1)
p1 = LabPis()
pip = LabPip(vol=500)
pip.fe =5000
print(pip)
print(pip.get_tip(150,150,50))
print(pip.up())
print(pip)