Open monodera opened 2 months ago
Thanks for reporting. I think nside
is treated correctly, but we don't get the see the expected result. Here's why I think this happens:
map.density
only plots the non-empty cells:
https://github.com/pmelchior/skymapper/blob/9c124f9f00a9251a93a4cee597c55be90dd8476c/skymapper/map.py#L1290 The reason is to avoid plotting densities in the area a survey has not covered, but there will be many more empty cells at high nside
. The average galaxy density in your example is pretty small still.map.density
and map.healpix
don't plot healpix polygons as matplotlib artists, instead these functions now render the polygons into an pixelized image of the map. Several reasons for the change, suffice it to say that healpy
uses the same approach. This is why, after zooming in, the shape of the cells appear rectangular and not like healpix cells.I suspect the typical cell at nside=1024
is smaller than 1 pixel at the resolution of the screen (or matplotlib backend). If many cells are empty and thus not plotted, it's therefore likely that most of the map appears empty. I confirmed this with nside=128
, which starts to get half-empty:
This is not a bug, it's just too low a density for nside=1024
to be meaningful. The only way to make this behavior more clear is by not using a mask, in which case all cells with zero density will be shown:
I'm not a fan of it, but it makes the problem more transparent, and some people may prefer this option. So, I'm pushing a fix that will allow this with the option map.density(..., mask_empty=False)
.
Thanks for the prompt reply. I think that my example was not good to highlight the issue. Here is an example file with about 140k objects in a relatively small sky area (several sq. degrees), so empty cells are quite rare within a survey area.
This is a map for nside=128
:
The following is that for nside=1024
:
with data points:
With this dataset, I still think that the pixels are not correctly shown. I'm not sure if the planned change in the 0.4+ version will be the fix for this.
For comparison, the following map is generated by TOPCAT for nside=1024
and the pixel size is about 3 arcmin as expected.
Yeah, but you see the effect of item 2: the map is pixelized. So, what you see are not the healpix cells but the resolution limit of your backend before you zoom in. Can you run map.focus(ra, dec)
before calling map.density
. This should use the full resolution of the backend for the narrower area instead of the entire sky.
Thanks for clarification. I understood what you mean.
When I called map.focus(ra, dec)
before creating the density map, the memory consumption became insanely high (>30GB) even with nside=32
and for some reason, matplotlib appeared to get stuck at map.desity()
.
OK, that needs to get fixed! Let me see what's going on.
The density map generated with skymapper does not seem to follow the resolution set by the
nside
parameter withhealpy
.I run the following code with
nside=32
(resolution of 110 arcmin) andnside=1024
(resolution of 3.4 arcmin), the resolution (or pixel size) of the output density map.I'd expect that the pixel size is that defined by
nside
in Healpix (hp.nside2resol()
), but it seems not.My python environment is the following: