Skip to content
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

Fix animations issues #609

Closed
aashish24 opened this issue Sep 6, 2014 · 14 comments
Closed

Fix animations issues #609

aashish24 opened this issue Sep 6, 2014 · 14 comments
Milestone

Comments

@aashish24
Copy link
Contributor

Look at the Boxfill for Animation attachment. This is where I started. Then look at the Animation Window attachment for the animation. The animation does not even look close to the original plot. Also it should have kept the min and max over the entire animation. The background is black.

@aashish24 aashish24 added this to the 2.0.0 milestone Sep 6, 2014
@dakoop
Copy link
Contributor

dakoop commented Sep 7, 2014

  1. There are no attachments.
  2. The code that creates the animation sets the draw_white_background flag when it generates the pngs, but as far as I can tell, the VTKPlots.py:VTKVCSBackend:png function ignores this flag. @doutriaux1, any suggestions?
  3. This code in animate_helper.py:set_animation_min_max looks extremely suspect:
      if gtype == "boxfill":
         gm=self.vcs_self.getboxfill(animation_info['gname'][i])
         if gm.boxfill_type == 'custom':
             gm.fillareacolors = cols
             gm.levels = levs
         else:
             gm.level_1=levs[0]
             gm.level_2=levs[-1]
             gm.legend=None

Replacing the gm.level_1, gm.level_2 lines with a gm.levels = levs seems to fix things. @doutriaux1, any thoughts?

@doutriaux1
Copy link
Contributor

@dakoop what is suspicious about this bit of code? boxfill object have 2 behaviour one historical where you set level1 and level2 and color1 and color2, and a "custom" one implemented later to make it consistent with isofill where you set "levels" and "colors" attributes. If what @dakoop mentions is true then it's a bug it shouldn't be looking at levels if type is not "custom". yes the draw_white_background was for the old vcs which did not render any background, VTK calls now have a call that tells it to render a white background on the renWin object so it should be ignored indeed.

@dakoop
Copy link
Contributor

dakoop commented Sep 8, 2014

@doutriaux1, here a frame from a box plot animation with the current code:
screen shot 2014-09-08 at 9 45 35 am
Here is a frame with the change I specified above (gm.levels = levs instead of gm.level_1 = levs[0]; gm.level_2 = levs[-1]):
screen shot 2014-09-08 at 9 47 14 am
This makes me suspect that something is wrong with the level_1, level_2 implementation. Note that in both cases, levs = [0, 10, ... 100] so levs[0] = 0 and levs[-1] = 100. It is certainly possible that something only in the animation rendering is wrong, but it seems odd that the same animation code works fine when I trigger the non-legacy graphics method.

@dakoop
Copy link
Contributor

dakoop commented Sep 8, 2014

With respect to the white background, if the renWin background is always set to white, why does the following render_frame method not draw with a white background?

  def render_frame(self, frame_args, frame_num):
    if self.animation_seed is None:
        self.animation_seed = numpy.random.randint(10000000000)
    fn = os.path.join(os.environ["HOME"],".uvcdat",
                      "__uvcdat_%i_%i.png" % (self.animation_seed,frame_num))
    self.animation_files.append(fn)

    #BB: this clearing and replotting somehow fixes vcs internal state
    # and prevents segfaults when running multiple animations
    #self.vcs_self.replot()

    self.create_canvas.clear()
    for args in frame_args:
        self.create_canvas.plot(*args, bg=1)
    self.create_canvas.png(fn,draw_white_background=1)

@doutriaux1
Copy link
Contributor

DaveI need to look at this bit of code for the white bg, the draw_whitebackground is ignored I think. But maybe not and that triggerrs no white bg. Can you try taking it out?
Concerning levels, I think you're right something is wrong is boxfill, will take a look,

@dakoop
Copy link
Contributor

dakoop commented Sep 8, 2014

I checked the png method implementation and the draw_white_background flag is totally ignored (never referenced).

@doutriaux1
Copy link
Contributor

ok that makes sense.

@dakoop
Copy link
Contributor

dakoop commented Sep 8, 2014

The black background in animations was due to the renderer's background color not being set for put_img_on_canvas in vcs's VTKPlots.py. This is corrected in the fix-animation-background branch on devel.

@doutriaux1
Copy link
Contributor

Yes! Thank you @dakoop

@aashish24
Copy link
Contributor Author

@doutriaux1 Did you merge this branch?

@aashish24
Copy link
Contributor Author

@doutriaux1 Did we merge this branch?

@doutriaux1
Copy link
Contributor

already in see commit 03f9a7b

@williams13
Copy link
Contributor

Does this include the consistent colormap issue?

Thanks, Dean

From: Charles <notifications@github.commailto:notifications@github.com>
Reply-To: UV-CDAT/uvcdat <reply@reply.github.commailto:reply@reply.github.com>
Date: Thursday, September 18, 2014 9:53 AM
To: UV-CDAT/uvcdat <uvcdat@noreply.github.commailto:uvcdat@noreply.github.com>
Subject: Re: [uvcdat] Fix animations issues (#609)

Closed #609#609.


Reply to this email directly or view it on GitHubhttps://github.com//issues/609#event-167294945.

@dakoop
Copy link
Contributor

dakoop commented Sep 18, 2014

@williams13, is this the issue @potter2 mentions in #642? If so, could we please create a new, focused issue and provide a reproducible list of of steps to trigger this issue (preferably with clt.nc)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants