Skip to content

Commit

Permalink
Fix bug which was reintroduced by previous fix 🤦 (#74)
Browse files Browse the repository at this point in the history
* Fix a bug reintroduced in `~xrayvision.mem.mem` which caused the output to be transposed incorrectly.
  • Loading branch information
samaloney authored Jul 16, 2024
1 parent 36415a0 commit ea833d9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog/74.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug reintroduced in `~xrayvision.mem.mem` which caused the output to be transposed incorrectly.
1 change: 1 addition & 0 deletions changelog/74.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update RHESSI example to use the same image dimensions and pixel size throughout.
2 changes: 1 addition & 1 deletion examples/rhessi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ ignore-words-list =
afile,
precessed,
process,
technik
technik,
thirdparty,
lamba

[mypy]
disable_error_code = import-untyped
Expand Down
8 changes: 4 additions & 4 deletions xrayvision/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""

import logging
from typing import Union, Optional
from collections.abc import Iterable

Expand All @@ -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 :
Expand Down Expand Up @@ -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])
Expand Down
6 changes: 3 additions & 3 deletions xrayvision/mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -27,7 +28,6 @@
"mem",
]

from xrayvision.visibility import Visibilities

logger = get_logger(__name__, "DEBUG")

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion xrayvision/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ea833d9

Please sign in to comment.