stemdiff 5.2.7__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.7
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
  -----------------------------------------------
@@ -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,7 @@ 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.7"
33
+ __version__ = "5.2.10"
34
34
 
35
35
 
36
36
  # Import modules of stemdiff package
@@ -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.7
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
  -----------------------------------------------
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes