PCR pipetting and reaction

Python script I am hacking on:

import re


def heattreat():
  print("//valve-1_1_1_1_1_1_1_1-valveoutput")
  print("valve-1_1_1_1_1_1_1_1-bypass")
  print("//motion heatblock2 zh 0 row 1 F3000")
  print("G1Z0F3000")
  print("G1X36Y248F5000")
  print("G1X36Y248F5000_2")
  print("G1Z42F3000_300")
  print("//motion heatblock1 zh 0 row 1 F3000")
  print("G1Z0F3000")
  print("G1Z0F3000_30")


def aspiration():
  print("//motion 96well zh 0 row 7 F3000")
  print("G1Z0F3000")
  print("G1X229Y228.5F5000")
  print("G1X229Y228.5F5000_2")
  print("//valve-1_1_1_1_1_1_1_1-valveinput")
  print("valve-1_1_1_1_1_1_1_1-input")
  print("//syringe 300 speed 40 acc 20")
  print("sg1e300s40a20_10")
  print("//valve-1_1_1_1_1_1_1_1-valveoutput")
  print("valve-1_1_1_1_1_1_1_1-output")
  print("//syringe 320 speed 12 acc 6")
  print("sg1e320s12a6_8")
  heattreat()
  print("G1X229Y228.5F5000")
  print("G1X229Y228.5F5000_2")
  print("G1Z60F3000")
  print("//valve-1_1_1_1_1_1_1_1-valveoutput")
  print("valve-1_1_1_1_1_1_1_1-output")
  print("G1Z60F3000_2")
  print("//syringe 330 speed 6 acc 3")
  print("sg1e326s6a3_8")
  print("G1Z30F3000_2")
  print("//syringe 330 speed 6 acc 3")
  #print("sg1e331s6a3_8")
  print("sg1e331s6a3_8") # adding a couple of extra ul
  print("//valve-1_1_1_1_1_1_1_1-valvebypass")
  print("valve-1_1_1_1_1_1_1_1-bypass")
  print("//valve-1_1_1_1_1_1_1_1-valveinput")
  print("valve-1_1_1_1_1_1_1_1-input")
  print("//syringe 200 speed 40 acc 20")
  print("sg1e200s40a20_8")
  print("valve-1_1_1_1_1_1_1_1-bypass")
  
  
 



def voladjust(ar,vol):
  baa = []
  stt = ""
  ott = ""
  for i in ar:
      if i == 0:
         baa.append(1)
         stt = stt + str(1)+"_"
      else:
         baa.append(0)
         stt = stt + str(0)+"_"
      ott = ott + str(i)+"_"
  stt = re.sub("_$", "", stt)
  ott = re.sub("_$", "", ott)
  print("//valve-"+stt+"-valveinput")
  print("valve-"+stt+"-input")
  print("//valve-"+ott+"-valveoutput")
  print("valve-"+ott+"-output")
  #print("//valve-1_1_1_1_1_1_1_1-valveouput")
  #print("valve-1_1_1_1_1_1_1_1-output")
  print("//syringe 316 speed 6 acc 3")
  print("sg1e"+str(vol)+"s6a3_6")
  print("//valve-1_1_1_1_1_1_1_1-valvebypass")
  print("valve-1_1_1_1_1_1_1_1-bypass")


def camcheck(ar,cyc):
  print("//motion PCRcam zh 0 row 1 F3000")
  print("G1X9.2Y95F3000")
  print("G1X9.2Y95F3000_2")
  for j in ar:
   print("G1Z"+str(j)+"F3000_2")
   print("//camsnap 192.168.1.89_12012020151752_thermocycle"+str(cyc)+"pos"+str(j)+"  350 60")
   print("snap 192.168.1.89_350_60_12012020151752_thermocycle"+str(cyc)+"pos"+str(j))
   print("G1Z"+str(j)+"F3000_2")
  print("G1Z"+str(j)+"F3000_2")


def cycle(cyc):
  print("//cycle "+str(cyc))
  print("//motion heatblock2 zh 0 row 1 F3000")
  print("G1Z0F3000")
  print("G1X36Y248F5000")
  print("G1X36Y248F5000_2")
  print("G1Z42F3000_15")
  print("//motion heatblock1 zh 0 row 1 F3000")
  print("G1Z0F3000")
  print("G1X35Y197.5F5000")
  print("G1X35Y197.5F5000_2")
  print("G1Z42F3000_30")
  print("G1Z0F3000")




aspiration()
print("//motion heatblock2 zh 0 row 1 F3000")
print("G1Z0F3000")
print("G1X36Y248F5000_8")

#for i in range(0,1):
ar = [53,53.5,54,54.5,55,55.5,56,56.5,57,57.5]
for i in range(0,6):
    cycle(i)
    camcheck(ar,i)
for i in range(6,10):
    cycle(i)
    camcheck(ar,i)
voladjust([0,0,0,0,1,1,1,1],195)
for i in range(10,15):
    cycle(i)
    camcheck(ar,i)
for i in range(15,20):
    cycle(i)
    camcheck(ar,i)
#voladjust([0,0,0,0,0,0,0,0],191)
for i in range(20,25):
    cycle(i)
    camcheck(ar,i)
#voladjust([0,0,0,0,0,0,0,0],189)
for i in range(25,31):
    cycle(i)
    camcheck(ar,i)
#voladjust([0,0,0,0,0,0,0,1],186)
print("G1Z0F3000")