-
Notifications
You must be signed in to change notification settings - Fork 24
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
Plotting with BigFloats #176
Comments
It is always helpful to post the code that lead to this issue, and maybe even the error message :) |
|
Oh, sorry, I assumed this was a known problem. Here is the code: julia> using DynamicalBilliards
julia> using PyPlot
WARNING: using PyPlot.axes in module Main conflicts with an existing identifier.
julia> bd = billiard_rectangle(BigFloat(2),BigFloat(2))
Billiard{BigFloat} with 4 obstacles:
Bottom wall
Right wall
Top wall
Left wall
julia> plot(bd)
ERROR: PyError ($(Expr(:escape, :(ccall(#= /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''",)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 1605, in xlim
ret = ax.set_xlim(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 2904, in set_xlim
left, right = mtransforms.nonsingular(left, right, increasing=False)
File "/usr/lib/python3/dist-packages/matplotlib/transforms.py", line 2773, in nonsingular
if (not np.isfinite(vmin)) or (not np.isfinite(vmax)):
Stacktrace:
[1] pyerr_check at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:60 [inlined]
[2] pyerr_check at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:64 [inlined]
[3] macro expansion at /home/yakir/.julia/packages/PyCall/0jMpb/src/exception.jl:84 [inlined]
[4] __pycall!(::PyCall.PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyCall.PyObject, ::Ptr{Nothing}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:44
[5] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{BigFloat,BigFloat}, ::Int64, ::Ptr{Nothing}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:22
[6] _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{BigFloat,BigFloat}, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:11
[7] #pycall#88(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:86
[8] pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyCall/0jMpb/src/pyfncall.jl:86
[9] #xlim#137(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::BigFloat, ::Vararg{BigFloat,N} where N) at /home/yakir/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:179
[10] xlim at /home/yakir/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:176 [inlined]
[11] #plot#85(::PyCall.PyObject, ::Function, ::Billiard{BigFloat,4,NTuple{4,InfiniteWall{BigFloat}},Nothing}) at /home/yakir/.julia/packages/DynamicalBilliards/pQCBP/src/plotting/billiards.jl:46
[12] plot(::Billiard{BigFloat,4,NTuple{4,InfiniteWall{BigFloat}},Nothing}) at /home/yakir/.julia/packages/DynamicalBilliards/pQCBP/src/plotting/billiards.jl:39
[13] top-level scope at none:0 |
So since we will be almost certainly porting plotting of this package to Makie I won't be spending time solving this. But I'll keep it open for reference, to be sure that this is tested when we go to makie! |
Makie converts internally to Float32, so BigFloats won't be as useful there. Still, it is possible. |
So this is understandable, and most def not your doing, but currently despite the fact that we can do all of this with BigFloats for crazy accuracy, we can not plot the results. So either mention this in the docs, show a workaround, include a method that fixes this, or change the plotting to something that does (I doubt this exists, but maybe Makie?).
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: