darfix 4.0.3__tar.gz → 4.1.0__tar.gz

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.
Files changed (288) hide show
  1. {darfix-4.0.3/src/darfix.egg-info → darfix-4.1.0}/PKG-INFO +5 -2
  2. {darfix-4.0.3 → darfix-4.1.0}/README.md +2 -0
  3. {darfix-4.0.3 → darfix-4.1.0}/pyproject.toml +3 -2
  4. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/dataset.py +13 -15
  5. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/dimension.py +8 -0
  6. darfix-4.1.0/src/darfix/core/grainplot.py +289 -0
  7. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/imageRegistration.py +5 -4
  8. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/imageStack.py +8 -0
  9. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/mapping.py +3 -3
  10. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/noiseremoval.py +20 -12
  11. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/positioners.py +7 -1
  12. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/rocking_curves.py +4 -4
  13. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/utils.py +4 -0
  14. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/blindSourceSeparationWidget.py +3 -3
  15. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/concatenate_scans.py +29 -1
  16. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/configuration/level.py +1 -1
  17. darfix-4.1.0/src/darfix/gui/grainplot/_oridist_toolbar_buttons.py +128 -0
  18. darfix-4.1.0/src/darfix/gui/grainplot/dimensionRangeSlider2D.py +105 -0
  19. darfix-4.1.0/src/darfix/gui/grainplot/flashlight.py +211 -0
  20. darfix-4.1.0/src/darfix/gui/grainplot/flashlight_mode_action.py +35 -0
  21. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/grainplot/grainPlotWidget.py +3 -20
  22. darfix-4.1.0/src/darfix/gui/grainplot/mosaicityWidget.py +378 -0
  23. darfix-4.1.0/src/darfix/gui/grainplot/oridist_toolbar.py +87 -0
  24. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/grainplot/utils.py +2 -1
  25. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/magnificationWidget.py +3 -2
  26. darfix-4.1.0/src/darfix/gui/noiseremoval/noise_removal_widget.py +325 -0
  27. darfix-4.0.3/src/darfix/gui/noiseremoval/operationHistory.py → darfix-4.1.0/src/darfix/gui/noiseremoval/operation_list_widget.py +31 -17
  28. darfix-4.0.3/src/darfix/gui/noiseremoval/parametersWidget.py → darfix-4.1.0/src/darfix/gui/noiseremoval/parameters_widget.py +7 -6
  29. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rsmHistogramWidget.py +1 -1
  30. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rsmWidget.py +1 -1
  31. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/shiftcorrection/shiftCorrectionWidget.py +6 -6
  32. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/shiftcorrection/shiftInput.py +13 -15
  33. darfix-4.1.0/src/darfix/gui/utils/rangeSlider.py +97 -0
  34. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/standardButtonBox.py +7 -0
  35. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/main.py +18 -1
  36. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/pixel_sizes.py +1 -1
  37. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/processing/imageOperations.py +29 -5
  38. darfix-4.1.0/src/darfix/resources/gui/icons/contour.svg +39 -0
  39. darfix-4.1.0/src/darfix/resources/gui/icons/flashlight.svg +14 -0
  40. darfix-4.1.0/src/darfix/resources/gui/icons/hsv.svg +303 -0
  41. darfix-4.1.0/src/darfix/resources/gui/icons/median-filter.png +0 -0
  42. darfix-4.1.0/src/darfix/resources/gui/icons/median-filter.svg +8 -0
  43. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/blindsourceseparation.py +3 -12
  44. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/dimensiondefinition.py +9 -8
  45. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/grainplot.py +23 -14
  46. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/hdf5_scans_concatenation.py +69 -28
  47. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/noiseremoval.py +11 -4
  48. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/shiftcorrection.py +10 -2
  49. darfix-4.1.0/src/darfix/tests/gui/test_dimension_range_slider_2d.py +70 -0
  50. darfix-4.1.0/src/darfix/tests/gui/test_range_slider_with_spinboxes.py +138 -0
  51. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/test_ewoks.py +8 -6
  52. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/widgets/test_concatenate_hdf5_scans.py +2 -1
  53. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_hdf5_scans_concatenation.py +18 -1
  54. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_rocking_curves.py +2 -2
  55. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_dimension.py +4 -4
  56. darfix-4.1.0/src/darfix/tests/test_generate_grain_maps_nxdict.py +61 -0
  57. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_save_dataset.py +4 -3
  58. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/utils.py +1 -1
  59. {darfix-4.0.3 → darfix-4.1.0/src/darfix.egg-info}/PKG-INFO +5 -2
  60. {darfix-4.0.3 → darfix-4.1.0}/src/darfix.egg-info/SOURCES.txt +19 -4
  61. {darfix-4.0.3 → darfix-4.1.0}/src/darfix.egg-info/requires.txt +2 -1
  62. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/blindsourceseparation.py +1 -1
  63. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/concatenateHDF5.py +13 -0
  64. darfix-4.1.0/src/orangecontrib/darfix/widgets/datasetWidgetBase.py +76 -0
  65. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/dimensions.py +5 -22
  66. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/grainplot.py +5 -16
  67. darfix-4.1.0/src/orangecontrib/darfix/widgets/noiseremoval.py +38 -0
  68. darfix-4.1.0/src/orangecontrib/darfix/widgets/operationWidgetBase.py +156 -0
  69. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/rockingcurves.py +3 -16
  70. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/roiselection.py +5 -8
  71. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/shiftcorrection.py +9 -25
  72. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/zsum.py +6 -12
  73. darfix-4.0.3/src/darfix/core/grainplot.py +0 -269
  74. darfix-4.0.3/src/darfix/gui/grainplot/mosaicityWidget.py +0 -248
  75. darfix-4.0.3/src/darfix/gui/noiseremoval/noiseRemovalWidget.py +0 -296
  76. darfix-4.0.3/src/orangecontrib/darfix/widgets/noiseremoval.py +0 -122
  77. darfix-4.0.3/src/orangecontrib/darfix/widgets/operationBase.py +0 -108
  78. {darfix-4.0.3 → darfix-4.1.0}/LICENSE +0 -0
  79. {darfix-4.0.3 → darfix-4.1.0}/setup.cfg +0 -0
  80. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/__init__.py +0 -0
  81. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/_config.py +0 -0
  82. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/_version.py +0 -0
  83. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/__init__.py +0 -0
  84. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/array_utils.py +0 -0
  85. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/autofocus.py +0 -0
  86. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/componentsMatching.py +0 -0
  87. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/data_selection.py +0 -0
  88. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/datapathfinder.py +0 -0
  89. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/fscan_parser.py +0 -0
  90. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/roi.py +0 -0
  91. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/settings.py +0 -0
  92. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/shiftcorrection.py +0 -0
  93. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/state_of_operation.py +0 -0
  94. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/transformation.py +0 -0
  95. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/core/zigzag_mode.py +0 -0
  96. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/__init__.py +0 -0
  97. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/base.py +0 -0
  98. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/ipca.py +0 -0
  99. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/nica.py +0 -0
  100. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/nmf.py +0 -0
  101. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/decomposition/pca.py +0 -0
  102. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/dtypes.py +0 -0
  103. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/PCAWidget.py +0 -0
  104. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/__init__.py +0 -0
  105. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/binningWidget.py +0 -0
  106. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/chooseDimensions.py +0 -0
  107. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/configuration/__init__.py +0 -0
  108. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/configuration/action.py +0 -0
  109. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/dataPartitionWidget.py +0 -0
  110. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/DataSelectionBase.py +0 -0
  111. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/WorkingDirSelectionWidget.py +0 -0
  112. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/__init__.py +0 -0
  113. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/hdf5_data_selection_widgets.py +0 -0
  114. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/line_edits.py +0 -0
  115. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/scan_selection_widgets.py +0 -0
  116. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/data_selection/utils.py +0 -0
  117. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/dimensionsWidget.py +0 -0
  118. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/displayComponentsWidget.py +0 -0
  119. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/filterByDimension.py +0 -0
  120. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/grainplot/__init__.py +0 -0
  121. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/metadataWidget.py +0 -0
  122. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/operationProcess.py +0 -0
  123. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/operationThread.py +0 -0
  124. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/projectionWidget.py +0 -0
  125. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rocking_curves/fitComboBox.py +0 -0
  126. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rocking_curves/rockingCurvesPlot.py +0 -0
  127. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rocking_curves/rockingCurvesWidget.py +0 -0
  128. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/rocking_curves/utils.py +0 -0
  129. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/roiLimitsToolbar.py +0 -0
  130. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/roiSelectionWidget.py +0 -0
  131. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/shiftcorrection/__init__.py +0 -0
  132. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/__init__.py +0 -0
  133. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/axis_type_combobox.py +0 -0
  134. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/data_path_completer.py +0 -0
  135. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/data_path_selection.py +0 -0
  136. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/fileselection.py +0 -0
  137. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/message.py +0 -0
  138. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/qsignalspy.py +0 -0
  139. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/utils.py +0 -0
  140. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/utils/vspacer.py +0 -0
  141. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/weakBeamWidget.py +0 -0
  142. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/gui/zSumWidget.py +0 -0
  143. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/io/__init__.py +0 -0
  144. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/io/hdf5.py +0 -0
  145. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/io/progress.py +0 -0
  146. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/io/utils.py +0 -0
  147. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/math.py +0 -0
  148. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/processing/__init__.py +0 -0
  149. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/processing/dimension_detection.py +0 -0
  150. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/processing/rocking_curves.py +0 -0
  151. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/__init__.py +0 -0
  152. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/__init__.py +0 -0
  153. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/__init__.py +0 -0
  154. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/advanced_settings.png +0 -0
  155. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/advanced_settings.svg +0 -0
  156. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/curves.png +0 -0
  157. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/curves.svg +0 -0
  158. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/optional_settings.png +0 -0
  159. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/optional_settings.svg +0 -0
  160. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/required_settings.png +0 -0
  161. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/required_settings.svg +0 -0
  162. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/resize.png +0 -0
  163. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/resize.svg +0 -0
  164. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/scatter.png +0 -0
  165. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/gui/icons/scatter.svg +0 -0
  166. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/tests/__init__.py +0 -0
  167. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/tests/dimensions_definition/NiTi_1PD_002_g411_420MPa_mosalayers_2x.h5 +0 -0
  168. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/tests/dimensions_definition/__init__.py +0 -0
  169. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/tests/dimensions_definition/silicon_111_reflection.h5 +0 -0
  170. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/resources/tests/transformation/316H_dummy_insitu_g1_RSM_2.h5 +0 -0
  171. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/__init__.py +0 -0
  172. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/binning.py +0 -0
  173. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/copy.py +0 -0
  174. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/datapartition.py +0 -0
  175. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/hdf5_data_selection.py +0 -0
  176. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/metadata.py +0 -0
  177. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/pca.py +0 -0
  178. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/projection.py +0 -0
  179. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/rocking_curves.py +0 -0
  180. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/roi.py +0 -0
  181. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/rsm_histogram.py +0 -0
  182. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/transformation.py +0 -0
  183. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/weakbeam.py +0 -0
  184. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tasks/zsum.py +0 -0
  185. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/__init__.py +0 -0
  186. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/conftest.py +0 -0
  187. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/__init__.py +0 -0
  188. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/test_base.py +0 -0
  189. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/test_ipca.py +0 -0
  190. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/test_nica.py +0 -0
  191. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/test_nmf.py +0 -0
  192. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/decomposition/utils.py +0 -0
  193. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/gui/test_concatenate_scans.py +0 -0
  194. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/gui/test_data_path_completer.py +0 -0
  195. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/gui/test_data_path_selection.py +0 -0
  196. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/gui/test_roi_selection.py +0 -0
  197. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/__init__.py +0 -0
  198. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/widgets/__init__.py +0 -0
  199. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/widgets/test_dimension.py +0 -0
  200. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/widgets/test_hdf5_data_selection.py +0 -0
  201. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/widgets/test_transformation.py +0 -0
  202. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/orange/workflow_files/concatenate_scans.ows +0 -0
  203. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_binning.py +0 -0
  204. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_data_copy.py +0 -0
  205. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_datapartition.py +0 -0
  206. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_dimensiondefinition.py +0 -0
  207. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/tasks/test_hdf5_data_selection.py +0 -0
  208. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_array_utils.py +0 -0
  209. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_components_matching.py +0 -0
  210. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_datapathfinder.py +0 -0
  211. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_dataset.py +0 -0
  212. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_image_operations.py +0 -0
  213. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_image_registration.py +0 -0
  214. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_image_stack.py +0 -0
  215. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_mapping.py +0 -0
  216. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_mask.py +0 -0
  217. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_math.py +0 -0
  218. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_moments.py +0 -0
  219. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_projection.py +0 -0
  220. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_rocking_curves.py +0 -0
  221. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_roi.py +0 -0
  222. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_rsm_histogram.py +0 -0
  223. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_shift.py +0 -0
  224. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_transformation.py +0 -0
  225. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_workflow.py +0 -0
  226. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_zigzag.py +0 -0
  227. {darfix-4.0.3 → darfix-4.1.0}/src/darfix/tests/test_zsum.py +0 -0
  228. {darfix-4.0.3 → darfix-4.1.0}/src/darfix.egg-info/dependency_links.txt +0 -0
  229. {darfix-4.0.3 → darfix-4.1.0}/src/darfix.egg-info/entry_points.txt +0 -0
  230. {darfix-4.0.3 → darfix-4.1.0}/src/darfix.egg-info/top_level.txt +0 -0
  231. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/__init__.py +0 -0
  232. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/__init__.py +0 -0
  233. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/darfix_example1.ows +0 -0
  234. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/darfix_example_hdf.ows +0 -0
  235. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/edf_dataset/strain_0000.edf +0 -0
  236. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/edf_dataset/strain_0001.edf +0 -0
  237. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/hdf5_dataset/strain.hdf5 +0 -0
  238. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/tutorials/tutorial_workflow.ows +0 -0
  239. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/__init__.py +0 -0
  240. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/binning.py +0 -0
  241. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/datacopy.py +0 -0
  242. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/datapartition.py +0 -0
  243. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/hdf5dataselection.py +0 -0
  244. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/__init__.py +0 -0
  245. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/axes.png +0 -0
  246. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/axes.svg +0 -0
  247. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/bss.png +0 -0
  248. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/bss.svg +0 -0
  249. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/category.svg +0 -0
  250. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/concatenate_hdf5.svg +0 -0
  251. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/copy.svg +0 -0
  252. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/curves.png +0 -0
  253. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/curves.svg +0 -0
  254. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/darfix_icon.png +0 -0
  255. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/darfix_icon.svg +0 -0
  256. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/darfix_icon8.png +0 -0
  257. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/filter.png +0 -0
  258. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/filter.svg +0 -0
  259. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/gaussian.png +0 -0
  260. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/gaussian.svg +0 -0
  261. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/grainplot.png +0 -0
  262. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/grainplot.svg +0 -0
  263. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/image-select-box.svg +0 -0
  264. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/metadata.png +0 -0
  265. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/metadata.svg +0 -0
  266. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/mywidget.svg +0 -0
  267. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/noise_removal.png +0 -0
  268. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/noise_removal.svg +0 -0
  269. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/noise_removal_backup.svg +0 -0
  270. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/param_dims.png +0 -0
  271. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/param_dims.svg +0 -0
  272. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/pca.png +0 -0
  273. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/pca.svg +0 -0
  274. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/random.svg +0 -0
  275. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/resize.png +0 -0
  276. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/roi.png +0 -0
  277. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/roi.svg +0 -0
  278. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/save.svg +0 -0
  279. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/shift_correction.svg +0 -0
  280. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/upload_edf.svg +0 -0
  281. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/upload_hdf5.svg +0 -0
  282. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/icons/zsum.svg +0 -0
  283. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/metadata.py +0 -0
  284. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/pca.py +0 -0
  285. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/projection.py +0 -0
  286. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/rsmhistogram.py +0 -0
  287. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/transformation.py +0 -0
  288. {darfix-4.0.3 → darfix-4.1.0}/src/orangecontrib/darfix/widgets/weakbeam.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: darfix
