diff --git a/changelog/74.bugfix.rst b/changelog/74.bugfix.rst new file mode 100644 index 0000000..4facd44 --- /dev/null +++ b/changelog/74.bugfix.rst @@ -0,0 +1 @@ +Fix a bug reintroduced in `~xrayvision.mem.mem` which caused the output to be transposed incorrectly. diff --git a/changelog/74.doc.rst b/changelog/74.doc.rst new file mode 100644 index 0000000..9564886 --- /dev/null +++ b/changelog/74.doc.rst @@ -0,0 +1 @@ +Update RHESSI example to use the same image dimensions and pixel size throughout. diff --git a/examples/rhessi.py b/examples/rhessi.py index 031dbc3..4f4868c 100644 --- a/examples/rhessi.py +++ b/examples/rhessi.py @@ -113,7 +113,7 @@ percent_lambda = 11.0 / (snr_value**2 + 383.0) -mem_map = mem(vis, shape=[129, 129] * apu.pixel, pixel_size=[2, 2] * apu.arcsec / apu.pix) +mem_map = mem(vis, shape=[101, 101] * apu.pixel, pixel_size=[1.5, 1.5] * apu.arcsec / apu.pix) mem_map.plot() diff --git a/setup.cfg b/setup.cfg index 90fd67f..18a8bee 100644 --- a/setup.cfg +++ b/setup.cfg @@ -95,7 +95,9 @@ ignore-words-list = afile, precessed, process, - technik + technik, + thirdparty, + lamba [mypy] disable_error_code = import-untyped diff --git a/xrayvision/clean.py b/xrayvision/clean.py index e6f8f9b..08ff541 100644 --- a/xrayvision/clean.py +++ b/xrayvision/clean.py @@ -7,7 +7,6 @@ """ -import logging from typing import Union, Optional from collections.abc import Iterable @@ -21,13 +20,14 @@ from sunpy.map.map_factory import Map from xrayvision.imaging import vis_psf_image, vis_to_map +from xrayvision.utils import get_logger from xrayvision.visibility import Visibilities __all__ = ["clean", "vis_clean", "ms_clean", "vis_ms_clean"] -logger = logging.getLogger(__name__) -logger.setLevel("DEBUG") +logger = get_logger(__name__, "DEBUG") + __common_clean_doc__ = r""" clean_beam_width : @@ -121,7 +121,7 @@ def clean( model[mx, my] += gain * imax if i % 25 == 0: - logger.debug(f"Iter: {i}, strength: {imax}, location: {mx, my}") + logger.info(f"Iter: {i}, strength: {imax}, location: {mx, my}") offset = map_center[0] - mx, map_center[1] - my shifted_beam_center = int(beam_center[0] + offset[0]), int(beam_center[1] + offset[1]) diff --git a/xrayvision/mem.py b/xrayvision/mem.py index 0804213..bce4e95 100644 --- a/xrayvision/mem.py +++ b/xrayvision/mem.py @@ -15,6 +15,7 @@ from xrayvision.imaging import generate_header from xrayvision.transform import generate_xy from xrayvision.utils import get_logger +from xrayvision.visibility import Visibilities __all__ = [ "_get_entropy", @@ -27,7 +28,6 @@ "mem", ] -from xrayvision.visibility import Visibilities logger = get_logger(__name__, "DEBUG") @@ -625,8 +625,8 @@ def mem( im = _optimise_fb(Hv, Visib, Lip, total_flux, lambd, shape, pixel_size, maxiter, tol) - # This is needed to match IDL output - # im = np.rot90(im, -1) + # This is needed to match IDL output - prob array vs cartesian indexing + im = im.T if map: header = generate_header(vis, shape=shape, pixel_size=pixel_size) diff --git a/xrayvision/visibility.py b/xrayvision/visibility.py index 4cd4ce8..9e650dc 100644 --- a/xrayvision/visibility.py +++ b/xrayvision/visibility.py @@ -16,10 +16,10 @@ import xarray from astropy.coordinates import SkyCoord from astropy.time import Time +from astropy.units import Quantity __all__ = ["Visibility", "Visibilities", "VisMeta", "VisibilitiesABC", "VisMetaABC"] -from astropy.units import Quantity _E_RANGE_KEY = "spectral_range" _T_RANGE_KEY = "time_range"