コード例 #1
0
ファイル: multipatch.py プロジェクト: aaronoldre/acq4
    def __init__(self, pipette, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.pip = pipette
        self.moving = False
        self.pip.sigGlobalTransformChanged.connect(self.positionChanged)
        self.pip.sigDataChanged.connect(self.updatePlots)
        if isinstance(pipette, PatchPipette):
            self.pip.sigStateChanged.connect(self.stateChanged)
        self.moveTimer = QtCore.QTimer()
        self.moveTimer.timeout.connect(self.positionChangeFinished)

        self.ui = Ui_PipetteControl()
        self.ui.setupUi(self)
        self.ui.stateCombo.activated.connect(self.changeState)

        n = re.sub(r'[^\d]+', '', pipette.name())
        self.ui.selectBtn.setText(n)

        for ch in self.children():
            ch.pipette = pipette
            ch.pipCtrl = self

        self.gv = pg.GraphicsLayoutWidget()
        self.leftPlot = self.gv.addPlot()
        self.rightPlot = self.gv.addPlot()
        self.rightPlot.setXLink(self.leftPlot.getViewBox())
        self.ui.plotLayout.addWidget(self.gv)
コード例 #2
0
ファイル: AnalysisModule.py プロジェクト: travis-open/acq4
    def makeObject(self, host):

        typ = self.type()
        args = self.args()
        if typ == 'plot':
            obj = pg.PlotWidget(name=self.name(), **args)
        elif typ == 'imageView':
            obj = pg.ImageView(**args)
        elif typ == 'canvas':
            obj = Canvas.Canvas(**args)
        elif typ == 'fileInput':
            obj = FileLoader.FileLoader(host.dataManager(), **args)
        #elif typ == 'database':
        #obj = DatabaseGui.DatabaseGui(host.dataManager(), **args)
        elif typ == 'table':
            obj = pg.TableWidget(**args)
        elif typ == 'dataTree':
            obj = pg.DataTreeWidget(**args)
        elif typ == 'parameterTree':
            obj = pg.parametertree.ParameterTree(**args)
        elif typ == 'graphicsView':
            obj = pg.GraphicsView(**args)
        elif typ == 'graphicsLayout':
            obj = pg.GraphicsLayoutWidget(**args)
        elif typ == 'viewBox':
            obj = pg.GraphicsView()
            obj.setCentralItem(pg.ViewBox(**args))
        else:
            raise Exception(
                "Cannot automatically create element '%s' (type=%s)" %
                (self.name, typ))
        #self.setObject(obj)  ## handled indirectly..
        return obj
コード例 #3
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.resize(800, 1000)

        self.layout = QtGui.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.layout)

        self.gw = pg.GraphicsLayoutWidget()
        self.layout.addWidget(self.gw)

        self.vb1 = self.gw.addViewBox()
        self.img1 = pg.ImageItem()
        self.vb1.addItem(self.img1)

        self.vb2 = self.gw.addViewBox(row=1, col=0)
        self.img2 = pg.ImageItem()
        self.vb2.addItem(self.img2)

        for vb in (self.vb1, self.vb2):
            vb.invertY()
            vb.setAspectLocked(True)

        self.plt1 = self.gw.addPlot(row=2, col=0)
        self.plt1.setLabels(bottom=('time', 's'))
        self.plt1_items = []

        self.rois = [
            pg.RectROI([0, 0], [10, 10], pen=(i, 4)) for i in range(2)
        ]
        for roi in self.rois:
            self.vb1.addItem(roi)
            roi.sigRegionChangeFinished.connect(self.roi_changed)
        self.ignore_roi_change = False

        self.plt2 = self.gw.addPlot(row=3, col=0)
        self.plt2.setXLink(self.plt1)
        self.plt2.setLabels(bottom=('time', 's'))

        self.base_time_rgn = pg.LinearRegionItem([0.0, 0.1])
        self.test_time_rgn = pg.LinearRegionItem([0.1, 0.11])
        for time_rgn in (self.base_time_rgn, self.test_time_rgn):
            self.plt1.addItem(time_rgn)
            time_rgn.sigRegionChangeFinished.connect(self.time_rgn_changed)
            time_rgn.sigRegionChangeFinished.connect(
                self.update_sequence_analysis)
        self.clamp_plots = []

        self.plt3 = self.gw.addPlot(row=4, col=0)
        self.plt3.setLabels(left="dF / F", bottom="trial")

        self.show()
コード例 #4
0
    def __init__(self, trackers):
        self.trackers = trackers
        self.nextFrame = None

        pg.QtGui.QWidget.__init__(self)
        self.timer = pg.QtCore.QTimer()
        self.timer.timeout.connect(self.update)

        self.layout = pg.QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.gv = pg.GraphicsLayoutWidget()
        self.layout.addWidget(self.gv, 0, 0)

        self.plot = self.gv.addPlot(labels={
            'left': ('Drift distance', 'm'),
            'bottom': ('Time', 's')
        })
        self.plot.addLegend()
        self.xplot = self.gv.addPlot(labels={'left': ('X position', 'm')},
                                     row=1,
                                     col=0)
        self.yplot = self.gv.addPlot(labels={'left': ('Y position', 'm')},
                                     row=2,
                                     col=0)
        self.zplot = self.gv.addPlot(labels={
            'left': ('Z position', 'm'),
            'bottom': ('Time', 's')
        },
                                     row=3,
                                     col=0)
        for plt in [self.xplot, self.yplot, self.zplot]:
            plt.setYRange(-10e-6, 10e-6)

        self.pens = [(i, len(trackers)) for i in range(len(trackers))]
        self.lines = [
            self.plot.plot(pen=self.pens[i], name=trackers[i].dev.name())
            for i in range(len(trackers))
        ]
        # self.errors = [[] for i in range(len(trackers))]
        # self.cumulative = np.zeros((len(trackers), 3))
        self.positions = []
        self.times = []

        self.timer.start(2000)
        trackers[0]._getImager().sigNewFrame.connect(self.newFrame)
        self.show()
コード例 #5
0
ファイル: AtlasCanvasItem.py プロジェクト: outofculture/acq4
    def __init__(self, **kwds):
        if not HAVE_AICCF:
            raise Exception(
                "This item requires the aiccf module, but it could not be imported."
            )
        kwds.pop('viewRect', None)

        self.atlas = CCFAtlasData()
        with pg.BusyCursor():
            self.atlasView = AtlasSliceView()
            self.atlasView.set_data(self.atlas)

        item = self.atlasView.img2
        opts = {'scalable': True, 'rotatable': True, 'movable': True}
        opts.update(kwds)
        CanvasItem.__init__(self, item, **opts)

        self.__ctrl = Qt.QWidget()
        self.__layout = Qt.QGridLayout()
        self.__ctrl.setLayout(self.__layout)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.__layout.addWidget(self.atlasView.display_ctrl, 0, 0)
        self.__layout.addWidget(self.atlasView.label_tree, 1, 0)

        self.showSliceBtn = Qt.QPushButton("Show slice")
        self.showSliceBtn.setCheckable(True)
        self.__layout.addWidget(self.showSliceBtn, 2, 0)
        self.showSliceBtn.toggled.connect(self.showSliceToggled)

        self.layout.addWidget(self.__ctrl, self.layout.rowCount(), 0, 1, 2)

        # Set up window for selecting slice plane
        self.sliceWidget = Qt.QWidget()
        self.sliceLayout = Qt.QGridLayout()
        self.sliceWidget.setLayout(self.sliceLayout)
        self.sliceGraphicsView = pg.GraphicsLayoutWidget()
        self.sliceLayout.addWidget(self.sliceGraphicsView, 0, 0)
        self.sliceView = self.sliceGraphicsView.addViewBox()
        self.sliceView.addItem(self.atlasView.img1)
        self.sliceView.autoRange()
        self.sliceView.setAspectLocked(True)
        self.sliceView.addItem(self.atlasView.line_roi)
        self.sliceLayout.addWidget(self.atlasView.zslider, 1, 0)
        self.sliceLayout.addWidget(self.atlasView.angle_slider, 2, 0)
        self.sliceWidget.resize(800, 800)
コード例 #6
0
    def __init__(self):
        QtGui.QSplitter.__init__(self, QtCore.Qt.Horizontal)
        self.resize(800, 1000)

        self.params = pg.parametertree.Parameter(
            name='params',
            type='group',
            children=[
                dict(name='sequence',
                     type='group',
                     children=[
                         dict(name='analysis',
                              type='list',
                              values=['dF / F', 'SNR', 'noise']),
                     ]),
            ])
        self.ptree = pg.parametertree.ParameterTree()
        self.ptree.setParameters(self.params)
        self.params.child('sequence').sigTreeStateChanged.connect(
            self.update_sequence_analysis)

        self.leftPanel = QtGui.QWidget()
        self.addWidget(self.leftPanel)
        self.layout = QtGui.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.leftPanel.setLayout(self.layout)

        self.layout.addWidget(self.ptree, 0, 0)

        self.gw = pg.GraphicsLayoutWidget()
        self.addWidget(self.gw)

        self.vb1 = self.gw.addViewBox()
        self.img1 = pg.ImageItem()
        self.vb1.addItem(self.img1)

        self.vb2 = self.gw.addViewBox(row=1, col=0)
        self.img2 = pg.ImageItem()
        self.vb2.addItem(self.img2)

        for vb in (self.vb1, self.vb2):
            vb.invertY()
            vb.setAspectLocked(True)

        self.plt1 = self.gw.addPlot(row=2, col=0)
        self.plt1.setLabels(bottom=('time', 's'))
        self.plt1_items = []

        self.rois = [
            pg.EllipseROI([0, 0], [10, 10], pen=(i, 4)) for i in range(2)
        ]
        for roi in self.rois:
            self.vb1.addItem(roi)
            roi.sigRegionChangeFinished.connect(self.roi_changed)
        self.ignore_roi_change = False

        self.plt2 = self.gw.addPlot(row=3, col=0)
        self.plt2.setXLink(self.plt1)
        self.plt2.setLabels(bottom=('time', 's'))

        self.noise_time_rgn = pg.LinearRegionItem([0.01, 0.02],
                                                  brush=(255, 0, 0, 30))
        self.base_time_rgn = pg.LinearRegionItem([0.025, 0.95],
                                                 brush=(0, 255, 0, 30))
        self.test_time_rgn = pg.LinearRegionItem([0.1, 0.11],
                                                 brush=(0, 0, 255, 30))
        for time_rgn in (self.base_time_rgn, self.test_time_rgn,
                         self.noise_time_rgn):
            self.plt1.addItem(time_rgn)
            time_rgn.sigRegionChangeFinished.connect(self.time_rgn_changed)
            time_rgn.sigRegionChangeFinished.connect(
                self.update_sequence_analysis)
        self.clamp_plots = []

        self.plt3 = self.gw.addPlot(row=4, col=0)
        self.plt3.setLabels(left="dF / F", bottom="trial")

        self.show()