3
- Version: 4.0.3
3
+ Version: 4.1.0
4
4
  Summary: Computer vision software for the interpretation of diffraction images
5
5
  Author-email: ESRF <dau-pydev@esrf.fr>
6
6
  License: The MIT license follows:
@@ -40,6 +40,7 @@ Requires-Dist: numpy<3
40
40
  Requires-Dist: numba
41
41
  Requires-Dist: silx<3,>=2.2.0
42
42
  Requires-Dist: matplotlib
43
+ Requires-Dist: PyOpenGL
43
44
  Requires-Dist: ewoks>=1.0.0
44
45
  Requires-Dist: packaging
45
46
  Requires-Dist: scikit-learn
@@ -49,7 +50,7 @@ Requires-Dist: eval_type_backport
49
50
  Provides-Extra: full-noqt
50
51
  Requires-Dist: opencv-python-headless>=4.3.0.36; extra == "full-noqt"
51
52
  Requires-Dist: scikit-image>=0.17.1; extra == "full-noqt"
52
- Requires-Dist: ewoksorange>=1.0.0; extra == "full-noqt"
53
+ Requires-Dist: ewoksorange<3.0.0,>=2.1.0; extra == "full-noqt"
53
54
  Requires-Dist: hdf5plugin; extra == "full-noqt"
