Dear all,

I have 2 files created, one a .pyx file with a class named AndorCamersSDK
which has a function named LiveAcquisition(). The second file, a .py file
with a Class AndorCameraGUI which makes use of Tkinter to create a GUI.
This class has function LivePlot(), and RepeatPlot().Inside
LiveAcquisition() I am acquiring N number of frames and after acquiring
each frame I need to display it using LivePlot() and RepeatPlot(). Without
the display, just acquiring and storing for 300 frames takes 6.2 for
execution, which is fine by me. When I try the below method, it takes
around 54 sec even for 100 frames. I need to acquire and display within 6
sec for 300 frames. How do I solve this?

-- 
Regards,
Aishwarya Selvaraj
ᐧ
File 1: .pyx code ; Present inside class AndorCameraSDK

def  LiveAcquisition(self):
    for i in range(no_of_frames): 
        data[i,:,:] = PyArray_NewFromDescr(<PyTypeObject *> np.ndarray, 
np.dtype('<H'), 2,dims, strides,pBuf, np.NPY_C_CONTIGUOUS, None)
        if (i==0):
            self.master.LivePlot(data[i,:,:])
        elif (i==2) or (i==15) or (i ==65) or (i ==96):
            self.master.RepeatPlot(data[i,:,:])
        else:
            pass

File 2 : .py code; Below functions are present inside a class named 
AndorCameraGUI

def LivePlot(self,image):
    self.count = 0
    self.fig = Figure(figsize = (4, 5))
    self.fig.patch.set_facecolor('xkcd:light grey') # When this is removed a 
white color is seen in the background of the figure
    self.a = self.fig.add_subplot(111)
    self.a.set_xlim([0, self.image_width/int(self.HBin)])
    self.a.set_ylim([0, self.image_height/int(self.VBin)])
    image = image.transpose()
    self.im = self.a.imshow(image,'gray')
    self.canvas = FigureCanvasTkAgg(self.fig,self.master)
    self.canvas.draw()
    self.canvas.get_tk_widget().pack(side =LEFT)
    self.toolbar = NavigationToolbar2TkAgg(self.canvas,self.master)
    self.toolbar.update()
    self.canvas._tkcanvas.pack(side = LEFT)# change this to TOP so thee the 
navigation toolbar on the left down

def RepeatPlot(self,image):
        image = image.transpose()
    self.a.imshow(image,"gray")
    self.canvas.draw()     
_______________________________________________
Chennaipy mailing list
Chennaipy@python.org
https://mail.python.org/mailman/listinfo/chennaipy

Reply via email to