Project

General

Profile

Actions

GenericPlottingPython

Notes on the design discussion from Aug 9, 2011 (Sveta Shasharina, Scott Kruger, Dimitre Dimitrov, Srinath Vadlamani)

Some of the goals for the generic python plotting tool consist of functionality to plot any vizschema element (including its dependencies on other data such as meshes) that contains array data in scripting mode and also to allow tab completion on HDF5 node paths for more efficient use interactively.

The following code structure represents a candidate design for implementation:

VsValidator
   Constructor: takes a string (file name)
   validate method: no input, returns VsMetadata object

VsMetadata
   Contains all vs elements and the file name
   No methods

VsReader
   Constructor takes VsMetadata as input
   read method: creates VsData object which is basically (metadata + data) grouped by vs elements
   This means that we need classes for all vs elements and all vs elements with data?

Could be something like:
   validator = VsValidator("gyro.h5")
   gyrometa = validator.validate()
   reader = VsReader(gyrometa)
   gyrodata = reader.read()
#
# Note that VsH5File does not do a complete read of
# hdf5 arrays but uses slicing to extract only 
# subset of the array data via specific getter functions.
# This feature might be desirable to implement in
# the VsReader too. 
#
# Plots everything
   gyrodata.plot()
# Returns vsVariables list
  vsvars = gyrodata.vsVars
# Plots all vs vars
   gyrodata.vsVars.plot()
# Plots the first one
   gyrodata.vsVars[0].plot()
# Plots one var by name
   gyrodata.vsVars.phi.plot()
# What else?

Tab completion is supported in IPython for PyTables node paths using "root" for the initial "/". After each path name, a user has to type "." before using tab completion again to list the node names at this level of the hdf5 data tree. The tab completion feature is desirable to implement for the data objects that will be returned by

validator.validate()

Additional ideas discussed:

  • One could use an xml file (vs xsd compliant) that has the same information as VsMetadata (mapping between vs elements and paths in an h5 file that does NOT have vs markup). In this case the workflow is to use it instead of VsValidator to obtain a VsMetadata object. The rest is the same. This is for the future.
  • One could also autogenerate Python classes using xsd schema as all the data members and dependencies have one to one correspondence with the schema. This is for the future.

Updated by Ted Sume about 5 years ago · 1 revisions