Added support for colorspace conversion.

Implementation of the fixes discusses in yesterday's meeting.

I think this is quite complete. I've added support for the more generic "from"-"to" convert in ColorSpace, removed any dependency from Topographica, and added documentation (and the __all__specifier).



Hmm it should, I guess. I've just copied the code from wrap().
I'll make a quick test just to be sure!

G



On Wed, Jul 9, 2014 at 12:27 AM, James A. Bednar <notifications@github.com>
wrote:

> In featuremapper/colorspaces.py:
>
> > +                           (116*y-16)/KAP)
> > +
> > +    xr, yr, zr = finv(fx), finv(fy), finv(fz)
> > +    return numpy.dstack((xr*wp[0],yr*wp[1],zr*wp[2]))
> > +
> > +
> > +def lch_to_lab(LCH):
> > +    L,C,H = numpy.dsplit(LCH,3)
> > +    return numpy.dstack( (L,C*numpy.cos(H),C*numpy.sin(H)) )
> > +
> > +def lab_to_lch(LAB):
> > +    L,A,B = numpy.dsplit(LAB,3)
> > +    range_ = 2*pi
> > +    x = numpy.arctan2(B,A)
> > +    return numpy.dstack( (L, numpy.hypot(A,B), fmod(x + 2*range_*(1-floor(x/(2*range_))), range_) ) )
> > +    #return numpy.dstack( (L, numpy.hypot(A,B), wrap(0,2*pi,numpy.arctan2(B,A))) )
>
> Won't % work here, as in
> return numpy.dstack( (L, numpy.hypot(A,B), numpy.arctan2(B,A) % 2pi))
>
> ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ioam/featuremapper/pull/6/files#r14686440>.
>