Skip to content

Commit 03117a2

Browse files
authored
Merge pull request #245 from European-XFEL/dev
0.9.0
2 parents f8f2502 + 679427e commit 03117a2

File tree

250 files changed

+5843
-19321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+5843
-19321
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="7"
2424
- stage: full linux
2525
os: linux
26-
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="7"
26+
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="8"
2727
- stage: full linux
2828
os: linux
29-
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="6"
29+
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="7"
3030
- stage: full linux
3131
os: linux
32-
env: PYTHON_VERSION="3.6.9" COMPILER="gcc" GCCv="7"
32+
env: PYTHON_VERSION="3.7.5" COMPILER="gcc" GCCv="6"
3333
- stage: full linux
3434
os: linux
3535
env: PYTHON_VERSION="3.6.9" COMPILER="gcc" GCCv="6"
@@ -86,7 +86,7 @@ before_install:
8686
install:
8787
- conda install -y python=$PYTHON_VERSION
8888
- echo $PYTHON_VERSION
89-
- conda install -y cmake libstdcxx-ng numpy -c anaconda
89+
- conda install -y cmake numpy -c anaconda
9090
- conda install -y -c conda-forge tbb-devel
9191
- export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
9292
- pip install -e .[test]

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ if(FOAM_USE_TBB OR XTENSOR_USE_TBB)
5959
set(TBB_REQUIRED_VERSION 2020.1)
6060
string(REPLACE "." "_U" TBB_REQUIRED_VERSION_STR ${TBB_REQUIRED_VERSION})
6161

62+
add_compile_definitions(TBB_SUPPRESS_DEPRECATED_MESSAGES)
63+
6264
find_package(TBB QUIET)
6365
if(TBB_FOUND AND ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} VERSION_EQUAL TBB_REQUIRED_VERSION)
6466
set(TBB_LIBRARY ${TBB_LIBRARIES_RELEASE})
@@ -146,6 +148,17 @@ if(BUILD_FOAM_TESTS)
146148
add_subdirectory(test)
147149
endif()
148150

