py4D-browser-transform 0.0.1__tar.gz → 0.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py4D-browser-transform
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: py4D-browser plugin that adds utility functions which transform the datacube
5
5
  Author-email: Chia-Hao Lee <chia-hao.lee@cornell.edu>
6
6
  Project-URL: Homepage, https://github.com/chiahao3/py4D-browser-transform
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE.txt
15
- Requires-Dist: py4d-browser
15
+ Requires-Dist: py4d-browser>=1.5.0
16
16
  Requires-Dist: py4dstem>=0.14.9
17
17
  Requires-Dist: numpy>=1.19
18
18
  Dynamic: license-file
@@ -22,18 +22,32 @@ Dynamic: license-file
22
22
  `py4D-browser-transform` is a plugin for [py4D-browser](https://github.com/sezelt/py4D-browser) that provides utility functions for transforming the datacube, currently including flipping, transposing, permuting axes. Other functions like cropping, resampling, and adjusting intensity offsets or scaling might be added in the future.
23
23
 
24
24
  ## Installation
25
- You can install `py4D-browser-transform` directly from GitHub using pip and git (assuming you have git avaialble):
25
+ You can install `py4D-browser-transform` directly from GitHub using pip or conda:
26
26
  ```bash
27
- pip install git+https://github.com/chiahao3/py4D-browser-transform
27
+ pip install py4d-browser-transform
28
28
  ```
29
29
 
30
30
  > 💡 **Note:**
31
31
  > - If you install into a fresh Python environment, `py4D-browser` and `py4DSTEM` will be automatically installed as dependencies so you don't need to install them first.
32
32
  > - If you already have `py4D-browser` installed, you can install this plugin into the same Python environment.
33
33
 
34
+ A step-by-step guide including creating a fresh Python environment via conda would look like this:
35
+ ```bash
36
+ conda create -n py4dgui python=3.12
37
+ conda activate py4dgui
38
+ python -m pip install --upgrade pip
39
+ python -m pip cache purge
40
+ pip install py4d-browser-transform
41
+ ```
42
+
34
43
  ## Usage
44
+ Simply run the following command to start the browser once you activated the corresponding Python environment:
45
+
46
+ ```bash
47
+ py4dgui
48
+ ```
35
49
 
36
- After installation, you should see the "Transform" submenu appear under the **"Plugins"** menu.
50
+ After installing this plugin, you should see the "Transform" submenu appear under the **"Plugins"** menu.
37
51
  From here, you can:
38
52
 
39
53
  - Flip or transpose the diffraction pattern.
@@ -3,18 +3,32 @@
3
3
  `py4D-browser-transform` is a plugin for [py4D-browser](https://github.com/sezelt/py4D-browser) that provides utility functions for transforming the datacube, currently including flipping, transposing, permuting axes. Other functions like cropping, resampling, and adjusting intensity offsets or scaling might be added in the future.
4
4
 
5
5
  ## Installation
6
- You can install `py4D-browser-transform` directly from GitHub using pip and git (assuming you have git avaialble):
6
+ You can install `py4D-browser-transform` directly from GitHub using pip or conda:
7
7
  ```bash
8
- pip install git+https://github.com/chiahao3/py4D-browser-transform
8
+ pip install py4d-browser-transform
9
9
  ```
10
10
 
11
11
  > 💡 **Note:**
12
12
  > - If you install into a fresh Python environment, `py4D-browser` and `py4DSTEM` will be automatically installed as dependencies so you don't need to install them first.
13
13
  > - If you already have `py4D-browser` installed, you can install this plugin into the same Python environment.
14
14
 
15
+ A step-by-step guide including creating a fresh Python environment via conda would look like this:
16
+ ```bash
17
+ conda create -n py4dgui python=3.12
18
+ conda activate py4dgui
19
+ python -m pip install --upgrade pip
20
+ python -m pip cache purge
21
+ pip install py4d-browser-transform
22
+ ```
23
+
15
24
  ## Usage
25
+ Simply run the following command to start the browser once you activated the corresponding Python environment:
26
+
27
+ ```bash
28
+ py4dgui
29
+ ```
16
30
 
17
- After installation, you should see the "Transform" submenu appear under the **"Plugins"** menu.
31
+ After installing this plugin, you should see the "Transform" submenu appear under the **"Plugins"** menu.
18
32
  From here, you can:
19
33
 
20
34
  - Flip or transpose the diffraction pattern.
@@ -16,7 +16,7 @@ classifiers = [
16
16
  "Operating System :: OS Independent",
17
17
  ]
18
18
  dependencies = [
19
- "py4d-browser",
19
+ "py4d-browser >= 1.5.0",
20
20
  "py4dstem >= 0.14.9",
21
21
  "numpy >= 1.19",
22
22
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py4D-browser-transform
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: py4D-browser plugin that adds utility functions which transform the datacube
5
5
  Author-email: Chia-Hao Lee <chia-hao.lee@cornell.edu>
6
6
  Project-URL: Homepage, https://github.com/chiahao3/py4D-browser-transform
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE.txt
15
- Requires-Dist: py4d-browser
15
+ Requires-Dist: py4d-browser>=1.5.0
16
16
  Requires-Dist: py4dstem>=0.14.9
17
17
  Requires-Dist: numpy>=1.19
18
18
  Dynamic: license-file
@@ -22,18 +22,32 @@ Dynamic: license-file
22
22
  `py4D-browser-transform` is a plugin for [py4D-browser](https://github.com/sezelt/py4D-browser) that provides utility functions for transforming the datacube, currently including flipping, transposing, permuting axes. Other functions like cropping, resampling, and adjusting intensity offsets or scaling might be added in the future.
23
23
 
24
24
  ## Installation
25
- You can install `py4D-browser-transform` directly from GitHub using pip and git (assuming you have git avaialble):
25
+ You can install `py4D-browser-transform` directly from GitHub using pip or conda:
26
26
  ```bash
27
- pip install git+https://github.com/chiahao3/py4D-browser-transform
27
+ pip install py4d-browser-transform
28
28
  ```
29
29
 
30
30
  > 💡 **Note:**
31
31
  > - If you install into a fresh Python environment, `py4D-browser` and `py4DSTEM` will be automatically installed as dependencies so you don't need to install them first.
32
32
  > - If you already have `py4D-browser` installed, you can install this plugin into the same Python environment.
33
33
 
34
+ A step-by-step guide including creating a fresh Python environment via conda would look like this:
35
+ ```bash
36
+ conda create -n py4dgui python=3.12
37
+ conda activate py4dgui
38
+ python -m pip install --upgrade pip
39
+ python -m pip cache purge
40
+ pip install py4d-browser-transform
41
+ ```
42
+
34
43
  ## Usage
44
+ Simply run the following command to start the browser once you activated the corresponding Python environment:
45
+
46
+ ```bash
47
+ py4dgui
48
+ ```
35
49
 
36
- After installation, you should see the "Transform" submenu appear under the **"Plugins"** menu.
50
+ After installing this plugin, you should see the "Transform" submenu appear under the **"Plugins"** menu.
37
51
  From here, you can:
38
52
 
39
53
  - Flip or transpose the diffraction pattern.
@@ -1,3 +1,3 @@
1
- py4d-browser
1
+ py4d-browser>=1.5.0
2
2
  py4dstem>=0.14.9
3
3
  numpy>=1.19
@@ -1,2 +1,2 @@
1
1
  from .transform import TransformPlugin
2
- __version__ = '0.0.1' # 2025.08.26
2
+ __version__ = '0.0.2' # 2026.05.06
@@ -53,8 +53,12 @@ class TransformPlugin(QWidget):
53
53
 
54
54
  # Add "Set Diffraction Flips" option
55
55
  self.set_diffraction_flips_action = QAction("Set Diffraction Flips", self)
56
- self.set_diffraction_flips_action.triggered.connect(self.set_diffraction_flips)
57
- self.transform_menu.addAction(self.set_diffraction_flips_action)
56
+ self.set_diffraction_flips_action.triggered.connect(self.set_diffraction_flips)
57
+ self.transform_menu.addAction(self.set_diffraction_flips_action)
58
+
59
+ def _set_transformed_datacube(self):
60
+ parent = self.parent
61
+ parent.set_datacube(parent.datacube, parent.windowTitle())
58
62
 
59
63
  def set_axis_permutation(self):
60
64
  parent = self.parent
@@ -67,14 +71,11 @@ class TransformPlugin(QWidget):
67
71
  inverse_permutation = np.argsort(self.current_permutation) # For example [0,2,3,1] should be reversed with [0,3,1,2]
68
72
  parent.datacube.data = np.transpose(parent.datacube.data, inverse_permutation)
69
73
 
70
- # Apply the new permutation
71
- parent.datacube.data = np.transpose(parent.datacube.data, new_permutation)
72
- self.current_permutation = new_permutation
73
-
74
- # Update views
75
- parent.update_scalebars()
76
- parent.update_diffraction_space_view(reset=True)
77
- parent.update_real_space_view(reset=True)
74
+ # Apply the new permutation
75
+ parent.datacube.data = np.transpose(parent.datacube.data, new_permutation)
76
+ self.current_permutation = new_permutation
77
+
78
+ self._set_transformed_datacube()
78
79
 
79
80
  def set_diffraction_flips(self):
80
81
  parent = self.parent
@@ -104,11 +105,9 @@ class TransformPlugin(QWidget):
104
105
  if new_flip_settings["transpose"]:
105
106
  parent.datacube.data = np.transpose(parent.datacube.data, (0, 1, 3, 2))
106
107
 
107
- # Update attributes and views
108
- self.flip_settings = new_flip_settings
109
- parent.update_scalebars()
110
- parent.update_diffraction_space_view(reset=True)
111
- parent.update_real_space_view(reset=True)
108
+ # Update attributes and views
109
+ self.flip_settings = new_flip_settings
110
+ self._set_transformed_datacube()
112
111
 
113
112
  class AxisPermutationDialog(QDialog):
114
113
  def __init__(self, parent=None, current_permutation=None):
@@ -235,4 +234,4 @@ class DiffractionFlipsDialog(QDialog):
235
234
  "flipud": self.flipud_checkbox.isChecked(),
236
235
  "fliplr": self.fliplr_checkbox.isChecked(),
237
236
  "transpose": self.transpose_checkbox.isChecked(),
238
- }
237
+ }