@@ -21,7 +21,7 @@ def __init__(self):
21
21
self .initUI ()
22
22
23
23
def initUI (self ):
24
- """Initialize the GUI for fourigui"""
24
+ """Initialize the GUI for fourigui. """
25
25
26
26
self .loaded = False # denotes whether a dataset is loaded
27
27
self .transformed = False # denotes whether dataset is Fourier transformed
@@ -254,11 +254,10 @@ def initUI(self):
254
254
frame11 .place (x = WIDTH // 2 , y = HEIGHT // 2 ) # , height=HEIGHT//2, width=WIDTH//2)
255
255
256
256
def load_cube (self ):
257
- """
258
- loads 3D array in h5py file format from the filename input panel
259
- 3D array is expected to be a reconstructed reciprocal scattering volume
260
- when executed, one slide perpendicular to the selected axis will be plotted in the plot panel
261
- """
257
+ """Loads 3D array in h5py file format from the filename input panel 3D
258
+ array is expected to be a reconstructed reciprocal scattering volume
259
+ when executed, one slide perpendicular to the selected axis will be
260
+ plotted in the plot panel."""
262
261
263
262
filename = self .filename_entry .get ()
264
263
f = h5py .File (filename , "r" )
@@ -327,7 +326,7 @@ def load_cube(self):
327
326
self .intensity_upd_global ()
328
327
329
328
def plot_plane (self ):
330
- """update plotted plane perpendicular to the selected axis"""
329
+ """Update plotted plane perpendicular to the selected axis. """
331
330
if self .axis .get () == 0 :
332
331
self .im .set_data (self .cube [self .plane_num .get (), :, :])
333
332
elif self .axis .get () == 1 :
@@ -339,7 +338,7 @@ def plot_plane(self):
339
338
self .canvas .draw ()
340
339
341
340
def colorrange_upd (self ):
342
- """change color range in plot"""
341
+ """Change color range in plot. """
343
342
try :
344
343
if self .colorbarmin .get () and self .colorbarmax .get ():
345
344
vmin = float (self .colorbarmin .get ())
@@ -359,7 +358,8 @@ def colorrange_upd(self):
359
358
self .plot_plane ()
360
359
361
360
def intensity_upd_local (self ):
362
- """show local intensity minimum, maximum and sum of current plotted plane"""
361
+ """Show local intensity minimum, maximum and sum of current plotted
362
+ plane."""
363
363
if self .axis .get () == 0 :
364
364
plane = self .cube [self .plane_num .get (), :, :]
365
365
elif self .axis .get () == 1 :
@@ -373,7 +373,7 @@ def intensity_upd_local(self):
373
373
self .localnanratio ["text" ] = f"{ round (nan_ratio , 2 )} "
374
374
375
375
def intensity_upd_global (self ):
376
- """Load global intensity minimum, maximum and sum of 3D array"""
376
+ """Load global intensity minimum, maximum and sum of 3D array. """
377
377
self .intensity_upd_local ()
378
378
nan_ratio = np .count_nonzero (np .isnan (self .cube )) / self .cube .size
379
379
self .globalmax ["text" ] = f"{ np .format_float_scientific (np .nanmax (self .cube ), 1 )} "
@@ -382,10 +382,8 @@ def intensity_upd_global(self):
382
382
self .globalnanratio ["text" ] = "{}" .format (round (nan_ratio , 2 ))
383
383
384
384
def fft (self ):
385
- """
386
- Fourier transform 3D array from reciprocal to real space
387
- the origin of reciprocal and real space is expected to be the central voxel
388
- """
385
+ """Fourier transform 3D array from reciprocal to real space the origin
386
+ of reciprocal and real space is expected to be the central voxel."""
389
387
390
388
def perform_fft (fftholder ):
391
389
fftholder = np .nan_to_num (fftholder )
@@ -438,10 +436,9 @@ def perform_fft(fftholder):
438
436
self .intensity_upd_global ()
439
437
440
438
def ifft (self ):
441
- """
442
- Inverse Fourier transform 3D array from real to reciprocal space
443
- the origin of real and reciprocal space is expected to be the central voxel
444
- """
439
+ """Inverse Fourier transform 3D array from real to reciprocal space the
440
+ origin of real and reciprocal space is expected to be the central
441
+ voxel."""
445
442
if not self .cutoff .get ():
446
443
self .cube_real = self .cube
447
444
self .cube = self .cube_reci
@@ -455,8 +452,7 @@ def ifft(self):
455
452
self .intensity_upd_global ()
456
453
457
454
def applycutoff (self ):
458
- """
459
- shape the reciprocal-space array
455
+ """Shape the reciprocal-space array.
460
456
461
457
reassign all voxels with distance smaller than qmin and greater than qmax
462
458
to np.nan.
@@ -507,9 +503,8 @@ def applycutoff(self):
507
503
self .intensity_upd_global ()
508
504
509
505
def redocutuff (self ):
510
- """
511
- Redo the cutoff operation depending on the current space (real or reciprocal).
512
- """
506
+ """Redo the cutoff operation depending on the current space (real or
507
+ reciprocal)."""
513
508
if self .space .get (): # in real space
514
509
self .cube_realcut = self .cube
515
510
if not self .transformed :
@@ -522,9 +517,8 @@ def redocutuff(self):
522
517
self .intensity_upd_global ()
523
518
524
519
def newcutoff (self ):
525
- """
526
- Apply a new cutoff based on the current space and cutoff settings.
527
- """
520
+ """Apply a new cutoff based on the current space and cutoff
521
+ settings."""
528
522
if self .cutoff .get ():
529
523
if self .space .get () and self .transformed :
530
524
self .cube = self .cube_real
@@ -535,9 +529,8 @@ def newcutoff(self):
535
529
self .applycutoff ()
536
530
537
531
def plot_next_plane (self ):
538
- """
539
- Plot the next plane in the dataset, looping back to the first if at the end.
540
- """
532
+ """Plot the next plane in the dataset, looping back to the first if at
533
+ the end."""
541
534
n = self .plane_num .get ()
542
535
if n == len (self .cube [self .axis .get ()]) - 1 :
543
536
n = 0
@@ -547,9 +540,7 @@ def plot_next_plane(self):
547
540
self .plot_plane ()
548
541
549
542
def animation (self ):
550
- """
551
- slices through the 3D array along the selected axis
552
- """
543
+ """Slices through the 3D array along the selected axis."""
553
544
try :
554
545
if not self .anientry .get ():
555
546
anispeed = 1
@@ -563,9 +554,7 @@ def animation(self):
563
554
self .plot_next_plane ()
564
555
565
556
def multiple_funcs (* funcs ):
566
- """
567
- Executes multiple functions passed as arguments in sequence.
568
- """
557
+ """Executes multiple functions passed as arguments in sequence."""
569
558
for func in funcs :
570
559
func
571
560
0 commit comments