@@ -40,7 +40,7 @@ def get_sim_pattern(dmd_size: Sequence[int, int],
40
40
vec_b : array ,
41
41
nphases : int ,
42
42
phase_index : int ,
43
- geometry : str = "orthogonal" ) -> ( array , array ) :
43
+ geometry : str = "orthogonal" ) -> tuple [ array , array ] :
44
44
"""
45
45
Convenience function for generating SIM patterns from the tile_patterns() function.
46
46
This function can run either on the CPU or the GPU. If vec_a is a NumPy array, it will
@@ -233,7 +233,7 @@ def double_cell(cell: array,
233
233
vec_a : array ,
234
234
vec_b : array ,
235
235
na : int = 1 ,
236
- nb : int = 0 ) -> ( np .ndarray , np .ndarray , np .ndarray ) :
236
+ nb : int = 0 ) -> tuple [ np .ndarray , np .ndarray , np .ndarray ] :
237
237
"""
238
238
Create new unit cell by doubling the original one by a factor of na along vec_a and nb along vec_b
239
239
@@ -290,7 +290,7 @@ def double_cell(cell: array,
290
290
def get_sim_unit_cell (vec_a : array ,
291
291
vec_b : array ,
292
292
nphases : int ,
293
- phase_index : int = 0 ) -> ( array , array , array ) :
293
+ phase_index : int = 0 ) -> tuple [ array , array , array ] :
294
294
"""
295
295
Get unit cell, which can be repeated to form SIM pattern.
296
296
@@ -339,7 +339,7 @@ def get_sim_unit_cell(vec_a: array,
339
339
340
340
341
341
def get_unit_cell (vec_a : array ,
342
- vec_b : array ) -> ( array , array , array ) :
342
+ vec_b : array ) -> tuple [ array , array , array ] :
343
343
"""
344
344
Generate a mask which represents one unit cell of a pattern for given vectors.
345
345
This mask is a square array with NaNs at positions outside the unit cell, and
@@ -470,7 +470,7 @@ def line(x, p1, p2): return ((p2[1] - p1[1]) * x + p1[1] * p2[0] - p1[0] * p2[1]
470
470
471
471
def reduce2cell (point : array ,
472
472
va : array ,
473
- vb : array ) -> ( array , array , array ) :
473
+ vb : array ) -> tuple [ array , array , array ] :
474
474
"""
475
475
Given a vector, reduce it to coordinates within the unit cell.
476
476
@@ -507,7 +507,7 @@ def convert_cell(cell1: array,
507
507
va1 : array ,
508
508
vb1 : array ,
509
509
va2 : array ,
510
- vb2 : array ) -> ( array , array , array ) :
510
+ vb2 : array ) -> tuple [ array , array , array ] :
511
511
"""
512
512
Given a unit cell described by vectors va1 and vb2, convert to equivalent description
513
513
in terms of va2, vb2
@@ -550,7 +550,7 @@ def get_minimal_cell(cell: array,
550
550
x : array ,
551
551
y : array ,
552
552
va : array ,
553
- vb : array ) -> ( array , array , array , array ) :
553
+ vb : array ) -> tuple [ array , array , array , array , array ] :
554
554
"""
555
555
Convert to cell using the smallest lattice vectors
556
556
@@ -636,7 +636,7 @@ def show_cell(v1: np.ndarray,
636
636
637
637
# determine parameters of SIM patterns
638
638
def get_reciprocal_vects (vec_a : array ,
639
- vec_b : array ) -> ( array , array ) :
639
+ vec_b : array ) -> tuple [ array , array ] :
640
640
"""
641
641
Compute the reciprocal vectors for (real-space) lattice vectors vec_a and vec_b.
642
642
If we call the lattice vectors a_i and the reciprocal vectors b_j, then these should be defined such that
@@ -711,7 +711,7 @@ def get_sim_period(vec_a: array,
711
711
712
712
713
713
def get_sim_frqs (vec_a : array ,
714
- vec_b : array ) -> ( float , float ) :
714
+ vec_b : array ) -> tuple [ float , float ] :
715
715
"""
716
716
Get spatial frequency of SIM pattern constructed from periodicity vectors.
717
717
@@ -772,7 +772,7 @@ def get_sim_phase(vec_a: array,
772
772
773
773
774
774
def ldftfreq (vec_a : np .ndarray ,
775
- vec_b : np .ndarray ) -> ( array , array , array ) :
775
+ vec_b : np .ndarray ) -> tuple [ array , array , array ] :
776
776
"""
777
777
Get the Fourier frequencies for the lattice fourier transform (LDFT). See ldft2() for more details.
778
778
This function is an analog of fftfreq().
@@ -862,7 +862,7 @@ def get_pattern_fourier_component(unit_cell: array,
862
862
nphases : int = 3 ,
863
863
phase_index : int = 0 ,
864
864
use_fft_origin : bool = True ,
865
- dmd_size : Optional [Sequence [int ]] = None ) -> ( np .ndarray , np .ndarray ) :
865
+ dmd_size : Optional [Sequence [int ]] = None ) -> tuple [ np .ndarray , np .ndarray ] :
866
866
"""
867
867
Get fourier component at f = n * recp_vec_a + m * recp_vec_b.
868
868
@@ -1038,7 +1038,7 @@ def get_intensity_fourier_components(unit_cell: np.ndarray,
1038
1038
use_fft_origin : bool = True ,
1039
1039
include_blaze_correction : bool = True ,
1040
1040
dmd_params : Optional [dict ] = None ) -> \
1041
- ( np .ndarray , np .ndarray , np .ndarray , np .ndarray , np .ndarray ) :
1041
+ tuple [ np .ndarray , np .ndarray , np .ndarray , np .ndarray , np .ndarray ] :
1042
1042
"""
1043
1043
Utility function for computing many electric field and intensity components of the Fourier pattern, including the
1044
1044
effect of the Blaze angle and system numerical aperture
@@ -1501,7 +1501,7 @@ def show_fourier_components(vec_a: np.ndarray,
1501
1501
1502
1502
# Lagrange-Gauss basis reduction
1503
1503
def reduce_basis (va : array ,
1504
- vb : array ) -> ( array , array ) :
1504
+ vb : array ) -> tuple [ array , array ] :
1505
1505
"""
1506
1506
Find the "smallest" set of basis vectors using Lagrange-Gauss basis reduction.
1507
1507
@@ -1544,7 +1544,7 @@ def reduce_basis(va: array,
1544
1544
1545
1545
1546
1546
def reduce_recp_basis (va : array ,
1547
- vb : array ) -> ( array , array ) :
1547
+ vb : array ) -> tuple [ array , array ] :
1548
1548
"""
1549
1549
Compute the shortest pair of reciprocal basis vectors. These vectors may not be dual to the lattice vectors
1550
1550
in the sense that vi * rsj = delta_{ij}, but they do form a basis for the reciprocal lattice vectors.
@@ -1559,7 +1559,7 @@ def reduce_recp_basis(va: array,
1559
1559
1560
1560
def get_closest_lattice_vec (point : np .ndarray ,
1561
1561
va : np .ndarray ,
1562
- vb : np .ndarray ) -> ( np .ndarray , int , int ) :
1562
+ vb : np .ndarray ) -> tuple [ np .ndarray , int , int ] :
1563
1563
"""
1564
1564
Find the closest lattice vector to point
1565
1565
@@ -1610,7 +1610,7 @@ def get_closest_lattice_vec(point: np.ndarray,
1610
1610
1611
1611
def get_closest_recip_vec (recp_point : np .ndarray ,
1612
1612
va : np .ndarray ,
1613
- vb : np .ndarray ) -> ( np .ndarray , int , int ) :
1613
+ vb : np .ndarray ) -> tuple [ np .ndarray , int , int ] :
1614
1614
"""
1615
1615
Find the closest reciprocal lattive vector, f = na * rva + nb * rvb, to a given point in reciprocal space,
1616
1616
recp_point.
@@ -1819,7 +1819,7 @@ def find_closest_multicolor_set(period: float,
1819
1819
angle_sep_tol : float = 5 * np .pi / 180 ,
1820
1820
max_solutions_to_search : int = 20 ,
1821
1821
pitch : float = 7560. ,
1822
- minimize_leakage : bool = True ) -> ( np .ndarray , np .ndarray ) :
1822
+ minimize_leakage : bool = True ) -> tuple [ np .ndarray , np .ndarray ] :
1823
1823
"""
1824
1824
Generate set of SIM patterns for multiple colors with period close to specified value and maximizing distance
1825
1825
between angles. The patterns are determined such that the diffracted orders will pass through the same positions
@@ -2173,7 +2173,7 @@ def find_rational_approx_angle(angle: float,
2173
2173
2174
2174
def find_allowed_periods (angle : float ,
2175
2175
nphases : int ,
2176
- nmax : int ) -> ( list [ float ], list [ int ], list ) :
2176
+ nmax : int ) -> tuple [ array , array , array ] :
2177
2177
"""
2178
2178
Given a DMD pattern with fixed angle, get allowed pattern periods which allow perfect phase shifting for nphases
2179
2179
@@ -2295,7 +2295,7 @@ def vects2pattern_data(dmd_size: Sequence[int, int],
2295
2295
invert : bool = False ,
2296
2296
pitch : float = 7560 ,
2297
2297
generate_patterns : bool = True ,
2298
- geometry : str = "orthogonal" ) -> ( np .ndarray , dict ) :
2298
+ geometry : str = "orthogonal" ) -> tuple [ np .ndarray , dict ] :
2299
2299
"""
2300
2300
Generate pattern and useful data (angles, phases, frequencies, reciprocal vectors, ...) from the lattice
2301
2301
vectors for a given pattern set.
@@ -2504,7 +2504,7 @@ def export_pattern_set(dmd_size: Sequence[int, int],
2504
2504
wavelength : float = 1. ,
2505
2505
save_dir : Union [str , Path ] = 'sim_patterns' ,
2506
2506
plot_results : bool = False ,
2507
- geometry : str = "orthogonal" ) -> ( np .ndarray , dict , Figure ) :
2507
+ geometry : str = "orthogonal" ) -> tuple [ np .ndarray , dict , Figure ] :
2508
2508
"""
2509
2509
Export a single set of SIM patterns, i.e. single wavelength, single period
2510
2510
@@ -2854,7 +2854,7 @@ def export_otf_test_set(dmd_size: Sequence[int],
2854
2854
bvec_max_size : int = 40 ,
2855
2855
phase_index : int = 0 ,
2856
2856
save_dir : Optional [Union [str , Path ]] = None ,
2857
- verbose : bool = True ) -> ( np .ndarray , dict ) :
2857
+ verbose : bool = True ) -> tuple [ np .ndarray , dict ] :
2858
2858
"""
2859
2859
Generate many SIM-like patterns at a variety of different periods and angles
2860
2860
0 commit comments