54
55
  Provides-Extra: full
55
56
  Requires-Dist: darfix[full_noqt]; extra == "full"
@@ -96,6 +97,8 @@ darfix
96
97
 
97
98
  Drag widgets from the left panel to the canvas to start making your workflow.
98
99
 
100
+ See https://darfix.readthedocs.io/en/stable/#installation for more infos and **Troubleshooting**.
101
+
99
102
  ## Documentation
100
103
 
101
104
  The documentation of the latest release is available at https://darfix.readthedocs.io
@@ -17,6 +17,8 @@ darfix
17
17
 
18
18
  Drag widgets from the left panel to the canvas to start making your workflow.
19
19
 
20
+ See https://darfix.readthedocs.io/en/stable/#installation for more infos and **Troubleshooting**.
21
+
20
22
  ## Documentation
21
23
 
22
24
  The documentation of the latest release is available at https://darfix.readthedocs.io
@@ -8,7 +8,7 @@ addopts = "--import-mode=importlib" # for all pytest versions, pytest-cov needs
8
8
 
9
9
  [project]
10
10
  name = "darfix"
11
- version = "4.0.3"
11
+ version = "4.1.0"
12
12
  keywords = ["orange3 add-on","ewoks"]
13
13
  authors = [{name = "ESRF", email = "dau-pydev@esrf.fr"}]
