Hello,
I am trying to control 2 devices with a script, one of them being the artiq ttl IO hardware, which is why I have the def run function not under a kernel. I find that whenever I try to run a kernel function under a for loop that is not under a kernel, I get underflow errors. Why is this the case and how can I fix this?
This is my code for reference:
def run(self):
self.run_kernel()
for i in range(0, self.numOfSteps):
for j in range(0, self.numOfSteps):
PLECount = self.run_kernel2(i)
currPosX, currPosY, currPosZ = get_curr_positions(amc) # code to control other device
step_axis(amc, 0, False, self.stepSize_in_um) # code to control other device
move_closed_loop_axis(amc, 0, self.initialPos1) # code to control other device
step_axis(amc, 1, True, self.stepSize_in_um) # code to control other device
print("finished")
@kernel
def run_kernel(self):
self.core.reset()
self.set_dataset("PLE", np.full(self.n_times, np.nan), broadcast=True)
delay(1 * ms)
@kernel
def run_kernel2(self, i):
with parallel:
self.ttl6.pulse(self.pulseDuration)
pointPLE = self.countRisingEdges()
delay(10 * ms)
self.mutate_dataset("PLE", i, pointPLE)
return pointPLE