-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/unconvolved images #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f4ca516
6bfaa6e
10f0a47
b495620
73aa606
dedbd78
b4a957b
2788bcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,19 @@ def __init__( | |
| def psf(self): | ||
| return self.dataset.psf | ||
|
|
||
| @property | ||
| def mapping_matrix_list(self) -> List[np.ndarray]: | ||
| """ | ||
| The `mapping_matrix` of a linear object describes the mappings between the observed data's values and | ||
| the linear object's model, before an operation like a convolution is applied. | ||
|
|
||
| This is used to construct the simultaneous linear equations which reconstruct the data. | ||
|
|
||
| This property returns a list containing each linear object's unoperated (unconvolved) `mapping_matrix` | ||
| as defined on the corresponding `LinearObj` instance. | ||
| """ | ||
| return [linear_obj.mapping_matrix for linear_obj in self.linear_obj_list] | ||
|
|
||
| @property | ||
| def operated_mapping_matrix_list(self) -> List[np.ndarray]: | ||
| """ | ||
|
|
@@ -115,6 +128,30 @@ def _updated_cls_key_dict_from(self, cls: Type, preload_dict: Dict) -> Dict: | |
|
|
||
| return cls_dict | ||
|
|
||
| @property | ||
| def linear_func_mapping_matrix_dict(self) -> Dict: | ||
| """ | ||
| The `operated_mapping_matrix` of a linear object describes the mappings between the observed data's values and | ||
| the linear objects model, including a 2D convolution operation. It is described fully in the method | ||
| `operated_mapping_matrix`. | ||
|
|
||
| This property returns a dictionary mapping every linear func object to its corresponded operated mapping | ||
| matrix, which is used for constructing the matrices that perform the linear inversion in an efficent way | ||
| for the psf precision operator calculation. | ||
|
|
||
| Returns | ||
| ------- | ||
| A dictionary mapping every linear function object to its operated mapping matrix. | ||
| """ | ||
|
Comment on lines
+134
to
+145
|
||
|
|
||
| linear_func_mapping_matrix_dict = {} | ||
|
|
||
| for linear_func in self.cls_list_from(cls=AbstractLinearObjFuncList): | ||
|
|
||
| linear_func_mapping_matrix_dict[linear_func] = linear_func.mapping_matrix | ||
|
|
||
| return linear_func_mapping_matrix_dict | ||
|
|
||
| @property | ||
| def linear_func_operated_mapping_matrix_dict(self) -> Dict: | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -101,8 +101,44 @@ def curvature_matrix(self): | |||||||||||||||||
| xp=self._xp, | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| def _mapped_reconstructed_data_dict_from( | ||||||||||||||||||
| self, | ||||||||||||||||||
| mapping_matrix_list, | ||||||||||||||||||
| ) -> Dict["LinearObj", "Array2D"]: | ||||||||||||||||||
| """ | ||||||||||||||||||
| Shared implementation for mapping a reconstruction to image-plane arrays | ||||||||||||||||||
| using a provided list of mapping matrices (operated or unoperated). | ||||||||||||||||||
| """ | ||||||||||||||||||
| mapped_reconstructed_data_dict = {} | ||||||||||||||||||
|
|
||||||||||||||||||
| reconstruction_dict = self.source_quantity_dict_from( | ||||||||||||||||||
| source_quantity=self.reconstruction | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| for index, linear_obj in enumerate(self.linear_obj_list): | ||||||||||||||||||
| reconstruction = reconstruction_dict[linear_obj] | ||||||||||||||||||
|
|
||||||||||||||||||
| mapped_reconstructed_operated_data = ( | ||||||||||||||||||
| inversion_util.mapped_reconstructed_data_via_mapping_matrix_from( | ||||||||||||||||||
| mapping_matrix=mapping_matrix_list[index], | ||||||||||||||||||
| reconstruction=reconstruction, | ||||||||||||||||||
| xp=self._xp, | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| mapped_reconstructed_operated_data = Array2D( | ||||||||||||||||||
| values=mapped_reconstructed_operated_data, | ||||||||||||||||||
| mask=self.mask, | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| mapped_reconstructed_data_dict[linear_obj] = ( | ||||||||||||||||||
| mapped_reconstructed_operated_data | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| return mapped_reconstructed_data_dict | ||||||||||||||||||
|
|
||||||||||||||||||
| @property | ||||||||||||||||||
| def mapped_reconstructed_data_dict(self) -> Dict[LinearObj, Array2D]: | ||||||||||||||||||
| def mapped_reconstructed_data_dict(self) -> Dict["LinearObj", "Array2D"]: | ||||||||||||||||||
| """ | ||||||||||||||||||
| When constructing the simultaneous linear equations (via vectors and matrices) the quantities of each individual | ||||||||||||||||||
| linear object (e.g. their `mapping_matrix`) are combined into single ndarrays via stacking. This does not track | ||||||||||||||||||
|
|
@@ -116,6 +152,9 @@ def mapped_reconstructed_data_dict(self) -> Dict[LinearObj, Array2D]: | |||||||||||||||||
| This function converts an ndarray of a `reconstruction` to a dictionary of ndarrays containing each linear | ||||||||||||||||||
| object's reconstructed data values, where the keys are the instances of each mapper in the inversion. | ||||||||||||||||||
|
|
||||||||||||||||||
| The images are the unconvolved reconstructed data values, meaning they are the solved for reconstruction | ||||||||||||||||||
| with PSF operations removed. | ||||||||||||||||||
|
|
||||||||||||||||||
| To perform this mapping the `mapping_matrix` is used, which straightforwardly describes how every value of | ||||||||||||||||||
| the `reconstruction` maps to pixels in the data-frame after the 2D convolution operation has been performed. | ||||||||||||||||||
|
Comment on lines
+156
to
159
|
||||||||||||||||||
| with PSF operations removed. | |
| To perform this mapping the `mapping_matrix` is used, which straightforwardly describes how every value of | |
| the `reconstruction` maps to pixels in the data-frame after the 2D convolution operation has been performed. | |
| with PSF operations removed (that is, before any PSF / 2D convolution is applied). | |
| To perform this mapping the (unoperated) `mapping_matrix` is used, which straightforwardly describes how every | |
| value of the `reconstruction` maps to pixels in the data-frame prior to the 2D convolution operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
mapped_reconstructed_operated_datadocstring is currently identical tomapped_reconstructed_dataand does not explain what operation(s) are included (e.g. PSF convolution for imaging, NUFFT for interferometer). Please update it to clearly define “operated” so users know this is the data-frame model used for fitting.