Non-API Methods

pyfilm.pyfilm.calculate_cbar_ticks(z, options)[source]

Calculate the color bar ticks based on the array extremes.

There are three options for options[‘cbar_ticks’]:

  • None: Automatically determine the extrama and set 5 ticks.
  • int: Automatically determine the extrama and set specified number of ticks.
  • array: Set cbar_ticks to user specified values.
Parameters:

z : array_like

The 3D array being plotted: z(x, y).

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.calculate_contours(z, options, plot_options)[source]

Calculate the contours based on the array extremes.

There are two options for options[‘ncontours’]:

  • None: Automatically determine the extrama and set 11 contours.
  • int: Automatically determine the extrama and set specified number of contours.
Parameters:

z : array_like

The 3D array being plotted: z(x, y).

options : dict

Dictionary of options which control various program functions.

plot_options : dict

Dictionary of plot customizations which are evaluated for each plot. Here we modify the matplotlib option ‘levels’.

pyfilm.pyfilm.check_data_1d(x, y)[source]

Performs consistency checks on the data passed into make_film_1d.

These checks are only done when both x and y arguments are passed into the function.

Parameters:

x : array_like,

Array specifying the x axis.

y : array_like

Two dimensional array assumed to be of the form y(t, x). This specifies the values to be plotted as a function of time.

pyfilm.pyfilm.check_data_2d(x, y, z)[source]

Performs consistency checks on the data passed into make_film_2d.

These checks are only done when both x, y, and z arguments are passed into the function.

Parameters:

x : array_like

Array specifying the x axis.

y : array_like

Array specifying the y axis.

z : array_like

Three dimensional array assumed to be of the form z(t, x, y). This specifies the values to be plotted as a function of time.

pyfilm.pyfilm.crop_image(args)[source]

Crop single image at a given time step.

Parameters:

it : int

Time step of frame being analyzed.

new_w : int

New width to crop images to.

new_h : int

New height to crop images to.

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.crop_images(nt, options)[source]

Ensures that PNG files have height and width that are even.

This owes to a quirk of avconv and libx264 that requires this. At the moment there is no easy way to specifically set the pixel count using Matplotlib and this is not desirable anyway since plots can be almost any size and aspect ratio depending on the data. The other solution found online is to use the -vf flag for avconv to control the output size but this does not seem to work. The most reliable solution therefore is to use Pillow to load and crop images.

Parameters:

nt : int

Length of the time dimension.

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.encode_images(options)[source]

Encode PNG images into a film.

Parameters:

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.find_encoder(options)[source]

Determines which encoder the user has on their system.

Parameters:

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.get_image_size(args)[source]

Returns the size of an image as a tuple of (width, height) in pixels.

Parameters:

it : int

Time step of frame being analyzed.

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.make_plot_titles(nt, options)[source]

Creates the array of plot titles passed to the plotting function.

This function allows dynamic plot titles such as the frame number or time. When the user has just passed in a fixed string, this is repeated to be the same length as the time dimension.

Parameters:

nt : int

Length of the time dimension.

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.plot_1d(args)[source]

Plot the 1D graph for a given time step.

Parameters:

it : int

Time index being plotted.

x : array_like

Array specifying the x axis.

y : array_like

Two dimensional array assumed to be of the form y(t, x). This specifies the values to be plotted as a function of time.

plot_options : dict

Dictionary of plot customizations which are evaluated for each plot, e.g. when plot is called it will be called as plt.plot(x, y, **plot_options)

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.plot_2d(args)[source]

Plot the 2D contour plot for a given time step.

Parameters:

it : int

Time index being plotted.

x : array_like

Array specifying the x axis.

y : array_like

Array specifying the y axis.

z : array_like

Three dimensional array assumed to be of the form z(t, x, y). This specifies the values to be plotted as a function of time.

plot_options : dict

Dictionary of plot customizations which are evaluated for each plot, e.g. when plot is called it will be called as plt.plot(x, y, **plot_options)

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.set_default_options(options)[source]

Sets the default options.

Parameters:

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.set_up_dirs(options)[source]

Checks for film directories and creates them if they don’t exist.

Parameters:

options : dict

Dictionary of options which control various program functions.

pyfilm.pyfilm.set_user_options(options, user_options)[source]

Replace default options with user specified ones.

An exhastive list of the available options is given in a table in the documentation.

Parameters:

options : dict

Dictionary of options which control various program functions.

user_options : dict

Dictionary of options passed in by the user as a keyword argument.

pyfilm.pyfilm.set_ylim(y, options)[source]

Sets the y limit for 1D films if not specified in options.

Parameters:

y : array_like

Two dimensional array assumed to be of the form y(t, x). This specifies the values to be plotted as a function of time.

options : dict

Dictionary of options which control various program functions.