151+
# ============
152+
# Build flags
153+
# ============
154+
155+
if(CMAKE_CXX_COMPILER_VERSION)
156+
set(FOAM_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (version ${CMAKE_CXX_COMPILER_VERSION})")
157+
else()
158+
set(FOAM_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
159+
endif()
160+
string(STRIP "${FOAM_COMPILER_STR}" FOAM_COMPILER_STR)
161+
149162
# ============
150163
# Installation
151164
# ============

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ EXtra-foam
1111
![Language](https://img.shields.io/badge/language-c++-red)
1212
[![Qt 5](https://img.shields.io/badge/Qt-5-brightgreen)](https://doc.qt.io/qt-5/)
1313

14+
![Overview](docs/images/extra_foam_0.9.0.jpg)
15+
1416
*EXtra-foam* (previously known as *[karaboFAI](https://in.xfel.eu/readthedocs/docs/karabofai/en/latest/)*) is a
1517
framework that provides super fast on-line (real-time) and off-line data analysis and visualization for
1618
experiments at European XFEL that using 2D detectors (e.g. AGIPD, DSSC, LPD, ePix100, FastCCD, JungFrau,
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Distributed under the terms of the BSD 3-Clause License.
3+
4+
The full license is in the file LICENSE, distributed with this software.
5+
6+
Author: Jun Zhu <[email protected]>
7+
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
8+
All rights reserved.
9+
"""
10+
import time
11+
12+
import numpy as np
13+
14+
from PyQt5.QtCore import QTimer
15+
16+
from extra_foam.gui import mkQApp
17+
from extra_foam.gui.plot_widgets import ImageViewF
18+
19+
app = mkQApp()
20+
21+
22+
class BenchmarkImageViewSpeed:
23+
def __init__(self):
24+
self._timer = QTimer()
25+
self._timer.timeout.connect(self.update)
26+
27+
self._data = np.random.normal(size=(50, 1024, 1280))
28+
self._prev_t = None
29+
self._count = 0
30+
31+
self._view = ImageViewF()
32+
self._view.show()
33+
34+
def start(self):
35+
self._prev_t = time.time()
36+
self._timer.start(0)
37+
38+
def update(self):
39+
self._view.setImage(self._data[self._count % 10])
40+
self._count += 1
41+
42+
now = time.time()
43+
dt = now - self._prev_t
44+
self._prev_t = now
45+
fps = 1.0/dt
46+
47+
self._view.setTitle(f"{fps:.2f} fps")
48+
49+
app.processEvents() # force complete redraw for every plot
50+
51+
52+
if __name__ == '__main__':
53+
bench = BenchmarkImageViewSpeed()
54+
bench.start()
55+
app.exec_()
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""
2+
Distributed under the terms of the BSD 3-Clause License.
3+
4+
The full license is in the file LICENSE, distributed with this software.
5+
6+
Author: Jun Zhu <[email protected]>
7+
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
8+
All rights reserved.
9+
"""
10+
import time
11+
from enum import IntEnum
12+
13+
import numpy as np
14+
15+
from PyQt5.QtCore import QTimer
16+
17+
from extra_foam.gui import mkQApp
18+
from extra_foam.gui.plot_widgets import PlotWidgetF
19+
20+
app = mkQApp()
21+
22+
23+
class PlotType(IntEnum):
24+
Line = 0
25+
Bar = 1
26+
StatisticsBar = 2
27+
Scatter = 3
28+
29+
30+
class BenchmarkPlotItemSpeed:
31+
def __init__(self, plot_type=PlotType.Line):
32+
self._timer = QTimer()
33+
self._timer.timeout.connect(self.update)
34+
35+
self._widget = PlotWidgetF()
36+
37+
if plot_type == PlotType.Line:
38+
self._graph = self._widget.plotCurve()
39+
n_pts = 5000
40+
elif plot_type == PlotType.Bar:
41+
self._graph = self._widget.plotBar()
42+
n_pts = 300
43+
elif plot_type == PlotType.StatisticsBar:
44+
self._graph = self._widget.plotStatisticsBar()
45+
self._graph.setBeam(1)
46+
n_pts = 500
47+
elif plot_type == PlotType.Scatter:
48+
self._graph = self._widget.plotScatter()
49+
n_pts = 3000
50+
else:
51+
raise ValueError(f"Unknown plot type: {plot_type}")
52+
53+
self._x = np.arange(n_pts)
54+
self._data = 100 * np.random.normal(size=(50, n_pts))
55+
if plot_type == PlotType.StatisticsBar:
56+
self._y_min = self._data - 20
57+
self._y_max = self._data + 20
58+
self._plot_type = plot_type
59+
60+
self._prev_t = None
61+
self._count = 0
62+
63+
self._widget.show()
64+
65+
def start(self):
66+
self._prev_t = time.time()
67+
self._timer.start(0)
68+
69+
def update(self):
70+
idx = self._count % 10
71+
if self._plot_type == PlotType.StatisticsBar:
72+
self._graph.setData(self._x, self._data[idx],
73+
y_min=self._y_min[idx], y_max=self._y_max[idx])
74+
else:
75+
self._graph.setData(self._x, self._data[idx])
76+
77+
self._count += 1
78+
79+
now = time.time()
80+
dt = now - self._prev_t
81+
self._prev_t = now
82+
fps = 1.0 / dt
83+
84+
self._widget.setTitle(f"{fps:.2f} fps")
85+
86+
app.processEvents() # force complete redraw for every plot
87+
88+
89+
if __name__ == '__main__':
90+
bench = BenchmarkPlotItemSpeed(PlotType.Line)
91+
bench.start()
92+
app.exec_()

docs/changelog.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11
CHANGELOG
22
=========
33

4+
0.9.0 (30 June 2020)
5+
------------------------
6+
7+
- **Bug Fix**
8+
9+
- Fix bug in data source tree introduced in 0.8.4. #235
10+
- Fix transparent Nan pixel with the latest pyqtgraph version. #231
11+
12+
- **Improvement**
13+
14+
- Improve performance of PlotCurveItem and add benchmarks for PlotItems and ImageViewF. #243
15+
- Make ctrl widgets in Imagetool more compact. #241
16+
- Improve C++ code quality and suppress TBB deprecate warning. #239
17+
- Add meter bar to plot area. #236
18+
- Reimplement ImageItem and PlotItem to replace the pyqtgraph ones. #232 #242
19+
- Improve data source updating and color encoding matched source items in
20+
the data source tree. #230 #234
21+
- Rename configurator to analysis setup manager and allow take snapshot for
22+
each setup. #228
23+
- Update data source and trouble shooting in documentation. #227
24+
- Add summary of compiler flags for EXtra-foam-python. #226
25+
- Update installation (gcc7) and CI (gcc8). #226
26+
- Rename misleading mouse mode in the right-click context menu. #211
27+
- Update pyqtgraph to the latest master branch. #206 #211 #233
28+
29+
- **New Feature**
30+
31+
- Annotate peaks in azimuthal integration view. #240
32+
- Enable Legend for all the plot items. #206 #237
33+
- Implement logarithmic X/Y scale in right-click context menu. #206
34+
- Enable C++ API installation and add examples. #227
35+
36+
437
0.8.4 (8 June 2020)
538
------------------------
639

docs/config_file.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ CONFIG FILE
66
Users from different instruments should use the corresponding config file to config
77
the instrument specific data sources, the detector specific setups and so on.
88

9+
Each instrument has a default config file, which can be found in the
10+
`github repository <https://github.com/European-XFEL/EXtra-foam/tree/dev/extra_foam/configs>`__.
11+
We appreciate if the beamline scientists can help us keep the default config file updated.
12+
913
Let's take *FXE* for example, when one starts a detector on topic *FXE* for the first by
1014
time:
1115

1216
.. code-block:: bash
1317
1418
extra-foam LPD FXE
1519
16-
, the system will create a new config file `$HOME/.EXtra-foam/fxe.config.yaml`.
20+
, the system will create a new config file `$HOME/.EXtra-foam/fxe.config.yaml` using the default one.
1721
The first block of the config file looks like the following:
1822

1923
.. code-block:: yaml

docs/image_tool.rst

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _Image tool:
2+
13
IMAGE TOOL
24
==========
35

@@ -247,8 +249,8 @@ aforementioned coordinate system, respectively.
247249
.. image:: images/pyFAI_PONI.png
248250
:width: 800
249251

250-
.. image:: images/azimuthal_integ_1D.png
251-
:width: 800
252+
.. image:: images/azimuthal_integ_1D.jpg
253+
252254

253255
+----------------------------+--------------------------------------------------------------------+
254256
| Input | Description |
@@ -288,6 +290,27 @@ aforementioned coordinate system, respectively.
288290
| | azimuthal integration result. |
289291
+----------------------------+--------------------------------------------------------------------+
290292

293+
By default, peak finding is activated and peak positions will be annotated along the scattering
294+
curve if the number of detected peaks is between 1 and 10. There is no special reason for choosing
295+
10 as the upper limit. Nevertheless, if there are two many peaks found, it may be due to a noisy
296+
scattering curve or some unreasonable peak-finding parameters.
297+
298+
For now, users can set prominence to refine the number of detected peaks and use a slicer to select
299+
part of them. The prominence of a peak measures how much a peak stands out from the surrounding
300+
baseline of the signal and is defined as the vertical distance between the peak and its lowest
301+
contour line. The slicer is useful when the scattering curve has some undesired structure, especially
302+
at the start and/or end of the curve.
303+
304+
+----------------------------+--------------------------------------------------------------------+
305+
| Input | Description |
306+
+============================+====================================================================+
307+
| ``Peak finding`` | Check to activate real-time peak finding and annotating. |
308+
+----------------------------+--------------------------------------------------------------------+
309+
| ``Peak prominence`` | Minimum prominence of peaks. |
310+
+----------------------------+--------------------------------------------------------------------+
311+
| ``Peak slicer`` | Pixel size along the detector's 2nd dimension. |
312+
+----------------------------+--------------------------------------------------------------------+
313+
291314

292315
.. _Geometry:
293316

docs/images/1d_binning.jpg

79.8 KB
Loading
47.7 KB
Loading

0 commit comments

Comments
 (0)