예제 #1
0
    def __init__(self, expected_display, current_display):
        pg.mkQApp()

        self.widget = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical)
        self.widget.resize(1600, 1000)

        self.display_splitter = pg.QtGui.QSplitter(pg.QtCore.Qt.Horizontal)
        self.widget.addWidget(self.display_splitter)

        self.display1 = expected_display
        self.display2 = current_display
        self.display_splitter.addWidget(self.display1.widget)
        self.display_splitter.addWidget(self.display2.widget)

        self.ctrl = pg.QtGui.QWidget()
        self.widget.addWidget(self.ctrl)
        self.ctrl_layout = pg.QtGui.QVBoxLayout()
        self.ctrl.setLayout(self.ctrl_layout)
        self.diff_widget = pg.DiffTreeWidget()
        self.ctrl_layout.addWidget(self.diff_widget)

        self.pass_btn = pg.QtGui.QPushButton('pass')
        self.fail_btn = pg.QtGui.QPushButton('fail')
        self.ctrl_layout.addWidget(self.pass_btn)
        self.ctrl_layout.addWidget(self.fail_btn)

        self.pass_btn.clicked.connect(self.pass_clicked)
        self.fail_btn.clicked.connect(self.fail_clicked)

        self.last_btn_clicked = None
        self.widget.setSizes([750, 250])
예제 #2
0
 def audit_result(self, info, expect):
     """ Display results and ask the user to decide whether the test passed.
     Return True for pass, False for fail.
     
     If *expect* is None, then no previous test results were stored.
     """
     app = pg.mkQApp()
     print "\n=== New test results for %s: ===\n" % self.key
     pprint.pprint(info)
     
     # we use DiffTreeWidget to display differences between large data structures, but
     # this is not present in mainline pyqtgraph yet
     if hasattr(pg, 'DiffTreeWidget'):
         win = pg.DiffTreeWidget()
     else:
         from cnmodel.util.difftreewidget import DiffTreeWidget
         win = DiffTreeWidget()
     
     win.resize(800, 800)
     win.setData(expect, info)
     win.show()
     print "Store new test results? [y/n]",
     yn = raw_input()
     win.hide()
     return yn.lower().startswith('y')
예제 #3
0
    def __init__(self):
        self.ctrl_panel = ControlPanel()
        
        self.latency_superline = SuperLine()
        self.latency_superline.sigPositionChanged.connect(self.ctrl_panel.set_latency)
       
        self.ic_plot = TSeriesPlot('Current Clamp', 'V')
        for plot in self.ic_plot.trace_plots:
            plot.addItem(self.latency_superline.new_line(default_latency))

        self.vc_plot = TSeriesPlot('Voltage Clamp', 'A')
        for plot in self.vc_plot.trace_plots:
            plot.addItem(self.latency_superline.new_line(default_latency))

        self.user_latency = self.ctrl_panel.user_latency
        self.user_latency.sigValueChanged.connect(self.latency_superline.set_value_from_ctrl_panel)
            
        self.ctrl_panel.output_params.child('Fit parameters').sigTreeStateChanged.connect(self.colorize_fit)
        self.experiment_browser = ExperimentBrowser()
        self.fit_compare = pg.DiffTreeWidget()
        self.meta_compare = pg.DiffTreeWidget()
        self.nrmse_thresh = 4
        self.sorted_responses = None
        self.signs = {
            'vc': {
                -55: {'ex': -1, 'in': 1}, 
                -70: {'ex': -1, 'in': 0},
            },
            'ic':{
                -55: {'ex': 1, 'in': -1},
                -70: {'ex': 1, 'in': 0},
            },
        }

        self.fit_precision = {
            'amp': {'vc': 14, 'ic': 8},
            'exp_amp': {'vc': 14, 'ic': 8},
            'exp_tau': {'vc': 8, 'ic': 8},
            'decay_tau': {'vc': 8, 'ic': 8},
            'nrmse': {'vc': 2, 'ic': 2},
            'rise_time': {'vc': 7, 'ic': 6},
            'rise_power': {'vc': 0, 'ic': 0},
            'xoffset': {'vc': 7, 'ic': 7},
            'yoffset': {'vc': 5, 'ic': 14},
        }
예제 #4
0
B = {
    'a list':
    [1, 2, 3, 4, 5, 5, {
        'nested1': 'aaaaa',
        'nested2': 'bbbbb'
    }, "seven"],
    'a dict': {
        'x': 2,
        'y': 2,
        'z': 'three',
        'w': 5
    },
    'another dict': {
        1: 2,
        2: 3,
        3: 4
    },
    'an array': np.random.randint(10, size=(40, 10)),
}

tree = pg.DiffTreeWidget()
tree.setData(A, B)
tree.show()
tree.setWindowTitle('pyqtgraph example: DiffTreeWidget')
tree.resize(1000, 800)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()