Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Thomas Robitaille
    @astrofrog
    if we can't figure out, I think we should email astropy-dev
    maybe marten can help
    Adam Ginsburg
    @keflavich
    k
    Thomas Robitaille
    @astrofrog
    can you make a minimal example?
    Adam Ginsburg
    @keflavich
    I think I'm very close to an answer, but... there is some funny business...
    Thomas Robitaille
    @astrofrog
    ok
    Adam Ginsburg
    @keflavich
    not sure. I think if I can make a MWE, I will have solved the problem
    Thomas Robitaille
    @astrofrog
    ok
    Adam Ginsburg
    @keflavich
    I think I see the problem.... if you do something like Projection * Quantity, the Quantity's __array_wrap__ will be called instead of the Projection's
    Adam Ginsburg
    @keflavich
    numpy docs strongly indicate that it's the right thing to use: http://docs.scipy.org/doc/numpy-1.10.0/reference/arrays.classes.html#numpy.class.__array_wrap__
    the question is now just how to make Projection * Quantity use Projection's __array_wrap__
    Thomas Robitaille
    @astrofrog
    I think there's a priority flag
    for array subclasses
    Adam Ginsburg
    @keflavich
    oh!
    Thomas Robitaille
    @astrofrog
    maybe you need to set __array_priority__ for Projection higher than Quantity
    Adam Ginsburg
    @keflavich
    I'll try tyhat
    nope, no luck
    but I like it
    Thomas Robitaille
    @astrofrog
    hmm
    I wonder if it's a bug in Quantity since that should have an effect
    Adam Ginsburg
    @keflavich
    I think it's likelier that I misidentified the critical issue
    Projection * 5 uses Projection's __array_wrap__, but Projection * u.Jy doesn't.
    Thomas Robitaille
    @astrofrog
    ah
    that could be because __mul__ in Unit is hard-coded to use QUantity for that case?
    Adam Ginsburg
    @keflavich
    hmmm
    yeah
    Thomas Robitaille
    @astrofrog
    it should probably check if it's a subclass of Quantity
    Adam Ginsburg
    @keflavich
    overloading __array_wrap__ causes other problems
    np.isnan([5,6]*u.Jy) -> array([False, False], dtype=bool), but it will yield a new Projection with __array_wrap__ overloaded, which is bad.
    Thomas Robitaille
    @astrofrog
    hmm
    Adam Ginsburg
    @keflavich
    I'll prep an astropy-dev email
    Thomas Robitaille
    @astrofrog
    sounds good
    Adam Ginsburg
    @keflavich
    is it possible to @pytest.mark.parametrize a test and also pass it normal fixtures?
    Thomas Robitaille
    @astrofrog
    huh, never tried!
    Adam Ginsburg
    @keflavich
    dang
    I kinda need it, and it doesn't seem to be working...
    though maybe that's not the problem, nvm
    aha, yes, you can! you just have to have the parametrize specified correctly (I can never remember when to zip them)
    Thomas Robitaille
    @astrofrog
    cool!