-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #245 from European-XFEL/dev
0.9.0
- Loading branch information
Showing
250 changed files
with
5,843 additions
and
19,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" | ||
Distributed under the terms of the BSD 3-Clause License. | ||
The full license is in the file LICENSE, distributed with this software. | ||
Author: Jun Zhu <[email protected]> | ||
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH. | ||
All rights reserved. | ||
""" | ||
import time | ||
|
||
import numpy as np | ||
|
||
from PyQt5.QtCore import QTimer | ||
|
||
from extra_foam.gui import mkQApp | ||
from extra_foam.gui.plot_widgets import ImageViewF | ||
|
||
app = mkQApp() | ||
|
||
|
||
class BenchmarkImageViewSpeed: | ||
def __init__(self): | ||
self._timer = QTimer() | ||
self._timer.timeout.connect(self.update) | ||
|
||
self._data = np.random.normal(size=(50, 1024, 1280)) | ||
self._prev_t = None | ||
self._count = 0 | ||
|
||
self._view = ImageViewF() | ||
self._view.show() | ||
|
||
def start(self): | ||
self._prev_t = time.time() | ||
self._timer.start(0) | ||
|
||
def update(self): | ||
self._view.setImage(self._data[self._count % 10]) | ||
self._count += 1 | ||
|
||
now = time.time() | ||
dt = now - self._prev_t | ||
self._prev_t = now | ||
fps = 1.0/dt | ||
|
||
self._view.setTitle(f"{fps:.2f} fps") | ||
|
||
app.processEvents() # force complete redraw for every plot | ||
|
||
|
||
if __name__ == '__main__': | ||
bench = BenchmarkImageViewSpeed() | ||
bench.start() | ||
app.exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
""" | ||
Distributed under the terms of the BSD 3-Clause License. | ||
The full license is in the file LICENSE, distributed with this software. | ||
Author: Jun Zhu <[email protected]> | ||
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH. | ||
All rights reserved. | ||
""" | ||
import time | ||
from enum import IntEnum | ||
|
||
import numpy as np | ||
|
||
from PyQt5.QtCore import QTimer | ||
|
||
from extra_foam.gui import mkQApp | ||
from extra_foam.gui.plot_widgets import PlotWidgetF | ||
|
||
app = mkQApp() | ||
|
||
|
||
class PlotType(IntEnum): | ||
Line = 0 | ||
Bar = 1 | ||
StatisticsBar = 2 | ||
Scatter = 3 | ||
|
||
|
||
class BenchmarkPlotItemSpeed: | ||
def __init__(self, plot_type=PlotType.Line): | ||
self._timer = QTimer() | ||
self._timer.timeout.connect(self.update) | ||
|
||
self._widget = PlotWidgetF() | ||
|
||
if plot_type == PlotType.Line: | ||
self._graph = self._widget.plotCurve() | ||
n_pts = 5000 | ||
elif plot_type == PlotType.Bar: | ||
self._graph = self._widget.plotBar() | ||
n_pts = 300 | ||
elif plot_type == PlotType.StatisticsBar: | ||
self._graph = self._widget.plotStatisticsBar() | ||
self._graph.setBeam(1) | ||
n_pts = 500 | ||
elif plot_type == PlotType.Scatter: | ||
self._graph = self._widget.plotScatter() | ||
n_pts = 3000 | ||
else: | ||
raise ValueError(f"Unknown plot type: {plot_type}") | ||
|
||
self._x = np.arange(n_pts) | ||
self._data = 100 * np.random.normal(size=(50, n_pts)) | ||
if plot_type == PlotType.StatisticsBar: | ||
self._y_min = self._data - 20 | ||
self._y_max = self._data + 20 | ||
self._plot_type = plot_type | ||
|
||
self._prev_t = None | ||
self._count = 0 | ||
|
||
self._widget.show() | ||
|
||
def start(self): | ||
self._prev_t = time.time() | ||
self._timer.start(0) | ||
|
||
def update(self): | ||
idx = self._count % 10 | ||
if self._plot_type == PlotType.StatisticsBar: | ||
self._graph.setData(self._x, self._data[idx], | ||
y_min=self._y_min[idx], y_max=self._y_max[idx]) | ||
else: | ||
self._graph.setData(self._x, self._data[idx]) | ||
|
||
self._count += 1 | ||
|
||
now = time.time() | ||
dt = now - self._prev_t | ||
self._prev_t = now | ||
fps = 1.0 / dt | ||
|
||
self._widget.setTitle(f"{fps:.2f} fps") | ||
|
||
app.processEvents() # force complete redraw for every plot | ||
|
||
|
||
if __name__ == '__main__': | ||
bench = BenchmarkPlotItemSpeed(PlotType.Line) | ||
bench.start() | ||
app.exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ Contents: | |
introduction | ||
installation | ||
start | ||
trouble_shooting | ||
config_file | ||
main_gui | ||
image_tool | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.