14
14
  description = "Computer vision software for the interpretation of diffraction images"
@@ -25,6 +25,7 @@ dependencies = [
25
25
  "numba",
26
26
  "silx >= 2.2.0,<3",
27
27
  "matplotlib",
28
+ "PyOpenGL",
28
29
  "ewoks >=1.0.0",
29
30
  "packaging",
30
31
  "scikit-learn",
@@ -44,7 +45,7 @@ Changelog = "https://gitlab.esrf.fr/XRD/darfix/-/blob/main/CHANGELOG.md"
44
45
  full_noqt = [
45
46
  "opencv-python-headless >=4.3.0.36",
46
47
  "scikit-image>=0.17.1",
47
- "ewoksorange >=1.0.0",
48
+ "ewoksorange (>=2.1.0,<3.0.0)",
48
49
  "hdf5plugin",
49
50
  ]
50
51
  full = [
@@ -84,6 +84,7 @@ class ImageDataset(ImageStack):
84
84
  :param transformation: Axes to use when displaying the images
85
85
  :param metadata_url: url to the metadata
86
86
  :param positioners: positioners metadata instance
87
+ :param moments: Pre-computed statistical 4 moments for each dimension 0:COM 1:Fwhm 2:Skewness 3:Kurtosis
87
88
  .. warning::
88
89
 
89
90
  When loading the full dataset will be store to memory.
@@ -95,10 +96,11 @@ class ImageDataset(ImageStack):
95
96
  raw_data: numpy.ndarray | None = None,
96
97
  detector_url: str | DataUrl | None = None,
97
98
  dims: AcquisitionDims | None = None,
98
- transformation: numpy.ndarray | None = None,
99
+ transformation: Transformation | None = None,
99
100
  title: str | None = None,
100
101
  metadata_url: DataUrl | str | None = None,
101
102
  positioners: Positioners | None = None,
103
+ moments: dict[int, numpy.ndarray] = {},
102
104
  ):
103
105
 
104
106
  if raw_data is None:
@@ -106,7 +108,7 @@ class ImageDataset(ImageStack):
106
108
  super().__init__(raw_data)
107
109
 
108
110
  self._frames_intensity = []
109
- self.moments_dims = {}
111
+ self.moments_dims = moments
110
112
  self.state_of_operations = StateOfOperations()
111
113
  self._dir = _dir
112
114
  self._transformation = transformation
@@ -147,7 +149,7 @@ class ImageDataset(ImageStack):
147
149
  self.state_of_operations.stop(operation)
148
150
 
149
151
  @property
150
- def transformation(self):
152
+ def transformation(self) -> Transformation:
151
153
  return self._transformation
152
154
 
153
155
  @transformation.setter
@@ -165,7 +167,7 @@ class ImageDataset(ImageStack):
165
167
  return self._positioners.url
166
168
 
167
169
  @property
168
- def dir(self):
170
+ def dir(self) -> str:
169
171
  return self._dir
170
172
 
171
173
  @property
@@ -950,14 +952,12 @@ class ImageDataset(ImageStack):
950
952
  return dataset
951
953
 
952
954
  @staticmethod
953
- def load_from_output_dir(output_dir: str, filename: str = "data.h5"):
954
- file = Path(output_dir) / filename
955
+ def load(file: str):
955
956
  h5dict = h5todict(file)
956
957
 
957
958
  if "positioners" in h5dict:
958
959
  positioners = Positioners(
959
960
  DataUrl(file_path=file, data_path="/positioners", scheme="silx"),
960
- h5dict["positioners"],
961
961
  )
962
962
  else:
963
963
  positioners = None
@@ -975,27 +975,25 @@ class ImageDataset(ImageStack):
975
975
  dimensions = None
976
976
 
977
977
  loaded_dataset = ImageDataset(
978
- output_dir,
979
- raw_data=h5dict["raw_data"],
978
+ Path(file).parent,
979
+ raw_data=h5dict["preprocessed_data"],
980
980
  dims=dimensions,
981
- transformation=h5dict.get("transformation", None),
982
981
  title=h5dict.get("title", None),
983
982
  positioners=positioners,
984
983
  )
985
984
  loaded_dataset.reshape_data()
986
985
  return loaded_dataset
987
986
 
988
- def save_in_output_dir(self, filename: str = "data.h5"):
989
- file = Path(self._dir) / filename
987
+ def save(self, file: str):
988
+ file = Path(file)
990
989
  if "RAW_DATA" in file.parts:
991
990
  raise PermissionError(
992
991
  f"Write in RAW_DATA dir of ESRF is not allowed: {file}"
993
992
  )
994
993
  h5dict = {
995
- "raw_data": self.as_array3d(),
994
+ "preprocessed_data": self.as_array3d(),
996
995
  "dimensions": self.dims.to_dict(),
997
- "positioners": self.metadata_dict,
998
- "transformation": self.transformation,
996
+ "positioners": self._positioners.all(),
999
997
  "title": self.title,
1000
998
  "writer": {"name": "darfix", "version": __version__},
1001
999
  }
@@ -131,6 +131,14 @@ class Dimension:
131
131
  """
132
132
  return self._stop
133
133
 
134
+ def min(self) -> float:
135
+ """Note : min can be different from start if step is negative"""
136
+ return min(self._start, self._stop)
137
+
138
+ def max(self) -> float:
139
+ """Note : max can be different from stop if step is negative"""
140
+ return max(self._start, self._stop)
141
+
134
142
  @property
135
143
  def step(self) -> float:
136
144
  """
@@ -0,0 +1,289 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+ from typing import Any
5
+ from typing import Tuple
6
+
7
+ import numpy
8
+ from matplotlib.colors import hsv_to_rgb
9
+ from silx.math.medianfilter import medfilt2d
10
+
11
+ from darfix.core.transformation import Transformation
12
+ from darfix.io.utils import create_nxdata_dict
13
+
14
+ from ..dtypes import AxisType
15
+ from .dataset import ImageDataset
16
+ from .utils import compute_hsv
17
+
18
+ DimensionRange = Tuple[float, float]
19
+
20
+
21
+ class MomentType(Enum):
22
+ COM = "Center of mass"
23
+ FWHM = "FWHM"
24
+ SKEWNESS = "Skewness"
25
+ KURTOSIS = "Kurtosis"
26
+
27
+
28
+ class OrientationDistData:
29
+ KEY_IMAGE_SIZE = 1000
30
+
31
+ def __init__(
32
+ self,
33
+ dataset: ImageDataset,
34
+ x_dimension: int,
35
+ y_dimension: int,
36
+ x_dimension_range: DimensionRange,
37
+ y_dimension_range: DimensionRange,
38
+ zsum: numpy.ndarray | None = None,
39
+ ) -> None:
40
+ """
41
+ Store data for orientation distribution RGB layer (the HSV colormap) and data (Histogram 2D)
42
+
43
+ :param zsum: Precomputed dataset.zsum() used as the weight of the histogram 2D . If None dataset.zsum() is called.
44
+ """
45
+
46
+ if len(dataset.moments_dims) == 0:
47
+ raise ValueError("Moments should be computed before.")
48
+
49
+ com_x = dataset.moments_dims[x_dimension][0].ravel()
50
+ com_y = dataset.moments_dims[y_dimension][0].ravel()
51
+
52
+ self.x_range = x_dimension_range
53
+ self.y_range = y_dimension_range
54
+
55
+ if zsum is None:
56
+ zsum = dataset.zsum()
57
+ zsum = zsum.ravel()
58
+ else:
59
+ zsum = zsum.ravel()
60
+
61
+ # automatic bins
62
+ # In darfix<=3.x orientation distribution shape was the size of the dimension
63
+ # A x2 Factor is a little thinner. To see if it needs to be update in the future.
64
+ self.x_bins = dataset.dims.get(x_dimension).size * 2
65
+ self.y_bins = dataset.dims.get(y_dimension).size * 2
66
+
67
+ self.x_label = dataset.dims.get(x_dimension).name
68
+ self.y_label = dataset.dims.get(y_dimension).name
69
+
70
+ x_data = numpy.linspace(-1, 1, self.KEY_IMAGE_SIZE)
71
+ y_data = numpy.linspace(-1, 1, self.KEY_IMAGE_SIZE)
72
+ x_mesh, y_mesh = numpy.meshgrid(x_data, y_data)
73
+ self.rgb_key = hsv_to_rgb(compute_hsv(x_mesh, y_mesh))
74
+
75
+ # Histogram in 2D
76
+ histogram, _, _ = numpy.histogram2d(
77
+ com_y,
78
+ com_x, # note: y first is in purpose : see numpy.histogram2d documentation
79
+ weights=zsum, # We need to take into account pixel intensity
80
+ bins=[self.y_bins, self.x_bins],
81
+ range=[self.y_range, self.x_range],
82
+ )
83
+ self.data = histogram
84
+ """Orientation distribution data as an histogram 2D of the center of mass in two dimensions"""
85
+ self.smooth_data = medfilt2d(numpy.ascontiguousarray(self.data))
86
+ """ `self.data` filtered with a median filter 2D"""
87
+
88
+ def x_data_values(self) -> numpy.ndarray:
89
+ return numpy.linspace(
90
+ self.x_range[0], self.x_range[1], self.x_bins, endpoint=False
91
+ )
92
+
93
+ def y_data_values(self) -> numpy.ndarray:
94
+ return numpy.linspace(
95
+ self.y_range[0], self.y_range[1], self.y_bins, endpoint=False
96
+ )
97
+
98
+ def x_rgb_key_values(self) -> numpy.ndarray:
99
+ return numpy.linspace(
100
+ self.x_range[0], self.x_range[1], self.KEY_IMAGE_SIZE, endpoint=False
101
+ )
102
+
103
+ def y_rgb_key_values(self) -> numpy.ndarray:
104
+ return numpy.linspace(
105
+ self.y_range[0], self.y_range[1], self.KEY_IMAGE_SIZE, endpoint=False
106
+ )
107
+
108
+ def origin(
109
+ self,
110
+ origin: AxisType,
111
+ ) -> tuple[float, float]:
112
+ if origin == "dims":
113
+ return (self.x_range[0], self.y_range[0])
114
+ elif origin == "center":
115
+ return (
116
+ -numpy.ptp(self.x_range) / 2,
117
+ -numpy.ptp(self.y_range) / 2,
118
+ )
119
+ else:
120
+ return (0, 0)
121
+
122
+ def data_plot_scale(self) -> tuple[float, float]:
123
+ return (
124
+ numpy.ptp(self.x_range) / self.x_bins,
125
+ numpy.ptp(self.y_range) / self.y_bins,
126
+ )
127
+
128
+ def rgb_key_plot_scale(self) -> tuple[float, float]:
129
+ return (
130
+ numpy.ptp(self.x_range) / self.KEY_IMAGE_SIZE,
131
+ numpy.ptp(self.y_range) / self.KEY_IMAGE_SIZE,
132
+ )
133
+
134
+ def to_motor_coordinates(
135
+ self,
136
+ points_x: numpy.ndarray,
137
+ points_y: numpy.ndarray,
138
+ origin: AxisType,
139
+ ) -> tuple[numpy.ndarray, numpy.ndarray]:
140
+ """
141
+ Given points_x, points_y in the 2D space of self.data, returns motor coordinates x, y
142
+ """
143
+ x_origin, y_origin = self.origin(origin)
144
+ return (
145
+ points_x * numpy.ptp(self.x_range) / (self.x_bins - 1) + x_origin,
146
+ points_y * numpy.ptp(self.y_range) / (self.y_bins - 1) + y_origin,
147
+ )
148
+
149
+
150
+ class MultiDimMomentType(Enum):
151
+ """Moments that are only computed for datasets with multiple dimensions"""
152
+
153
+ ORIENTATION_DIST = "Orientation distribution"
154
+ MOSAICITY = "Mosaicity"
155
+
156
+
157
+ def get_axes(transformation: Transformation | None) -> tuple[
158
+ tuple[numpy.ndarray, numpy.ndarray] | None,
159
+ tuple[str, str] | None,
160
+ tuple[str, str] | None,
161
+ ]:
162
+ if not transformation:
163
+ return None, None, None
164
+
165
+ axes = (transformation.xregular, transformation.yregular)
166
+ axes_names = ("x", "y")
167
+ axes_long_names = (transformation.label, transformation.label)
168
+
169
+ return axes, axes_names, axes_long_names
170
+
171
+
172
+ def compute_normalized_component(
173
+ component: numpy.ndarray, dimension_range: DimensionRange
174
+ ):
175
+
176
+ min_component = dimension_range[0]
177
+ max_component = dimension_range[1]
178
+
179
+ return 2 * (component - min_component) / (max_component - min_component) - 1
180
+
181
+
182
+ def compute_mosaicity(
183
+ moments: dict[int, numpy.ndarray],
184
+ x_dimension: int,
185
+ y_dimension: int,
186
+ x_dimension_range: DimensionRange,
187
+ y_dimension_range: DimensionRange,
188
+ ):
189
+ norm_center_of_mass_x = compute_normalized_component(
190
+ moments[x_dimension][0],
191
+ dimension_range=x_dimension_range,
192
+ )
193
+ norm_center_of_mass_y = compute_normalized_component(
194
+ moments[y_dimension][0],
195
+ dimension_range=y_dimension_range,
196
+ )
197
+ return hsv_to_rgb(compute_hsv(norm_center_of_mass_x, norm_center_of_mass_y))
198
+
199
+
200
+ def create_moment_nxdata_groups(
201
+ parent: dict[str, Any],
202
+ moment_data: numpy.ndarray,
203
+ axes,
204
+ axes_names,
205
+ axes_long_names,
206
+ ):
207
+
208
+ for i, map_type in enumerate(MomentType):
209
+ map_value = map_type.value
210
+ parent[map_value] = create_nxdata_dict(
211
+ moment_data[i],
212
+ map_value,
213
+ axes,
214
+ axes_names,
215
+ axes_long_names,
216
+ )
217
+
218
+
219
+ def generate_grain_maps_nxdict(
220
+ dataset: ImageDataset,
221
+ mosaicity: numpy.ndarray | None,
222
+ orientation_dist_image: OrientationDistData | None,
223
+ ) -> dict:
224
+ moments = dataset.moments_dims
225
+ axes, axes_names, axes_long_names = get_axes(dataset.transformation)
226
+
227
+ nx = {
228
+ "entry": {"@NX_class": "NXentry"},
229
+ "@NX_class": "NXroot",
230
+ "@default": "entry",
231
+ }
232
+
233
+ if mosaicity is not None:
234
+ nx["entry"][MultiDimMomentType.MOSAICITY.value] = create_nxdata_dict(
235
+ mosaicity,
236
+ MultiDimMomentType.MOSAICITY.value,
237
+ axes,
238
+ axes_names,
239
+ axes_long_names,
240
+ rgba=True,
241
+ )
242
+ nx["entry"]["@default"] = MultiDimMomentType.MOSAICITY.value
243
+ else:
244
+ nx["entry"]["@default"] = MomentType.COM.value
245
+
246
+ if orientation_dist_image is not None:
247
+ nx["entry"][MultiDimMomentType.ORIENTATION_DIST.value] = {
248
+ "key": create_nxdata_dict(
249
+ orientation_dist_image.rgb_key,
250
+ "image",
251
+ (
252
+ orientation_dist_image.y_rgb_key_values(),
253
+ orientation_dist_image.x_rgb_key_values(),
254
+ ),
255
+ (orientation_dist_image.y_label, orientation_dist_image.x_label),
256
+ rgba=True,
257
+ ),
258
+ "data": create_nxdata_dict(
259
+ orientation_dist_image.data,
260
+ "orientation distribution",
261
+ (
262
+ orientation_dist_image.y_data_values(),
263
+ orientation_dist_image.x_data_values(),
264
+ ),
265
+ (orientation_dist_image.y_label, orientation_dist_image.x_label),
266
+ ),
267
+ "@default": "data",
268
+ }
269
+
270
+ if dataset.dims.ndim <= 1:
271
+ create_moment_nxdata_groups(
272
+ nx["entry"],
273
+ moments[0],
274
+ axes,
275
+ axes_names,
276
+ axes_long_names,
277
+ )
278
+ else:
279
+ for axis, dim in dataset.dims.items():
280
+ nx["entry"][dim.name] = {"@NX_class": "NXcollection"}
281
+ create_moment_nxdata_groups(
282
+ nx["entry"][dim.name],
283
+ moments[axis],
284
+ axes,
285
+ axes_names,
286
+ axes_long_names,
287
+ )
288
+
289
+ return nx
@@ -22,10 +22,11 @@ try:
22
22
  except ImportError:
23
23
  from skimage.feature import register_translation as phase_cross_correlation
24
24
 
25
+ from enum import Enum as _Enum
26
+
25
27
  from packaging.version import Version
26
28
  from scipy.ndimage import center_of_mass
27
29
  from scipy.ndimage import fourier_shift
28
- from silx.utils.enum import Enum as _Enum
29
30
 
30
31
  from darfix.io import utils
31
32
 
@@ -168,7 +169,7 @@ def apply_opencv_shift(img, shift, shift_approach="fft"):
168
169
  raise RuntimeError(
169
170
  "opencv-python is not installed. Unable to apply shift with it. Please install it."
170
171
  )
171
- shift_approach = ShiftApproach.from_value(shift_approach)
172
+ shift_approach = ShiftApproach(shift_approach)
172
173
  if shift_approach == ShiftApproach.LINEAR:
173
174
  img = img.astype(numpy.int16)
174
175
  M = numpy.float32([[1, 0, shift[1]], [0, 1, shift[0]]])
@@ -203,7 +204,7 @@ def improve_linear_shift(
203
204
  :param Union[`linear`,`fft`] shift_approach: The shift method to be used to apply the shift.
204
205
  :returns: ndarray
205
206
  """
206
- shift_approach = ShiftApproach.from_value(shift_approach)
207
+ shift_approach = ShiftApproach(shift_approach)
207
208
  v = numpy.asanyarray(v)
208
209
  iData = range(data.shape[0])
209
210
 
@@ -283,7 +284,7 @@ def shift_correction(data, n_shift, shift_approach="fft", callback=None):
283
284
  :returns: The shifted images.
284
285
  :rtype: ndarray
285
286
  """
286
- shift_approach = ShiftApproach.from_value(shift_approach)
287
+ shift_approach = ShiftApproach(shift_approach)
287
288
 
288
289
  shift = numpy.asanyarray(n_shift)
289
290
 
@@ -125,6 +125,14 @@ class ImageStack:
125
125
  indices: numpy.ndarray | None = None,
126
126
  fixed_dimension: FixedDimension | None = None,
127
127
  ):
128
+ """
129
+ Act like `self.as_array3d` if `fixed_dimension` is None.
130
+
131
+ :warning: if `fixed_dimension` is not None, this method duplicate the fitered part of the dataset.
132
+ """
133
+ if fixed_dimension is None:
134
+ return self.as_array3d(indices)
135
+
128
136
  return self.as_array3d()[
129
137
  self.filter_indices(indices=indices, fixed_dimension=fixed_dimension)
130
138
  ]
@@ -15,7 +15,7 @@ import darfix
15
15
  from ..math import Vector3D
16
16
 
17
17
 
18
- @njit(parallel=True, fastmath=True, error_model="numpy")
18
+ @njit(parallel=True, fastmath=True, cache=True, error_model="numpy")
19
19
  def _mean_fast(
20
20
  x: numpy.ndarray,
21
21
  y: numpy.ndarray,
@@ -34,7 +34,7 @@ def _mean_fast(
34
34
  return mean
35
35
 
36
36
 
37
- @njit(parallel=True, fastmath=True, error_model="numpy")
37
+ @njit(parallel=True, fastmath=True, cache=True, error_model="numpy")
38
38
  def _sigma_fast(
39
39
  x: numpy.ndarray,
40
40
  y: numpy.ndarray,
@@ -57,7 +57,7 @@ def _sigma_fast(
57
57
  return sigma
58
58
 
59
59
 
60
- @njit(parallel=True, fastmath=True, error_model="numpy")
60
+ @njit(parallel=True, fastmath=True, cache=True, error_model="numpy")
61
61
  def _skewness_kurtosis_fast(
62
62
  x: numpy.ndarray,
63
63
  y: numpy.ndarray,
@@ -2,12 +2,12 @@ from __future__ import annotations
2
2
 
3
3
  from concurrent.futures import ThreadPoolExecutor
4
4
  from concurrent.futures import as_completed
5
+ from enum import Enum as _Enum
5
6
  from typing import Any
6
7
  from typing import Callable
7
8
  from typing import TypedDict
8
9
 
9
10
  import numpy
10
- from silx.utils.enum import Enum as _Enum
11
11
  from tqdm import tqdm
12
12
 
13
13
  from darfix.core.utils import OperationAborted
@@ -26,34 +26,40 @@ class BackgroundType(_Enum):
26
26
  class NoiseRemovalOperation(TypedDict):
27
27
  type: Operation
28
28
  parameters: dict[str, Any]
29
- aborted: bool
30
29
 
31
30
 
32
31
  def operation_to_str(op: NoiseRemovalOperation) -> str:
33
32
  result = None
34
- if op["type"] is Operation.BS:
33
+ op_type = op["type"]
34
+ if op_type is Operation.BS:
35
35
  result = f"Background subtraction {op['parameters']}"
36
36
 
37
- elif op["type"] is Operation.HP:
37
+ elif op_type is Operation.HP:
38
38
  result = f"Hot pixel removal: {op['parameters']}"
39
39
 
40
- elif op["type"] is Operation.THRESHOLD:
40
+ elif op_type is Operation.THRESHOLD:
41
41
  result = f"Threshold removal: {op['parameters']}"
42
42
 
43
- elif op["type"] is Operation.MASK:
43
+ elif op_type is Operation.MASK:
44
44
  result = "Mask removal"
45
+ else:
46
+ raise ValueError(f"Unknown operation type {op_type}")
47
+ return result
45
48
 
46
- if result is not None:
47
- return result + (" ABORTED" if "aborted" in op else "")
48
49
 
49
- return super().__str__(op)
50
+ def clean_operation_dict(op: NoiseRemovalOperation) -> dict:
51
+ """Just keep `type` and `parameters` in the saved dict"""
52
+ return {
53
+ "type": op["type"],
54
+ "parameters": op["parameters"],
55
+ }
50
56
 
51
57
 
52
58
  def apply_noise_removal_operation(
53
59
  image: numpy.ndarray, operation: NoiseRemovalOperation
54
60
  ) -> None:
55
61
  if operation["type"] is Operation.BS:
56
- apply_background_substraction(image, **operation["parameters"])
62
+ apply_background_substraction(image, operation["background"])
57
63
 
58
64
  if operation["type"] is Operation.HP:
59
65
  apply_hot_pixel_removal(image, **operation["parameters"])
@@ -76,7 +82,7 @@ def create_background_substraction_operation(
76
82
  method = imageOperations.Method.MEDIAN
77
83
 
78
84
  if background_type is not None:
79
- background_type = BackgroundType.from_value(background_type)
85
+ background_type = BackgroundType(background_type)
80
86
 
81
87
  if background_type == BackgroundType.DARK_DATA:
82
88
  bg = dataset.bg_dataset.as_array3d()
@@ -88,10 +94,12 @@ def create_background_substraction_operation(
88
94
  raise NotImplementedError(
89
95
  f"Background type {background_type!r} not implemented yet."
90
96
  )
97
+ parameters = dict(method=method, background_type=background_type)
91
98
 
92
99
  return NoiseRemovalOperation(
93
100
  type=Operation.BS,
94
- parameters=dict(background=imageOperations.compute_background(bg, method)),
101
+ parameters=parameters,
102
+ background=imageOperations.compute_background(bg, method),
95
103
  )
96
104
 
97
105
 
@@ -38,9 +38,15 @@ class Positioners:
38
38
  else:
39
39
  self.load()
40
40
 
41
+ def all(self):
42
+ """
43
+ Merge constants and data in the same dict
44
+ """
45
+ return {**self._data, **self._constants}
46
+
41
47
  def load(self):
42
48
  """
43
- Use url to load data
49
+ Use url to load data and constants
44
50
  """
45
51
  h5_positioners_dict = {}
46
52
  self._constants = {}
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import multiprocessing
4
+ from enum import Enum as _Enum
4
5
  from functools import partial
5
6
  from multiprocessing import Pool
6
7
  from typing import Generator
@@ -11,7 +12,6 @@ from typing import Union
11
12
 
12
13
  import numpy
13
14
  import tqdm
14
- from silx.utils.enum import Enum as _Enum
15
15
 
16
16
  from ..io.utils import create_nxdata_dict
17
17
  from ..processing.rocking_curves import FitMethod
@@ -61,9 +61,9 @@ class Maps_3D(_Enum):
61
61
  CORRELATION_YZ = "Cross-correlation between second and third motors"
62
62
 
63
63
 
64
- MAPS_1D: Tuple[Maps_1D] = Maps_1D.values()
65
- MAPS_2D: Tuple[Maps_2D] = Maps_2D.values()
66
- MAPS_3D: Tuple[Maps_3D] = Maps_3D.values()
64
+ MAPS_1D: Tuple[Maps_1D] = tuple(member.value for member in Maps_1D)
65
+ MAPS_2D: Tuple[Maps_2D] = tuple(member.value for member in Maps_2D)
66
+ MAPS_3D: Tuple[Maps_3D] = tuple(member.value for member in Maps_3D)
67
67
 
68
68
 
69
69
  def _rocking_curves_per_px(