'Perform setup for writing the movie file.
Parameters
fig : `matplotlib.Figure` instance
The figure object that contains the information for frames
outfile : string
The filename of the resulting movie file
dpi : int, optional
The DPI (or resolution) for the file.  This controls the size
in pixels of the resulting movie file. Default is fig.dpi.'

def setup(self, fig, outfile, dpi=None):

    self.outfile = outfile
    self.fig = fig
    if (dpi is None):
        dpi = self.fig.dpi
    self.dpi = dpi
    (self._w, self._h) = self._adjust_frame_size()
    self._run()
