Ejemplo n.º 1
0
 def set_value(self, value, block_fit=False):
     for line in self.lines:
         with pg.SignalBlock(line.sigPositionChanged, self.line_sync):
             line.setValue(value or 1e-3)
     self.sigPositionChanged.emit(self)
     if block_fit is False:
         self.sigPositionChangeFinished.emit(self)
Ejemplo n.º 2
0
    def update_params(self):
        with pg.SignalBlock(self.params.sigTreeStateChanged, self.plot_all):
            stim_param = self.params.child('stimulus filter')
            for ch in stim_param.children():
                stim_param.removeChild(ch)

            for k in self.stim_keys:
                param = pg.parametertree.Parameter.create(name=str(k),
                                                          type="bool",
                                                          value="True")
                stim_param.addChild(param)
Ejemplo n.º 3
0
    def _update_fit_stats(self):
        with pg.SignalBlock(self.params.sigTreeStateChanged, self.update_plots):
            self.params['chi squared'] = self.fit.chisqr

            args = self.args.copy()
            args.update(self.fit_params())
            fity = self.model.eval(y=self.data, **args)
            residual = self.data - fity
            rmse = (residual**2 / residual.size).sum() ** 0.5
            self.params['normalized RMS error'] = rmse / self.data.std()
            
            r, p = scipy.stats.pearsonr(self.data, fity)
            self.params['pearson r'] = r
            self.params['pearson p'] = p
Ejemplo n.º 4
0
 def axis_changed(self):
     with pg.SignalBlock(self.child('colors').sigTreeStateChanged, self.colors_changed):
         if self['axis'] == 'none':
             self.child('mode').setOpts(visible=False)
             self.child('colors').setOpts(visible=False)
         else:
             self.child('mode').setOpts(visible=True)
             self.child('colors').setOpts(visible=True)
             values = self.slicer.axes[self['axis']].values
             for ch in self.child('colors').children():
                 self.child('colors').removeChild(ch)
             for i,v in enumerate(values):
                 color = pg.mkColor((i, int(len(values)*1.2)))
                 ch = pg.parametertree.types.SimpleParameter(name=str(v), type='color', value=color)
                 self.child('colors').addChild(ch)
         
     self.colors_changed()
Ejemplo n.º 5
0
 def line_sync(self, moved_line):
     for line in self.lines:
         with pg.SignalBlock(line.sigPositionChanged, self.line_sync):
             line.setValue(moved_line.value())
     self.sigPositionChanged.emit(self)
Ejemplo n.º 6
0
 def update_selection(self):
     axis = self.selected_axes[0]
     with pg.SignalBlock(self.line.sigPositionChangeFinished,
                         self.line_move_finished):
         self.line.setValue(self.data_axes[axis].index)
     Viewer.update_selection(self)
Ejemplo n.º 7
0
 def _set_axis_value(self, ax, val):
     with pg.SignalBlock(
             self.params.child('index').sigTreeStateChanged,
             self.index_param_changed):
         self.params['index', ax] = self.axes[ax].index_at(val)
     self.axes[ax].selection = val
Ejemplo n.º 8
0
 def update_selection(self):
     for i,line in enumerate(self.lines):
         ax = self.selected_axes[i]
         with pg.SignalBlock(line.sigPositionChangeFinished, self.line_move_finished):
             line.setValue(self.data_axes[ax].index)
     Viewer.update_selection(self)