Skip to content

enplot(map[i]) and enplot(np.array(map)[i]) show mirrored images #307

@kwolz

Description

@kwolz

Discovered this when plotting TQU maps and saving them to file using enplot.write. The array itself remains unaffected, only the plot flips its x-parity.

from pixell import enmap, enplot, curvedsky, utils
import numpy as np
import healpy as hp


ls = np.arange(500)
ps = np.array([1.] + [1./l**2 for l in ls[1:]]) 
ps_tuple = (0*ps, 0*ps, 0*ps, ps)
alm = hp.synalm(ps_tuple)

box = np.array([[-5, 10], [5, -10]]) * utils.degree
shape, wcs = enmap.geometry(pos=box, res=0.5 * utils.arcmin, proj='car')

map = enmap.zeros((3,) + shape, wcs)
map = curvedsky.alm2map(alm, map)

for ip, p in enumerate("TQU"):
    enplot.write(f"test_map_{p}", enplot.plot(map[ip], colorbar=True))
    enplot.write(f"test_map_arr_{p}", enplot.plot(np.array(map)[ip], colorbar=True))

Resulting plots:

test_map_Q.png:
Image
test_map_arr_Q.png:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions