Welcome, Guest. Please Login.
OpenDX User Forum
01/18/18 at 18:31:15


Pages: 1
multiple data column (Read 4703 times)
paullast
Forum Newbie
*


Got Viz?

Posts: 6
multiple data column
07/12/13 at 13:05:39
 
I have two scalar variables at each point in my dx data file, i.e., I have two data columns in Node field. How can I choose to plot either column 1 or column 2? My data file is like
 
 ## Vertices
object 1 class array type float rank 1 shape 3 items 2585
data follows
 1.000000e+00  0.000000e+00  0.000000e+00  
 9.971392e-01  7.558760e-02 -1.373527e-04  
 9.970948e-01  3.824725e-02  6.587223e-02  
-1.000000e+00  0.000000e+00  0.000000e+00  
 ...
 
## Simplices
object 2 class array type int rank 1 shape 3 items 5166
data follows
 0 1 2
 3 0 2
 4 0 3
 ...
attribute "element type" string "triangles"
attribute "ref" string "positions"
 
## Node field
object 3 class array type float rank 1 shape 2 items 2585
data follows
  9.545090e-01 -8.338102e-02
  9.522585e-01 -8.516874e-02
  9.535565e-01 -8.329466e-02
  9.521449e-01 -8.135764e-02
  ...
attribute "dep" string "positions"
 
object "irregular positions irregular connections" class field
component "positions" value 1
component "connections" value 2
component "data" value 3
end
Back to top
 
 
Email   IP Logged
balden
Forum Newbie
*


Got Viz?

Posts: 14
Re: multiple data column
Reply #1 - 07/12/13 at 14:53:28
 
Insert a "Compute" module with expression "a.0" or "a.1" right before plotting operators ("Autocolor" or "Autoglyph" or whatever).
You can even put an interactive column selector in a control panel: add a "Selector" interactor with values 0 or 1 as labels "first column" and "second column", and feed its value into the second argument of the above "Compute" module, then use expression "select(a,b)" in the "Compute" module.
Back to top
 
 
  IP Logged
paullast
Forum Newbie
*


Got Viz?

Posts: 6
Re: multiple data column
Reply #2 - 07/12/13 at 15:20:25
 
Excellent! It works perfect. Thanks a lot!
 
Now the question: where can I find the tutorial/notes on these issues? I googled several tutorials online but none talks these treatments.
Back to top
 
 
Email   IP Logged
balden
Forum Newbie
*


Got Viz?

Posts: 14
Re: multiple data column
Reply #3 - 07/13/13 at 03:12:45
 
Depends what "issues" you are referring to.
Specifically on data formatting issues, I think the HTML manuals are your best source of information.
It is really not bad at all: with Firefox, open (and bookmark) the "allguide.htm" in the "html" subfolder.
There is even a comfortable search tool.
You may start with those "must-reads":
 
Index => User's Guide => Chapter 3 - Understanding the Data Model
                                          (and more specifically => 3.2 - Object Types => Arrays)
 
                                 => Appendix B - Importing Data: File Formats => B.2 - Data Explorer Native Files
 
The "Compute" module is also extremely powerful, so you should definitely read its documentation page:
 
Index => User's Reference => Chapter 1 - Data Explorer Tools => Transformation => Compute
 
Of course there is also the well-known book "paths to visualization" which is highly advisable.
 
Note: although there is nothing fundamentally wrong in putting all your data columns in a single big multi-column "data" component, and extracting the appropriate column(s) with a "Compute" as in my previous post, the DX "field" structure is actually rather meant to group all different kinds of data into separate "data" components, which can later make it easier (more flexible, and more straightforward) to select a given kind of data at a given spot in your visual program.
 
A "field" can have any number of data components, which can be either "position-" or "connection-" -dependent, which can be scalar (single-column, rank 0), n-D vectors (n-column, rank 1) or n-D tensors (n x n -column, rank 2), and which can be expicitly named after their content (not necessarily the default name "data", but can also be "pressure", "gradient", "vorticity", "electric field", "strain tensor"...).
 
You can then "Import" only the data component you need (using the "variable" argument to the "Import" module), hence save some memory by not loading the other data components, or use the "Mark" module, like Mark("pressure") or Mark("gradient"), to select which actual data component you want to operate on with the tools downstream in the network ("Compute", "Statistics", "Autoglyph", "Rubbersheet", "Isosurface" or "Autocolor" or whatever).
 
It is then common practice to feed the component-name ("string") input to the "Import" or "Mark" modules from the "name" output (also "string") of a "Selector" interactor, which allows you to interactively select the data component you want by selecting its name in a control panel: you don't need to remember which column is which variable or create lookup tables for assigning explicit variable names to your data columns.
 
BTW, you should carefully read the documentation of the "Mark" and "Unmark" modules, especially to notice that the "Unmark" module can be used to create a backup of a component before applying modifications to it, allowing you to restore the original downstream by "Mark"-ing the component name you specified as the backup.
 
Index => User's Reference => Chapter 1 - Data Explorer Tools => Structuring => Mark / Unmark
Back to top
 
 
  IP Logged
paullast
Forum Newbie
*


Got Viz?

Posts: 6
Re: multiple data column
Reply #4 - 07/16/13 at 11:39:41
 
thanks a ton balden!
Back to top
 
 
Email   IP Logged
Pages: 1