Project

General

Profile

GenericPlottingPython » History » Version 1

Ted Sume, 11/14/2019 09:41 AM

1 1 Ted Sume
# GenericPlottingPython
2
3
**Notes on the design discussion from Aug 9, 2011 (Sveta Shasharina, Scott Kruger, Dimitre Dimitrov, Srinath Vadlamani)**
4
5
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. 
6
7
The following code structure represents a candidate design for implementation: 
8
```
9
VsValidator
10
   Constructor: takes a string (file name)
11
   validate method: no input, returns VsMetadata object
12
13
VsMetadata
14
   Contains all vs elements and the file name
15
   No methods
16
17
VsReader
18
   Constructor takes VsMetadata as input
19
   read method: creates VsData object which is basically (metadata + data) grouped by vs elements
20
   This means that we need classes for all vs elements and all vs elements with data?
21
22
Could be something like:
23
   validator = VsValidator("gyro.h5")
24
   gyrometa = validator.validate()
25
   reader = VsReader(gyrometa)
26
   gyrodata = reader.read()
27
#
28
# Note that VsH5File does not do a complete read of
29
# hdf5 arrays but uses slicing to extract only 
30
# subset of the array data via specific getter functions.
31
# This feature might be desirable to implement in
32
# the VsReader too. 
33
#
34
# Plots everything
35
   gyrodata.plot()
36
# Returns vsVariables list
37
  vsvars = gyrodata.vsVars
38
# Plots all vs vars
39
   gyrodata.vsVars.plot()
40
# Plots the first one
41
   gyrodata.vsVars[0].plot()
42
# Plots one var by name
43
   gyrodata.vsVars.phi.plot()
44
# What else?
45
```
46
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 
47
```
48
validator.validate()
49
```
50
Additional ideas discussed: 
51
* 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. 
52
* 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.