[yt-users] sample_colormap

Kacper Kowalik xarthisius.kk at gmail.com
Wed Dec 11 00:14:56 PST 2013


On 12/11/2013 12:17 AM, Mateusz Ruszkowski wrote:
>    Hi,
> 
> I am trying to do a very simple test of the sample_colormap function:
> 

Hi Mateusz,

> from yt.mods import *
> tf = ColorTransferFunction( (-30.0, -25.0) )
> tf.sample_colormap(-27.0, 0.01, 'algae')

try: tf.sample_colormap(-27.0, 0.01, colormap='algae')

Without a keyword python uses position of arguments to determine what's
passed to optional args. Here alpha, which should be float, gets string
and it crashes later on.

I can see that it's a bug in docs[1], I'll take care of it.
Thanks for the report!
Cheers,
Kacper

[1]
http://yt-project.org/docs/dev/reference/api/generated/yt.visualization.volume_rendering.transfer_functions.ColorTransferFunction.sample_colormap.html

> 
> and I am getting this error message triggered by the last line above:
> 
> Traceback (most recent call last):
>   File "layer_test.py", line 9, in <module>
>     tf.sample_colormap(-27.0, 0.01, 'algae')
>   File
> "/home/mateuszr/yt/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/transfer_functions.py",
> line 632, in sample_colormap
>     self.add_gaussian(v, w, [r, g, b, alpha])
>   File
> "/home/mateuszr/yt/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/transfer_functions.py",
> line 404, in add_gaussian
>     tf.add_gaussian(location, width, v)
>   File
> "/home/mateuszr/yt/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/transfer_functions.py",
> line 81, in add_gaussian
>     vals = height * np.exp(-(self.x - location)**2.0/width)
> TypeError: only integer arrays with one element can be converted to an index
> 
> 
> Am I doing something very silly here or is it a bug?
> 
>    Thanks,
>      Mateusz
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131211/bee611f1/attachment.sig>


More information about the yt-users mailing list