darfix 3.0.1__py3-none-any.whl → 4.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- darfix/_config.py +4 -1
- darfix/core/data_selection.py +22 -53
- darfix/core/dataset.py +333 -1533
- darfix/core/dimension.py +14 -4
- darfix/core/fscan_parser.py +4 -9
- darfix/core/grainplot.py +207 -123
- darfix/core/imageRegistration.py +14 -11
- darfix/core/imageStack.py +138 -0
- darfix/core/mapping.py +100 -49
- darfix/core/moment_types.py +10 -0
- darfix/core/noiseremoval.py +117 -60
- darfix/core/positioners.py +117 -0
- darfix/core/rocking_curves.py +80 -123
- darfix/core/rocking_curves_map.py +45 -0
- darfix/core/shiftcorrection.py +3 -12
- darfix/core/state_of_operation.py +48 -0
- darfix/core/utils.py +19 -1
- darfix/core/zigzag_mode.py +21 -19
- darfix/dtypes.py +4 -0
- darfix/gui/PCAWidget.py +2 -0
- darfix/gui/binningWidget.py +6 -7
- darfix/gui/blindSourceSeparationWidget.py +8 -6
- darfix/gui/chooseDimensions.py +21 -5
- darfix/gui/concatenate_scans.py +29 -1
- darfix/gui/configuration/level.py +1 -1
- darfix/gui/dataPartitionWidget.py +4 -0
- darfix/gui/data_selection/utils.py +6 -1
- darfix/gui/displayComponentsWidget.py +8 -14
- darfix/gui/filterByDimension.py +85 -0
- darfix/gui/grainplot/_oridist_toolbar_buttons.py +128 -0
- darfix/gui/grainplot/dimensionRangeSlider2D.py +105 -0
- darfix/gui/grainplot/flashlight.py +211 -0
- darfix/gui/grainplot/flashlight_mode_action.py +35 -0
- darfix/gui/grainplot/grainPlotWidget.py +28 -63
- darfix/gui/grainplot/mosaicityWidget.py +261 -158
- darfix/gui/grainplot/oridist_toolbar.py +87 -0
- darfix/gui/grainplot/utils.py +3 -8
- darfix/gui/magnificationWidget.py +3 -2
- darfix/gui/metadataWidget.py +1 -1
- darfix/gui/noiseremoval/noise_removal_widget.py +350 -0
- darfix/gui/noiseremoval/operation_list_widget.py +73 -0
- darfix/gui/noiseremoval/{parametersWidget.py → parameters_widget.py} +15 -64
- darfix/gui/operationProcess.py +47 -0
- darfix/gui/projectionWidget.py +1 -1
- darfix/gui/rocking_curves/fitComboBox.py +1 -1
- darfix/gui/rocking_curves/rockingCurvesPlot.py +304 -0
- darfix/gui/rocking_curves/rockingCurvesWidget.py +50 -307
- darfix/gui/rocking_curves/utils.py +12 -0
- darfix/gui/roiSelectionWidget.py +4 -4
- darfix/gui/rsmHistogramWidget.py +19 -33
- darfix/gui/rsmWidget.py +1 -1
- darfix/gui/shiftcorrection/shiftCorrectionWidget.py +74 -212
- darfix/gui/shiftcorrection/shiftInput.py +18 -26
- darfix/gui/utils/axis_type_combobox.py +22 -0
- darfix/gui/utils/custom_doublespinbox.py +19 -0
- darfix/gui/utils/rangeSlider.py +93 -0
- darfix/gui/utils/standardButtonBox.py +16 -4
- darfix/gui/utils/utils.py +16 -1
- darfix/gui/weakBeamWidget.py +5 -12
- darfix/gui/zSumWidget.py +26 -48
- darfix/main.py +23 -3
- darfix/math.py +55 -18
- darfix/pixel_sizes.py +1 -1
- darfix/processing/imageOperations.py +117 -0
- darfix/processing/rocking_curves.py +358 -129
- darfix/resources/gui/icons/contour.svg +39 -0
- darfix/resources/gui/icons/flashlight.svg +14 -0
- darfix/resources/gui/icons/hsv.svg +303 -0
- darfix/resources/gui/icons/median-filter.png +0 -0
- darfix/resources/gui/icons/median-filter.svg +8 -0
- darfix/tasks/binning.py +2 -24
- darfix/tasks/blindsourceseparation.py +5 -13
- darfix/tasks/dimensiondefinition.py +22 -32
- darfix/tasks/grainplot.py +42 -61
- darfix/tasks/hdf5_data_selection.py +3 -9
- darfix/tasks/hdf5_scans_concatenation.py +69 -28
- darfix/tasks/noiseremoval.py +45 -26
- darfix/tasks/pca.py +0 -6
- darfix/tasks/projection.py +3 -7
- darfix/tasks/rocking_curves.py +15 -27
- darfix/tasks/roi.py +1 -1
- darfix/tasks/shiftcorrection.py +16 -16
- darfix/tasks/zsum.py +11 -22
- darfix/tests/conftest.py +3 -18
- darfix/tests/decomposition/test_nica.py +2 -2
- darfix/tests/gui/test_dimension_range_slider_2d.py +70 -0
- darfix/tests/gui/test_range_slider_with_spinboxes.py +133 -0
- darfix/tests/orange/test_ewoks.py +10 -35
- darfix/tests/orange/widgets/test_concatenate_hdf5_scans.py +2 -1
- darfix/tests/orange/widgets/test_dimension.py +2 -11
- darfix/tests/orange/widgets/test_hdf5_data_selection.py +0 -5
- darfix/tests/orange/widgets/test_transformation.py +5 -4
- darfix/tests/tasks/test_binning.py +1 -1
- darfix/tests/tasks/test_data_copy.py +4 -2
- darfix/tests/tasks/test_datapartition.py +14 -9
- darfix/tests/tasks/test_dimensiondefinition.py +5 -38
- darfix/tests/tasks/test_hdf5_data_selection.py +1 -5
- darfix/tests/tasks/test_hdf5_scans_concatenation.py +18 -1
- darfix/tests/tasks/test_rocking_curves.py +7 -5
- darfix/tests/test_dataset.py +18 -571
- darfix/tests/test_dimension.py +28 -32
- darfix/tests/test_generate_grain_maps_nxdict.py +61 -0
- darfix/tests/test_image_operations.py +41 -193
- darfix/tests/test_image_registration.py +36 -76
- darfix/tests/test_image_stack.py +129 -0
- darfix/tests/test_mask.py +12 -16
- darfix/tests/test_math.py +50 -6
- darfix/tests/test_moments.py +7 -17
- darfix/tests/test_projection.py +10 -10
- darfix/tests/test_rocking_curves.py +28 -61
- darfix/tests/test_rsm_histogram.py +3 -5
- darfix/tests/test_save_dataset.py +21 -0
- darfix/tests/test_shift.py +94 -81
- darfix/tests/test_transformation.py +10 -23
- darfix/tests/test_workflow.py +12 -14
- darfix/tests/test_zigzag.py +4 -8
- darfix/tests/test_zsum.py +12 -12
- darfix/tests/utils.py +94 -243
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/METADATA +11 -2
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/RECORD +138 -132
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/licenses/LICENSE +3 -1
- orangecontrib/darfix/widgets/blindsourceseparation.py +1 -1
- orangecontrib/darfix/widgets/concatenateHDF5.py +13 -0
- orangecontrib/darfix/widgets/datasetWidgetBase.py +76 -0
- orangecontrib/darfix/widgets/dimensions.py +27 -28
- orangecontrib/darfix/widgets/grainplot.py +7 -17
- orangecontrib/darfix/widgets/hdf5dataselection.py +5 -10
- orangecontrib/darfix/widgets/noiseremoval.py +25 -102
- orangecontrib/darfix/widgets/operationWidgetBase.py +156 -0
- orangecontrib/darfix/widgets/pca.py +1 -1
- orangecontrib/darfix/widgets/rockingcurves.py +4 -14
- orangecontrib/darfix/widgets/roiselection.py +6 -15
- orangecontrib/darfix/widgets/shiftcorrection.py +24 -53
- orangecontrib/darfix/widgets/weakbeam.py +1 -1
- orangecontrib/darfix/widgets/zsum.py +16 -24
- darfix/core/data.py +0 -530
- darfix/core/geneticShiftDetection.py +0 -198
- darfix/core/imageOperations.py +0 -232
- darfix/core/selection.py +0 -90
- darfix/gui/data_selection/edf.py +0 -358
- darfix/gui/lineProfileWidget.py +0 -63
- darfix/gui/linkComponentsWidget.py +0 -228
- darfix/gui/noiseremoval/noiseRemovalWidget.py +0 -433
- darfix/gui/noiseremoval/operationHistory.py +0 -60
- darfix/gui/showStackWidget.py +0 -61
- darfix/io/dataset_io.py +0 -67
- darfix/tasks/edf_data_selection.py +0 -70
- darfix/tests/orange/widgets/test_edf_data_selection.py +0 -109
- darfix/tests/tasks/test_edf_data_selection.py +0 -42
- darfix/tests/test_data.py +0 -184
- darfix/tests/test_ga.py +0 -144
- orangecontrib/darfix/tutorials/darfix_example_edf.ows +0 -27
- orangecontrib/darfix/tutorials/untitled.ows +0 -32
- orangecontrib/darfix/widgets/edfdataselection.py +0 -90
- orangecontrib/darfix/widgets/icons/line_profile.png +0 -0
- orangecontrib/darfix/widgets/icons/line_profile.svg +0 -87
- orangecontrib/darfix/widgets/icons/link.png +0 -0
- orangecontrib/darfix/widgets/icons/link.svg +0 -77
- orangecontrib/darfix/widgets/lineprofile.py +0 -25
- orangecontrib/darfix/widgets/linkcomponents.py +0 -26
- orangecontrib/darfix/widgets/savepoint.py +0 -44
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/WHEEL +0 -0
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/entry_points.txt +0 -0
- {darfix-3.0.1.dist-info → darfix-4.2.0.dist-info}/top_level.txt +0 -0
darfix/_config.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
FWHM_VAL = 2.35482 # For numba
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class Config:
|
|
2
5
|
"""
|
|
3
6
|
Class containing shared global configuration for the darfix project.
|
|
@@ -15,7 +18,7 @@ class Config:
|
|
|
15
18
|
.. versionadded:: 0.3
|
|
16
19
|
"""
|
|
17
20
|
|
|
18
|
-
FWHM_VAL =
|
|
21
|
+
FWHM_VAL = FWHM_VAL
|
|
19
22
|
|
|
20
23
|
"""Magic value that returns FWHM when multiplied by the standard deviation.
|
|
21
24
|
|
darfix/core/data_selection.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import urllib.parse
|
|
3
3
|
import urllib.request
|
|
4
|
-
from typing import Iterable
|
|
5
4
|
from typing import Optional
|
|
6
5
|
from typing import Union
|
|
7
6
|
|
|
@@ -11,94 +10,66 @@ from darfix.core.dataset import ImageDataset
|
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
def load_process_data(
|
|
14
|
-
|
|
13
|
+
detector_url: Union[str, DataUrl],
|
|
15
14
|
root_dir: Optional[str] = None,
|
|
16
|
-
|
|
17
|
-
dark_filename: Optional[Union[str, DataUrl]] = None,
|
|
18
|
-
copy_files: bool = True,
|
|
19
|
-
isH5: bool = False,
|
|
15
|
+
dark_detector_url: Optional[Union[str, DataUrl]] = None,
|
|
20
16
|
title: str = "",
|
|
21
17
|
metadata_url=None,
|
|
22
18
|
):
|
|
23
19
|
"""
|
|
24
|
-
Loads data from `
|
|
25
|
-
If `
|
|
20
|
+
Loads data from `detector_url`.
|
|
21
|
+
If `detector_url` is:
|
|
26
22
|
|
|
27
23
|
- a str: consider it as a file pattern (for EDF files).
|
|
28
|
-
- an iterable: consider a list of EDF files.
|
|
29
24
|
- a DataUrl: consider it readable by silx `get_data` function
|
|
30
25
|
|
|
31
|
-
:param
|
|
26
|
+
:param detector_url: detector_url to be loaded.
|
|
32
27
|
:param metadata_url: path to the scan metadata for HDF5 containing positioner information in order to load metadata for non-edf files
|
|
33
28
|
"""
|
|
34
29
|
indices = li_indices = None
|
|
35
30
|
root_dir_specified = bool(root_dir)
|
|
36
|
-
if isinstance(filenames, Iterable) and not isinstance(filenames, str) and isH5:
|
|
37
|
-
assert len(filenames) == 1
|
|
38
|
-
filenames = filenames[0]
|
|
39
31
|
|
|
40
|
-
if isinstance(
|
|
41
|
-
assert
|
|
32
|
+
if isinstance(detector_url, DataUrl):
|
|
33
|
+
assert detector_url.file_path() not in (
|
|
42
34
|
"",
|
|
43
35
|
None,
|
|
44
36
|
), "no file_path provided to the DataUrl"
|
|
45
37
|
if not root_dir_specified:
|
|
46
|
-
root_dir = os.path.dirname(
|
|
38
|
+
root_dir = os.path.dirname(detector_url.file_path())
|
|
47
39
|
dataset = ImageDataset(
|
|
48
40
|
_dir=root_dir,
|
|
49
|
-
|
|
50
|
-
in_memory=in_memory,
|
|
51
|
-
copy_files=copy_files,
|
|
52
|
-
isH5=isH5,
|
|
41
|
+
detector_url=detector_url,
|
|
53
42
|
title=title,
|
|
54
43
|
metadata_url=metadata_url,
|
|
55
44
|
)
|
|
56
|
-
elif isinstance(
|
|
57
|
-
if not
|
|
58
|
-
raise ValueError("'
|
|
45
|
+
elif isinstance(detector_url, str):
|
|
46
|
+
if not detector_url:
|
|
47
|
+
raise ValueError("'detector_url' cannot be an empty string")
|
|
59
48
|
if not root_dir_specified:
|
|
60
|
-
root_dir = _get_root_dir(
|
|
49
|
+
root_dir = _get_root_dir(detector_url)
|
|
61
50
|
dataset = ImageDataset(
|
|
62
51
|
_dir=root_dir,
|
|
63
|
-
|
|
64
|
-
in_memory=in_memory,
|
|
65
|
-
copy_files=copy_files,
|
|
66
|
-
isH5=isH5,
|
|
67
|
-
title=title,
|
|
68
|
-
metadata_url=metadata_url,
|
|
69
|
-
)
|
|
70
|
-
elif isinstance(filenames, Iterable):
|
|
71
|
-
filenames = list(filenames)
|
|
72
|
-
if not root_dir_specified:
|
|
73
|
-
root_dir = _get_root_dir(filenames[0])
|
|
74
|
-
dataset = ImageDataset(
|
|
75
|
-
_dir=root_dir,
|
|
76
|
-
filenames=filenames,
|
|
77
|
-
in_memory=in_memory,
|
|
78
|
-
copy_files=copy_files,
|
|
79
|
-
isH5=isH5,
|
|
52
|
+
detector_url=detector_url,
|
|
80
53
|
title=title,
|
|
81
54
|
metadata_url=metadata_url,
|
|
82
55
|
)
|
|
83
56
|
else:
|
|
84
57
|
raise TypeError(
|
|
85
|
-
f"Expected
|
|
58
|
+
f"Expected detector_url to be a string or a silx DataUrl. Got {type(detector_url)} instead."
|
|
86
59
|
)
|
|
87
60
|
|
|
88
|
-
if not
|
|
61
|
+
if not dark_detector_url:
|
|
89
62
|
bg_dataset = None
|
|
90
|
-
elif isinstance(
|
|
63
|
+
elif isinstance(dark_detector_url, str):
|
|
91
64
|
dark_root_dir = os.path.join(dataset.dir, "dark")
|
|
92
65
|
os.makedirs(dark_root_dir, exist_ok=True)
|
|
93
66
|
bg_dataset = ImageDataset(
|
|
94
67
|
_dir=dark_root_dir,
|
|
95
|
-
|
|
96
|
-
copy_files=False,
|
|
97
|
-
isH5=isH5,
|
|
68
|
+
detector_url=dark_detector_url,
|
|
98
69
|
metadata_url=None,
|
|
99
70
|
)
|
|
100
|
-
elif isinstance(
|
|
101
|
-
assert
|
|
71
|
+
elif isinstance(dark_detector_url, DataUrl):
|
|
72
|
+
assert dark_detector_url.file_path() not in (
|
|
102
73
|
"",
|
|
103
74
|
None,
|
|
104
75
|
), "no file_path provided to the DataUrl"
|
|
@@ -106,14 +77,12 @@ def load_process_data(
|
|
|
106
77
|
os.makedirs(dark_root_dir, exist_ok=True)
|
|
107
78
|
bg_dataset = ImageDataset(
|
|
108
79
|
_dir=dark_root_dir,
|
|
109
|
-
|
|
110
|
-
copy_files=False,
|
|
111
|
-
isH5=isH5,
|
|
80
|
+
detector_url=dark_detector_url,
|
|
112
81
|
metadata_url=None,
|
|
113
82
|
)
|
|
114
83
|
else:
|
|
115
84
|
raise TypeError(
|
|
116
|
-
f"Expected
|
|
85
|
+
f"Expected dark_detector_url to be a string or a silx DataUrl. Got {type(dark_detector_url)} instead."
|
|
117
86
|
)
|
|
118
87
|
|
|
119
88
|
assert dataset.data is not None and dataset.data.size > 0, "No data was loaded!"
|