vmin and vmax ignored in viper_dolfin

Bug #922717 reported by Martin Sandve Alnæs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Viper
Fix Released
Undecided
Johan Hake

Bug Description

In the non-dolfin version of plot, vmin and vmax can be passed. This is a crucial feature for e.g. animations over timesteps. In the dolfin version of plot, those are simply ignored in dolfin_update() in viper_dolfin.py. Example:

from dolfin import *
import time
mesh = UnitSquare(10,10)
e = Expression("k*x[0]*x[1]", k=0.0)
for i in range(10):
    e.k = (i+1)/10.0
    figure(1)
    plot(e, mesh=mesh, vmin=-1.0, vmax=+1.0)
    time.sleep(0.1)
interactive()

Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 922717] [NEW] vmin and vmax ignored in viper_dolfin

Can you supply a patch? (Or better yet, just push the fix.)

--
Anders

On Fri, Jan 27, 2012 at 05:09:26PM -0000, Martin Sandve Alnæs wrote:
> Public bug reported:
>
> In the non-dolfin version of plot, vmin and vmax can be passed. This is
> a crucial feature for e.g. animations over timesteps. In the dolfin
> version of plot, those are simply ignored in dolfin_update() in
> viper_dolfin.py. Example:
>
> from dolfin import *
> import time
> mesh = UnitSquare(10,10)
> e = Expression("k*x[0]*x[1]", k=0.0)
> for i in range(10):
> e.k = (i+1)/10.0
> figure(1)
> plot(e, mesh=mesh, vmin=-1.0, vmax=+1.0)
> time.sleep(0.1)
> interactive()
>
> ** Affects: fenics-viper
> Importance: Undecided
> Status: New
>

Revision history for this message
Johan Hake (johan-hake) wrote :

On Friday January 27 2012 18:09:26 Martin Sandve Alnæs wrote:
> Public bug reported:
>
> In the non-dolfin version of plot, vmin and vmax can be passed. This is
> a crucial feature for e.g. animations over timesteps. In the dolfin
> version of plot, those are simply ignored in dolfin_update() in
> viper_dolfin.py. Example:

I had some serious trouble with this too. The thing is that they are not
ignored. They are "just" overridden by rescale=True. Pass rescale=False to the
plot and you should be fine. It is well hidden at line 56 in dolfin_viper.py

   kwargs["rescale"] = kwargs.get("rescale", True)

I think the bug is still valid though, but maybe under the much larger, "Viper
interface and documentation suck".

Johan

> from dolfin import *
> import time
> mesh = UnitSquare(10,10)
> e = Expression("k*x[0]*x[1]", k=0.0)
> for i in range(10):
> e.k = (i+1)/10.0
> figure(1)
> plot(e, mesh=mesh, vmin=-1.0, vmax=+1.0)
> time.sleep(0.1)
> interactive()
>
> ** Affects: fenics-viper
> Importance: Undecided
> Status: New

Revision history for this message
Martin Sandve Alnæs (martinal) wrote :

Johan: Thanks, setting rescale=False works.

Anders: I'm not commiting any patch because I don't understand the program flow.

Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 922717] Re: vmin and vmax ignored in viper_dolfin

On Mon, Jan 30, 2012 at 09:09:39AM -0000, Martin Sandve Alnæs wrote:
> Johan: Thanks, setting rescale=False works.
>
> Anders: I'm not commiting any patch because I don't understand the
> program flow.

Neither do I. I don't think anyone understands the Viper program
flow. :-)

--
Anders

Johan Hake (johan-hake)
Changed in fenics-viper:
status: New → Won't Fix
Johan Hake (johan-hake)
Changed in fenics-viper:
status: Won't Fix → Fix Committed
assignee: nobody → Johan Hake (johan-hake)
Changed in fenics-viper:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.