Exemplo n.º 1
0
    def __init__(self, host, identity):
        QtGui.QWidget.__init__(self)
        self.host = host

        self.layout = QtGui.QVBoxLayout()
        self.setLayout(self.layout)
        self.dbgui = DatabaseGui.DatabaseGui(
            dm=host.dataManager(), tables={identity: 'EventDetector_events'})
        self.storeBtn = pg.FeedbackButton("Store to DB")
        #self.storeBtn.clicked.connect(self.storeClicked)
        self.layout.addWidget(self.dbgui)
        self.layout.addWidget(self.storeBtn)
        for name in ['getTableName', 'getDb']:
            setattr(self, name, getattr(self.dbgui, name))
Exemplo n.º 2
0
    def __init__(self, mosaic_editor):
        self.mosaic_editor = mosaic_editor

        QtGui.QWidget.__init__(self)
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.load_btn = QtGui.QPushButton("Download 20x")
        self.layout.addWidget(self.load_btn, 0, 0)
        self.load_btn.clicked.connect(self.load_clicked)

        self.submit_btn = pg.FeedbackButton("Submit cell positions to LIMS")
        self.layout.addWidget(self.submit_btn, 1, 0)
        self.submit_btn.clicked.connect(self.submit)
Exemplo n.º 3
0
    def __init__(self, host):
        AnalysisModule.__init__(self, host)
        if self.dataModel is None:
            raise Exception(
                "MapAnalyzer module requires a data model, but none is loaded yet."
            )

        self.currentMap = None
        self.analysisValid = False
        self.colorsValid = False

        self.ctrlLayout = pg.LayoutWidget()
        self.ctrl = ptree.ParameterTree(showHeader=False)
        self.ctrlLayout.addWidget(self.ctrl, row=0, col=0)
        self.recalcBtn = QtGui.QPushButton('Recalculate')
        self.ctrlLayout.addWidget(self.recalcBtn, row=1, col=0)
        self.storeBtn = pg.FeedbackButton('Store to DB')
        self.ctrlLayout.addWidget(self.storeBtn, row=2, col=0)

        self.loader = Loader(host=self, dm=host.dataManager())

        modPath = os.path.abspath(os.path.dirname(__file__))
        self.colorMapper = ColorMapper(
            filePath=os.path.join(modPath, "colorMaps"))
        self._elements_ = OrderedDict([
            ('File Loader', {
                'type': 'fileInput',
                'size': (300, 300),
                'host': self,
                'showFileTree': False
            }),
            ('Map Loader', {
                'type': 'ctrl',
                'object': self.loader,
                'size': (300, 300),
                'pos': ('below', 'File Loader')
            }),
            ('Color Mapper', {
                'type': 'ctrl',
                'object': self.colorMapper,
                'size': (800, 200),
                'pos': ('right', 'Map Loader')
            }),
            ('Canvas', {
                'type': 'canvas',
                'size': (800, 400),
                'pos': ('right', 'Color Mapper'),
                'args': {
                    'name': 'MapAnalyzer'
                }
            }),
            ('Options', {
                'type': 'ctrl',
                'object': self.ctrlLayout,
                'size': (300, 500),
                'pos': ('bottom', 'Map Loader')
            }),
            ('Data Plot', {
                'type': 'plot',
                'pos': ('top', 'Color Mapper'),
                'size': (800, 300)
            }),
            ('Score Histogram', {
                'type': 'plot',
                'pos': ('bottom', 'Data Plot'),
                'size': (800, 300)
            }),
            ('Timeline', {
                'type': 'plot',
                'pos': ('bottom', 'Data Plot'),
                'size': (800, 300)
            }),
            ('Stats Table', {
                'type': 'dataTree',
                'pos': ('bottom', 'Canvas'),
                'size': (800, 300)
            }),
        ])
        host.resize(1100, 800)
        self.initializeElements()

        self.filterStage = EventFilter()
        self.spontRateStage = SpontRateAnalyzer(
            plot=self.getElement('Timeline', create=True))
        self.statsStage = EventStatisticsAnalyzer(
            histogramPlot=self.getElement('Score Histogram', create=True))
        self.regions = RegionMarker(self.getElement('Canvas', create=True))
        self.stages = [
            self.filterStage, self.spontRateStage, self.statsStage,
            self.regions
        ]

        params = [
            dict(name='Time Ranges',
                 type='group',
                 children=[
                     dict(name='Direct Start',
                          type='float',
                          value=0.498,
                          suffix='s',
                          step=0.001,
                          siPrefix=True),
                     dict(name='Stimulus',
                          type='float',
                          value=0.5,
                          suffix='s',
                          step=0.001,
                          siPrefix=True),
                     dict(name='Post Start',
                          type='float',
                          value=0.502,
                          suffix='s',
                          step=0.001,
                          siPrefix=True),
                     dict(name='Post Stop',
                          type='float',
                          value=0.700,
                          suffix='s',
                          step=0.001,
                          siPrefix=True),
                 ]),
        ]

        ## each processing stage comes with its own set of parameters
        for stage in self.stages:
            params.append(stage.parameters())

        self.params = ptree.Parameter.create(name='options',
                                             type='group',
                                             children=params)
        self.ctrl.setParameters(self.params, showTop=False)

        canvas = self.getElement('Canvas', create=True)
        #self.scalebar = pg.ScaleBar(100e-6)
        #canvas.addGraphicsItem(self.scalebar, name="ScaleBar")
        self.scalebar = pg.ScaleBar(size=500e-6)
        self.scalebar.setParentItem(canvas.view)
        self.scalebar.anchor((1, 1), (1, 1), offset=(-20, -20))

        ## Note: need to reconnect this!!
        #self.params.sigTreeStateChanged.connect(self.invalidate)
        self.recalcBtn.clicked.connect(self.recalcClicked)
        self.storeBtn.clicked.connect(self.storeToDB)
        self.params.param('Time Ranges').sigTreeStateChanged.connect(
            self.updateTimes)

        self.getElement('Color Mapper',
                        create=True).sigChanged.connect(self.colorMapChanged)
        self.regions.sigRegionChanged.connect(self.processRegions)