|
27 | 27 | """ |
28 | 28 |
|
29 | 29 | import numpy as np |
30 | | -from scipy.sparse import csr_matrix |
31 | 30 |
|
32 | 31 | from autoarray import exc |
33 | 32 | from autoarray import numba_util |
@@ -297,9 +296,11 @@ def derivative_1st_operators_from(mask, pixel_scale: float = 1.0): |
297 | 296 | ------- |
298 | 297 | The (Hy, Hx) operators as ``scipy.sparse.csr_matrix``. |
299 | 298 | """ |
| 299 | + from scipy.sparse import csr_matrix |
| 300 | + |
300 | 301 | mask, diff_types = _diff_types_of_cleaned_mask_from(mask) |
301 | | - rows_hx, cols_hx, data_hx, rows_hy, cols_hy, data_hy = ( |
302 | | - derivative_1st_triplets_from(mask, diff_types, dpix=pixel_scale) |
| 302 | + rows_hx, cols_hx, data_hx, rows_hy, cols_hy, data_hy = derivative_1st_triplets_from( |
| 303 | + mask, diff_types, dpix=pixel_scale |
303 | 304 | ) |
304 | 305 |
|
305 | 306 | n_unmasked = np.count_nonzero(~mask) |
@@ -443,6 +444,8 @@ def derivative_2nd_operators_from(mask, pixel_scale: float = 1.0): |
443 | 444 | ------- |
444 | 445 | The (Hyy, Hxx) operators as ``scipy.sparse.csr_matrix``. |
445 | 446 | """ |
| 447 | + from scipy.sparse import csr_matrix |
| 448 | + |
446 | 449 | mask, diff_types = _diff_types_of_cleaned_mask_from(mask) |
447 | 450 | rows_hxx, cols_hxx, data_hxx, rows_hyy, cols_hyy, data_hyy = ( |
448 | 451 | derivative_2nd_triplets_from(mask, diff_types, dpix=pixel_scale) |
@@ -574,6 +577,8 @@ def forward_difference_operators_from( |
574 | 577 | ------- |
575 | 578 | The (Hy, Hx) operators as ``scipy.sparse.csr_matrix``. |
576 | 579 | """ |
| 580 | + from scipy.sparse import csr_matrix |
| 581 | + |
577 | 582 | if max_order not in (1, 2, 3, 4): |
578 | 583 | raise ValueError(f"max_order must be in 1..4, got {max_order}") |
579 | 584 |
|
|
0 commit comments