Commit 484c328a authored by Advanced Instrumentation's avatar Advanced Instrumentation
Browse files

parallelization of plot option added (windows problem)

parent dc9cb04f
......@@ -121,7 +121,7 @@ class wrapper:
def measure(self, check):
self.measure_check = check['new']
def main(devices, io):
def main(devices, io, parallel = False):
config = dm.get_config(devices)
config['comment'] = 'start of GUI'
......@@ -311,7 +311,17 @@ def main(devices, io):
return devices2measure
def measure(bt, comment = '', name = None):
devices2measure = find_devices2measure()
from multiprocess import Process, Pipe
#initialize parallelization
if parallel:
from multiprocessing import Process, Pipe
class DataStreamProcess(Process):
def __init__(self, connec, *args, **kwargs):
self.connec = connec
Process.__init__(self, *args, **kwargs)
def run(self):
loop_measure(parallel = True, connec = self.connec)
#loop measure
def loop_measure(parallel = False, connec = None):
......@@ -333,6 +343,10 @@ def main(devices, io):
kind = 'measure', comment = comment, name = name+'_'+str(i))
if parallel:
connec.send(measurement)
elif output_check.value:
dm.plot_measure(measurement, devices2measure,plot_config, 0.01)
plt.pause(0.001)
plt.draw_all(force = True)
print ('maximal possible rate: ',np.round(1/(time.time() -t),1))
if (1/rate_text.value - (time.time() -t) < 0):
print ('set rate cannot be reached.')
......@@ -341,16 +355,10 @@ def main(devices, io):
class DataStreamProcess(Process):
def __init__(self, connec, *args, **kwargs):
self.connec = connec
Process.__init__(self, *args, **kwargs)
def run(self):
loop_measure(parallel = True, connec = self.connec)
if output_check.value:
if output_check.value and parallel:
global plot_config
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment