stemdiff 5.2.6__tar.gz → 5.2.10__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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: stemdiff
3
- Version: 5.2.6
3
+ Version: 5.2.10
4
4
  Summary: Convert 4D-STEM data to 2D-powder diffraction pattern.
5
5
  Home-page: https://github.com/mirekslouf/stemdiff/
6
6
  Author: Mirek Slouf
@@ -18,6 +18,17 @@ Requires-Dist: matplotlib
18
18
  Requires-Dist: scipy
19
19
  Requires-Dist: pandas
20
20
  Requires-Dist: scikit-image
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: license
28
+ Dynamic: project-url
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
21
32
 
22
33
  STEMDIFF :: 4D-STEM dataset to 2D-diffractogram
23
34
  -----------------------------------------------
@@ -31,7 +42,7 @@ STEMDIFF :: 4D-STEM dataset to 2D-diffractogram
31
42
  [https://doi.org/10.3390/nano11040962](https://doi.org/10.3390/nano11040962)
32
43
  2. *Materials* 14 (2021) 7550.
33
44
  [https://doi.org/10.3390/ma14247550](https://doi.org/10.3390/ma14247550)
34
- * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-).
45
+ * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-)
35
46
 
36
47
  Principle
37
48
  ---------
@@ -40,7 +51,7 @@ Principle
40
51
 
41
52
  Installation
42
53
  ------------
43
- * Requirement: Python with sci-modules: numpy, matplotlib, scipy, pandas
54
+ * Requirement: Python with sci-modules = numpy, matplotlib, scipy, pandas
44
55
  * `pip install scikit-image` = 3rd party package for advanced image processing
45
56
  * `pip install tqdm` = to show progress meter during long summations
46
57
  * `pip install idiff` = to improve diffractograms (remove noise, background ...)
@@ -49,20 +60,23 @@ Installation
49
60
  Quick start
50
61
  -----------
51
62
 
52
- * See how it works:
53
- - Look at [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
54
- in Jupyter.
55
- * Try it yourself:
56
- - Download [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0).
57
- - After downloading, unzip and follow the instructions in *readme* file.
63
+ * Look at the
64
+ [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
65
+ to see STEMDIFF in action.
66
+ * Download
67
+ [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0)
68
+ and try STEMDIFF yourself.
58
69
 
59
70
  Documentation, help and examples
60
71
  --------------------------------
61
72
 
62
- * [PyPI](https://pypi.org/project/stemdiff) repository.
63
- * [GitHub](https://github.com/mirekslouf/stemdiff) repository.
73
+ * [PyPI](https://pypi.org/project/stemdiff) repository -
74
+ the stable version to install.
75
+ * [GitHub](https://github.com/mirekslouf/stemdiff) repository -
76
+ the current version under development.
64
77
  * [GitHub Pages](https://mirekslouf.github.io/stemdiff)
65
- with [documentation](https://mirekslouf.github.io/stemdiff/docs).
78
+ with [help](https://mirekslouf.github.io/stemdiff/docs)
79
+ and [complete package documentation](https://mirekslouf.github.io/stemdiff/docs/pdoc.html/stemdiff.html).
66
80
 
67
81
  ## Versions of STEMDIFF
68
82
 
@@ -89,3 +103,9 @@ Documentation, help and examples
89
103
  - more types of deconvolution (experimental; to be finished in v.6.0)
90
104
  * Version 5.1 = (beta) support for parallel processing
91
105
  * Version 5.2 = (beta) improvement of diff.patterns in sister package idiff
106
+
107
+ Acknowledgement
108
+ ---------------
109
+
110
+ The development was co-funded by TACR, program NCK,
111
+ project [TN02000020](https://www.isibrno.cz/en/centre-advanced-electron-and-photonic-optics).
@@ -10,7 +10,7 @@ STEMDIFF :: 4D-STEM dataset to 2D-diffractogram
10
10
  [https://doi.org/10.3390/nano11040962](https://doi.org/10.3390/nano11040962)
11
11
  2. *Materials* 14 (2021) 7550.
12
12
  [https://doi.org/10.3390/ma14247550](https://doi.org/10.3390/ma14247550)
13
- * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-).
13
+ * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-)
14
14
 
15
15
  Principle
16
16
  ---------
@@ -19,7 +19,7 @@ Principle
19
19
 
20
20
  Installation
21
21
  ------------
22
- * Requirement: Python with sci-modules: numpy, matplotlib, scipy, pandas
22
+ * Requirement: Python with sci-modules = numpy, matplotlib, scipy, pandas
23
23
  * `pip install scikit-image` = 3rd party package for advanced image processing
24
24
  * `pip install tqdm` = to show progress meter during long summations
25
25
  * `pip install idiff` = to improve diffractograms (remove noise, background ...)
@@ -28,20 +28,23 @@ Installation
28
28
  Quick start
29
29
  -----------
30
30
 
31
- * See how it works:
32
- - Look at [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
33
- in Jupyter.
34
- * Try it yourself:
35
- - Download [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0).
36
- - After downloading, unzip and follow the instructions in *readme* file.
31
+ * Look at the
32
+ [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
33
+ to see STEMDIFF in action.
34
+ * Download
35
+ [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0)
36
+ and try STEMDIFF yourself.
37
37
 
38
38
  Documentation, help and examples
39
39
  --------------------------------
40
40
 
41
- * [PyPI](https://pypi.org/project/stemdiff) repository.
42
- * [GitHub](https://github.com/mirekslouf/stemdiff) repository.
41
+ * [PyPI](https://pypi.org/project/stemdiff) repository -
42
+ the stable version to install.
43
+ * [GitHub](https://github.com/mirekslouf/stemdiff) repository -
44
+ the current version under development.
43
45
  * [GitHub Pages](https://mirekslouf.github.io/stemdiff)
44
- with [documentation](https://mirekslouf.github.io/stemdiff/docs).
46
+ with [help](https://mirekslouf.github.io/stemdiff/docs)
47
+ and [complete package documentation](https://mirekslouf.github.io/stemdiff/docs/pdoc.html/stemdiff.html).
45
48
 
46
49
  ## Versions of STEMDIFF
47
50
 
@@ -68,3 +71,9 @@ Documentation, help and examples
68
71
  - more types of deconvolution (experimental; to be finished in v.6.0)
69
72
  * Version 5.1 = (beta) support for parallel processing
70
73
  * Version 5.2 = (beta) improvement of diff.patterns in sister package idiff
74
+
75
+ Acknowledgement
76
+ ---------------
77
+
78
+ The development was co-funded by TACR, program NCK,
79
+ project [TN02000020](https://www.isibrno.cz/en/centre-advanced-electron-and-photonic-optics).
@@ -13,12 +13,12 @@ Conversion of a 4D-STEM dataset to a 2D-powder diffration pattern.
13
13
 
14
14
  STEMDIFF modules:
15
15
 
16
- * stemdiff.dbase = calculate database of 4D-stem datafiles
16
+ * stemdiff.dbase = database of 4D-STEM datafiles + their basic parameters
17
17
  * stemdiff.detectors = objects describing detectors and format of the datafiles
18
18
  * stemdiff.gvars = objects describing *source data* and *diffraction images*
19
19
  * stemdiff.io = input/output for datafiles and corresponding arrays + images
20
20
  * stemdiff.sum = summation of datafiles (standard, serial processing)
21
- * stemdiff.summ = summation of datafiles (parallel, multicore processing)
21
+ * stemdiff.summ = summation of datafiles (multicore, parallel processing)
22
22
 
23
23
  STEMDIFF auxiliary package IDIFF and its modules:
24
24
 
@@ -30,7 +30,8 @@ STEMDIFF auxiliary package IDIFF and its modules:
30
30
  - idiff.ncore = noise correction/reduction
31
31
  - idiff.psf = estimate of PSF function
32
32
  '''
33
- __version__ = "5.2.6"
33
+ __version__ = "5.2.10"
34
+
34
35
 
35
36
  # Import modules of stemdiff package
36
37
  # this enables us to use modules as follows:
@@ -43,8 +44,30 @@ import stemdiff.io
43
44
  import stemdiff.sum
44
45
  import stemdiff.summ
45
46
 
47
+
46
48
  # Import supplementary package idiff
47
49
  # this enables us to use the modules as follows:
48
50
  # >>> import stemdiff as sd
49
51
  # >>> sd.idiff.bcorr.rolling_ball(arr)
50
52
  import idiff
53
+
54
+
55
+ # Obligatory acknowledgement -- the development was co-funded by TACR.
56
+ # TACR requires that the acknowledgement is printed when we run the program.
57
+ # Nevertheless, Python packages run within other programs, not directly.
58
+ # The following code ensures that the acknowledgement is printed when:
59
+ # (1) You run this file: __init__.py
60
+ # (2) You run the package from command line: python -m stemdiff
61
+ # Technical notes:
62
+ # To get item (2) above, we define __main__.py (next to __init__.py).
63
+ # The usage of __main__.py is not very common, but still quite standard.
64
+
65
+ def acknowledgement():
66
+ print('STEMDIFF package - convert 4D-STEM data to 2D powder diffractogram.')
67
+ print('------')
68
+ print('The development of the package was co-funded by')
69
+ print('the Technology agency of the Czech Republic,')
70
+ print('program NCK, project TN02000020.')
71
+
72
+ if __name__ == '__main__':
73
+ acknowledgement()
@@ -0,0 +1,9 @@
1
+ # __main__.py = top-level code environment
2
+ # Usage: (1) __main__ in programs (2) __main__.py in packages
3
+ # More information: https://docs.python.org/3/library/__main__.html
4
+ # Here: To print the the acknowledgement when we run: python -m stemdiff
5
+ # (the acknowledgement function is defined in the sister __init__.py file
6
+
7
+ from stemdiff import acknowledgement
8
+
9
+ if __name__ == '__main__': acknowledgement()
@@ -8,7 +8,7 @@ Functions to calculate, save and re-read the database of 4D-STEM datafiles.
8
8
  filename, XY-center coordinates, MaximumIntensity, NoOfPeaks, ShannonEntropy.
9
9
  * The database enables fast filtering of datafiles
10
10
  and fast access to datafile features,
11
- which do not have to be re-calculated repeatedly.
11
+ which we do not want to re-calculate repeatedly.
12
12
  '''
13
13
 
14
14
  import numpy as np
@@ -337,14 +337,3 @@ class Secom:
337
337
  '''
338
338
  im = Image.fromarray(arr.astype(np.uint16))
339
339
  im.save(filename)
340
-
341
-
342
-
343
- class Arina:
344
-
345
- '''
346
- * TODO: Radim
347
- * The same like for Secom, using method copy+paste+modify :-)
348
- '''
349
-
350
- pass
@@ -41,6 +41,9 @@ class SourceData:
41
41
 
42
42
  Parameters
43
43
  ----------
44
+ detector : detector object from stemdiff.detectors module
45
+ The detector object specifies data format + how to read datafiles.
46
+ For available detectors in STEMDIFF, see stemdiff.detectors module.
44
47
  data_dir : str (which will be passed to Path method)
45
48
  This parameter is passed to Path method from pathlib library.
46
49
  It is strongly recommeded to use r-strings.
@@ -47,6 +47,7 @@ Examples how to use Datafiles, Arrays and Images
47
47
  import os, sys
48
48
  import numpy as np
49
49
  import matplotlib.pyplot as plt
50
+ from mpl_toolkits import axes_grid1 # to add nice colorbars
50
51
  from PIL import Image
51
52
  from skimage import transform, measure, morphology
52
53
 
@@ -416,7 +417,23 @@ class Arrays:
416
417
  which means that the function shows a *non-cenered central region*.
417
418
  * If you need to show *centered central region* of an array,
418
419
  combine Arrays.find_center + Arrays.remove_edges + Arrays.show
419
- '''
420
+ '''
421
+
422
+ # Function that adds colorbar not exceeding plot height
423
+ # * this is surprisingly tricky => solution found in StackOverflow
424
+ # https://stackoverflow.com/q/18195758
425
+ # * the usage of the function is slightly non-standard
426
+ # see the link above + search for: I created an IPython notebook
427
+ def add_colorbar(im, aspect=20, pad_fraction=0.5, **kwargs):
428
+ '''Add a vertical color bar to an image plot.'''
429
+ divider = axes_grid1.make_axes_locatable(im.axes)
430
+ width = axes_grid1.axes_size.AxesY(im.axes, aspect=1./aspect)
431
+ pad = axes_grid1.axes_size.Fraction(pad_fraction, width)
432
+ current_ax = plt.gca()
433
+ cax = divider.append_axes("right", size=width, pad=pad)
434
+ plt.sca(current_ax)
435
+ return im.axes.figure.colorbar(im, cax=cax, **kwargs)
436
+
420
437
  # Prepare array for saving
421
438
  arr = Arrays.prepare_for_show_or_save(arr, icut, itype, R)
422
439
  # Remove edges of the plot, if requested
@@ -434,9 +451,15 @@ class Arrays:
434
451
  cmap='viridis'
435
452
  plt.imshow(arr, cmap=cmap)
436
453
  if colorbar: # Add colorbar
437
- plt.colorbar()
454
+ # We add colorbar by means of local functions defined above
455
+ # Reason: default colorbar usually exceeds plot height - ugly!
456
+ # (the usage of {add colorbar} func look strange, but it works
457
+ # (see the description in the (local) func definition above
458
+ im = plt.imshow(arr, cmap=cmap)
459
+ add_colorbar(im)
460
+ # plt.colorbar(shrink=cbar_shrink, aspect=20*cbar_shrink)
438
461
  if center==True: # Mark intensity center in the plot
439
- xc,yc = Arrays.find_center(arr,csquare, cintensity)
462
+ xc,yc = Arrays.find_center(arr, csquare, cintensity)
440
463
  plt.plot(yc,xc, 'r+', markersize=20) # switch xc,yc for img!
441
464
  # (b) Prepare 3D plot (option; if plt_type is not the default '2D')
442
465
  else:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: stemdiff
3
- Version: 5.2.6
3
+ Version: 5.2.10
4
4
  Summary: Convert 4D-STEM data to 2D-powder diffraction pattern.
5
5
  Home-page: https://github.com/mirekslouf/stemdiff/
6
6
  Author: Mirek Slouf
@@ -18,6 +18,17 @@ Requires-Dist: matplotlib
18
18
  Requires-Dist: scipy
19
19
  Requires-Dist: pandas
20
20
  Requires-Dist: scikit-image
21
+ Dynamic: author
22
+ Dynamic: author-email
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: license
28
+ Dynamic: project-url
29
+ Dynamic: requires-dist
30
+ Dynamic: requires-python
31
+ Dynamic: summary
21
32
 
22
33
  STEMDIFF :: 4D-STEM dataset to 2D-diffractogram
23
34
  -----------------------------------------------
@@ -31,7 +42,7 @@ STEMDIFF :: 4D-STEM dataset to 2D-diffractogram
31
42
  [https://doi.org/10.3390/nano11040962](https://doi.org/10.3390/nano11040962)
32
43
  2. *Materials* 14 (2021) 7550.
33
44
  [https://doi.org/10.3390/ma14247550](https://doi.org/10.3390/ma14247550)
34
- * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-).
45
+ * If you use STEMDIFF package, **please cite** the 2nd publication (or both :-)
35
46
 
36
47
  Principle
37
48
  ---------
@@ -40,7 +51,7 @@ Principle
40
51
 
41
52
  Installation
42
53
  ------------
43
- * Requirement: Python with sci-modules: numpy, matplotlib, scipy, pandas
54
+ * Requirement: Python with sci-modules = numpy, matplotlib, scipy, pandas
44
55
  * `pip install scikit-image` = 3rd party package for advanced image processing
45
56
  * `pip install tqdm` = to show progress meter during long summations
46
57
  * `pip install idiff` = to improve diffractograms (remove noise, background ...)
@@ -49,20 +60,23 @@ Installation
49
60
  Quick start
50
61
  -----------
51
62
 
52
- * See how it works:
53
- - Look at [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
54
- in Jupyter.
55
- * Try it yourself:
56
- - Download [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0).
57
- - After downloading, unzip and follow the instructions in *readme* file.
63
+ * Look at the
64
+ [worked example](https://www.dropbox.com/scl/fi/l5eskdgxo7976ea9x35fp/01_sdiff_au.nb.pdf?rlkey=7yd5tqtcm3zxr1uc0m0aisenl&dl=0)
65
+ to see STEMDIFF in action.
66
+ * Download
67
+ [complete examples with data](https://www.dropbox.com/scl/fo/ccb6hs28er9dc1xufshh4/h?rlkey=omk5bqoe17jmedhj407ng9xr0&dl=0)
68
+ and try STEMDIFF yourself.
58
69
 
59
70
  Documentation, help and examples
60
71
  --------------------------------
61
72
 
62
- * [PyPI](https://pypi.org/project/stemdiff) repository.
63
- * [GitHub](https://github.com/mirekslouf/stemdiff) repository.
73
+ * [PyPI](https://pypi.org/project/stemdiff) repository -
74
+ the stable version to install.
75
+ * [GitHub](https://github.com/mirekslouf/stemdiff) repository -
76
+ the current version under development.
64
77
  * [GitHub Pages](https://mirekslouf.github.io/stemdiff)
65
- with [documentation](https://mirekslouf.github.io/stemdiff/docs).
78
+ with [help](https://mirekslouf.github.io/stemdiff/docs)
79
+ and [complete package documentation](https://mirekslouf.github.io/stemdiff/docs/pdoc.html/stemdiff.html).
66
80
 
67
81
  ## Versions of STEMDIFF
68
82
 
@@ -89,3 +103,9 @@ Documentation, help and examples
89
103
  - more types of deconvolution (experimental; to be finished in v.6.0)
90
104
  * Version 5.1 = (beta) support for parallel processing
91
105
  * Version 5.2 = (beta) improvement of diff.patterns in sister package idiff
106
+
107
+ Acknowledgement
108
+ ---------------
109
+
110
+ The development was co-funded by TACR, program NCK,
111
+ project [TN02000020](https://www.isibrno.cz/en/centre-advanced-electron-and-photonic-optics).
@@ -4,7 +4,15 @@ MANIFEST.in
4
4
  README.md
5
5
  pyproject.toml
6
6
  setup.py
7
+ src/STEMDIFF/__init__.py
8
+ src/STEMDIFF/dbase.py
9
+ src/STEMDIFF/detectors.py
10
+ src/STEMDIFF/gvars.py
11
+ src/STEMDIFF/io.py
12
+ src/STEMDIFF/sum.py
13
+ src/STEMDIFF/summ.py
7
14
  src/stemdiff/__init__.py
15
+ src/stemdiff/__main__.py
8
16
  src/stemdiff/dbase.py
9
17
  src/stemdiff/detectors.py
10
18
  src/stemdiff/gvars.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes