@@ -139,7 +139,7 @@ def make_covariance_matrix(self):
139
139
140
140
self ._make_covariance_matrix_mp (self .threads )
141
141
142
- self .covariance_matrix = mirror_covariance_matrix (self .covariance_matrix , self . n_subaps )
142
+ self .covariance_matrix = mirror_covariance_matrix (self .covariance_matrix )
143
143
144
144
return self .covariance_matrix
145
145
@@ -184,7 +184,7 @@ def _make_covariance_matrix(self):
184
184
self .covariance_matrix [
185
185
cov_mat_coord_x1 : cov_mat_coord_x2 ,
186
186
cov_mat_coord_y1 + self .n_subaps [wfs_j ]: cov_mat_coord_y2 + self .n_subaps [wfs_j ]
187
- ] += cov_xy . T * r0_scale
187
+ ] += numpy . fliplr ( numpy . flipud ( cov_xy )) * r0_scale
188
188
self .covariance_matrix [
189
189
cov_mat_coord_x1 + self .n_subaps [wfs_i ]: cov_mat_coord_x2 + self .n_subaps [wfs_i ],
190
190
cov_mat_coord_y1 + self .n_subaps [wfs_j ]: cov_mat_coord_y2 + self .n_subaps [wfs_j ]
@@ -239,7 +239,7 @@ def _make_covariance_matrix_mp(self, threads):
239
239
self .covariance_matrix [
240
240
cov_mat_coord_x1 : cov_mat_coord_x2 ,
241
241
cov_mat_coord_y1 + self .n_subaps [wfs_j ]: cov_mat_coord_y2 + self .n_subaps [wfs_j ]
242
- ] += cov_xy . T * r0_scale
242
+ ] += numpy . fliplr ( numpy . flipud ( cov_xy )) * r0_scale
243
243
self .covariance_matrix [
244
244
cov_mat_coord_x1 + self .n_subaps [wfs_i ]: cov_mat_coord_x2 + self .n_subaps [wfs_i ],
245
245
cov_mat_coord_y1 + self .n_subaps [wfs_j ]: cov_mat_coord_y2 + self .n_subaps [wfs_j ]
@@ -462,38 +462,16 @@ def calculate_structure_function(phase, nbOfPoint=None, step=None):
462
462
return sf_x
463
463
464
464
465
- def mirror_covariance_matrix (cov_mat , n_subaps ):
465
+ def mirror_covariance_matrix (cov_mat ):
466
466
"""
467
467
Mirrors a covariance matrix around the axis of the diagonal.
468
468
469
469
Parameters:
470
470
cov_mat (ndarray): The covariance matrix to mirror
471
471
n_subaps (ndarray): Number of sub-aperture in each WFS
472
472
"""
473
- total_slopes = cov_mat .shape [0 ]
474
- n_wfs = n_subaps .shape [0 ]
475
-
476
- n1 = 0
477
- for n in range (n_wfs ):
478
- m1 = 0
479
- for m in range (n + 1 ):
480
- if n != m :
481
- n2 = n1 + 2 * n_subaps [n ]
482
- m2 = m1 + 2 * n_subaps [m ]
483
-
484
- nn1 = total_slopes - 2 * n_subaps [n ] - n1
485
- nn2 = nn1 + 2 * n_subaps [n ]
486
-
487
- mm1 = total_slopes - 2 * n_subaps [m ] - m1
488
- mm2 = mm1 + 2 * n_subaps [m ]
489
-
490
- cov_mat [nn1 : nn2 , mm1 : mm2 ] = (
491
- numpy .swapaxes (cov_mat [n1 : n2 , m1 : m2 ], 1 , 0 )
492
- )
493
-
494
- m1 += 2 * n_subaps [m ]
495
- n1 += 2 * n_subaps [n ]
496
- return cov_mat
473
+
474
+ return numpy .bitwise_or (cov_mat .view ("int32" ), cov_mat .T .view ("int32" )).view ("float32" )
497
475
498
476
def create_tomographic_covariance_reconstructor (covariance_matrix , n_onaxis_subaps , svd_conditioning = 0 ):
499
477
"""
0 commit comments