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

healpix_plot & healpix_count expecting Gaia conventions #41

Open
mfouesneau opened this issue Sep 18, 2017 · 3 comments
Open

healpix_plot & healpix_count expecting Gaia conventions #41

mfouesneau opened this issue Sep 18, 2017 · 3 comments

Comments

@mfouesneau
Copy link
Contributor

The current API is based on Gaia defaults which are not obvious outside Gaia:
healpix_expression='source_id/34359738368', ... nest=True, ...

These are not the defaults in healpy. Healpy by defaults does nest=False for instance.

Maybe providing a virtual column that does the healpix calculations from RA, DEC columns similarly to the coordinate conversions?

maybe adapting properly something like:

def add_columns_healpix_data(ds, coords=('ra', 'dec'), 
                          name='source_id', nest=True,
                          lonlat=True, NSIDE=4096):
    """ Vaex defaults to Gaia conventions for healpix handling
    
    namely it defaults to having Healpix cell numbers as
    'source_id / 34359738368'
    
    It also uses nested pixels (not rings)
    """
    import healpy
    # add healpix numbers for plotting
    # using Gaia conventions
    ra, dec = coords
    _ra = ds.evaluate(ra)[:]
    _dec = ds.evaluate(dec)[:]
    hpix = healpy.ang2pix(NSIDE, _ra, _dec, 
                          nest=nest, lonlat=lonlat)
    # convention from gaia
    ds.add_column(name, (34359738368 * hpix).astype(int))
    return ds
@maartenbreddels
Copy link
Member

Hi Morgan,

the default healpix expression is different in master, since it was indeed really gaia specific. However, the default for nested or not i'm not sure about, I have a preference for it since it is easy to go to coarser level by simply dividing. (I don't think you can do that for ring right?).

There is a method for this already I hope that suits your needs. Thanks anyway!

cheers,

Maarten

@mfouesneau
Copy link
Contributor Author

mfouesneau commented Sep 25, 2017

Hi Maarten,
I found my way with the methods. I suggests to update the documentation and make the healpix_plot expression more standard or a necessary argument.

I also prefer the nested structure. But that's something I did not see obvious when I made some data.

Thanks

@maartenbreddels
Copy link
Member

I'm actually just playing with the healpix_plot, and indeed it is still set to the gaia values, which does not make sense, I need to change that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants