Visualize data


Graphic utilities for nsfds2


class nsfds2.utils.graphics.DataExtractor(data)[source]

Extract data from hdf5 file

Parameters

data (str, hdf5file) – Path to hdf5 file or data from hdf5 file.

autoref(view='p')[source]

Autoset reference.

close()[source]

Close hdf5 file

get(view='p', iteration=0)[source]

Get data at iteration.

get_attr(attr)[source]

Get attribute from hdf5 file. attr must be string.

get_dataset(dataset)[source]

Get dataset from hdf5 file. attr must be string.

list()[source]

List all datasets and attributes.

reference(view='p', ref=None)[source]

Generate the references for min/max colormap values

Parameters
  • view (str) – The quantity from which the reference is to be taken

  • ref (int, tuple, None, or str) – Can be int (frame index), tuple (int_min, int_max), or ‘auto’

class nsfds2.utils.graphics.DataIterator(data, view='p', nt=None)[source]

Data Generator

Parameters
  • data (DataExtractor or str) – DataExtractor instance or filename.

  • view (tuple) – The variable to display.

  • nt (int) – The last frame to consider.

class nsfds2.utils.graphics.Plot(filename, quiet=False)[source]

Helper class to plot results from nsfds2.

Parameters
  • filename (str) – hdf5 file

  • quiet (bool, optional) – Quiet mode.

fields(view=('p', 'e', 'vx', 'vz'), iteration=None, ref=None, show_pml=False, show_probes=True, figsize='auto', midpoint=0, comp=1)[source]

Make figure

movie(view=('p', 'e', 'vx', 'vz'), nt=None, ref=None, figsize='auto', show_pml=False, show_probes=False, dpi=100, fps=24, comp=1)[source]

Make movie.

probes()[source]

Plot pressure at probes.

static show()[source]

Show all figures.

spectrogram()[source]

Plot spectograms at probes.

nsfds2.utils.graphics.get_data(filename)[source]

Get data from filename (hdf5 file).