Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
app = QtGui.QApplication([])
# flowchart and window
nodes = makeNodeList()
win, fc = makeFlowchartWithPlotWindow(nodes)
win.show()
# feed in data
data = makeData()
fc.setInput(dataIn=data)
return app.exec_()
)
data.validate()
x = np.arange(11) - 5.
y = np.linspace(0, 10, 51)
xx, yy = np.meshgrid(x, y, indexing='ij')
zz = np.sin(yy) + xx
data2 = MeshgridDataDict(
reps=dict(values=xx),
y=dict(values=yy),
z=dict(values=zz, axes=['reps', 'y'])
)
data2.validate()
# make app and gui, fc
app = QtGui.QApplication([])
win, fc = flowchartAutoPlot([
('sub', SubtractAverage)
])
win.show()
# feed in data
fc.setInput(dataIn=data)
fc.setInput(dataIn=data2)
return app.exec_()
def simple_2d_plot():
app = QtGui.QApplication([])
win = PlotWindow()
plot = AutoPlot(parent=win)
win.plot.setPlotWidget(plot)
win.show()
# plotting 1d traces
if False:
logger.info(f"1D trace")
t0 = time.perf_counter()
nsamples = 30
for i in range(nsamples):
data = datadict_to_meshgrid(
testdata.get_1d_scalar_cos_data(201, 2)
)
win.plot.setData(data)
t1 = time.perf_counter()
def dimReduction(interactive=False):
if not interactive:
app = QtGui.QApplication([])
fc = linearFlowchart(('reducer', DimensionReducer))
reducer = fc.nodes()['reducer']
dialog = widgetDialog(reducer.ui, 'reducer')
data = datadict_to_meshgrid(
testdata.three_compatible_3d_sets(2, 2, 2)
)
fc.setInput(dataIn=data)
if not interactive:
app.exec_()
else:
return dialog, fc
def xySelection(interactive=False):
if not interactive:
app = QtGui.QApplication([])
fc = linearFlowchart(('xysel', XYSelector))
selector = fc.nodes()['xysel']
dialog = widgetDialog(selector.ui, 'xysel')
data = datadict_to_meshgrid(
testdata.three_compatible_3d_sets(4, 4, 4)
)
fc.setInput(dataIn=data)
if not interactive:
app.exec_()
else:
return dialog, fc
def main(pathAndId):
app = QtGui.QApplication([])
# flowchart and window
fc = linearFlowchart(
('Dataset loader', QCodesDSLoader),
('Data selection', DataSelector),
('Grid', DataGridder),
('Dimension assignment', XYSelector),
('Sine fit', sinefit),
('plot', PlotNode),
)
win = QCAutoPlotMainWindow(fc, pathAndId=pathAndId,
loaderName='Dataset loader')
win.show()
return app.exec_()
def toClipboard(self):
"""
Copy the current canvas to the clipboard.
"""
buf = io.BytesIO()
self.fig.savefig(buf, dpi=300, facecolor='w', format='png',
transparent=True)
QtGui.QApplication.clipboard().setImage(
QtGui.QImage.fromData(buf.getvalue()))
buf.close()