Skip to content
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

Enable user to set total flux for MEM. #78

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/78.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable users to manually set total flux/counts required by `~xrayvision.mem.mem`.
8 changes: 7 additions & 1 deletion xrayvision/mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def mem(
maxiter: int = 1000,
tol: float = 1e-3,
map: bool = True,
total_flux: Optional[Quantity] = None,
) -> Union[Quantity, NDArray[np.float64]]:
r"""
Maximum Entropy Method visibility based image reconstruction
Expand All @@ -605,11 +606,16 @@ def mem(
tolerance value used in the stopping rule ( || x - x_old || <= tol || x_old ||)
map :
Return a sunpy map or bare array
total_flux : `astropy.units.Quantity` (optional)
The total flux/counts contained in the image.
If not set, total_flux is estimated using `_estimate_flux`.

Returns
-------

"""
total_flux = _estimate_flux(vis, shape, pixel_size)
if total_flux is None:
total_flux = _estimate_flux(vis, shape, pixel_size)

mean_vis = _get_mean_visibilities(vis, shape, pixel_size)
Hv, Lip, Visib = _prepare_for_optimise(pixel_size, shape, mean_vis)
Expand Down
Loading