Re: [opendx-dev] OpenDX data model confusion

2005-07-29 Thread Joel Richardson


Hi Matt,

Sounds like you are on the right track. The simplest way to get
your data into DX is probably just to create a delimited text
file and use ImportSpreadsheet (be sure to set the delimiter
input to whatever you use in the file (comma, tab, space, ...)

timesource1 source2 source3
0.1 53.2101.9   82.9
0.2557.0100.2   82.9
0.4 68.697.382.5
... ... ... ...

The Plot module (under Annotation) will draw the lines for
you. It wants a field with a 'positions' component containing
the X values, and a 'data' component containing the Y. So, to draw
the line for one of your sources, you could rename the time component
as 'positions', then mark the data source component you want to plot,
then pass it to Plot:

ImportSpreadsheet
|
|  "time"
|  | "positions"
|  |  |
Rename
  |
  | "source1"
  | |
 Mark
  |
  |
 Plot
  |
 Image

To plot all three source lines at once, Mark each one separately,
collect the results into a group, and pass that to Plot:

yourfield
|
|  "time"
|  | "positions"
|  |  |
Rename
  |
  |-+---+
  | |   |
  | "source1" |  "Source2"  |  "Source3"
  | |   |   |   |   |
 Mark   MarkMark
  | |   |
  +-+   |  ++
|   |  |
 Collect
|
Plot
|
Image

To create a scatter plot, say source1 vs. source2, rename source1 to 
positions, mark source2, and add a "scatter" attribute with a value of 
1, just before Plot:


yourfield
|
|  "source1"
|  | "positions"
|  |  |
Rename
  |
  | "source2"
  | |
 Mark
  |
  | "scatter"
  | |
  | |  1
 Options
  |
 Plot
  |
 Image

For more information, check out the documentation for Plot.


Hope this helps.

Cheers,
Joel

Matt Genovese wrote:

Hello,

I am a little confused regarding the OpenDX data model, and would like 
to solicit input from those who understand it better than I.


My project is fairly simple: I am writing a C program to capture data as 
time progresses, and plot it in DX.  There are one or more axes (sources 
of data values), and obviously the time-axis is another source of data 
(there can actually be multiple discrete time axes, but I'll keep it 
simple for now).  Note that time does not progress at a constant rate.


The goal is to be able to plot any axis vs. a time axis.  However, more 
generally, I'd like to be able to plot any axis vs. any other 
axiswhich is really a scatter plot.  The points on the scatter plot 
are correlated (linked) by the discrete time which they were captured in 
the simulation.


I'd like to understand how to best assemble this into the DX data 
model.  My attempt is to group all the axes under a DX Field.  Each axis 
is essentially a DX Array of data, which is a component of the Field.  
However, does this allow me to formulate the time-based plots or scatter 
plots I am looking for?  The Arrays I was building are scalar (rank 0) - 
just raw values (doubles) obtained over time...one for each axis.  I am 
also confused as to the "rank" and "shape" parameters, and how they 
affect organization of the data in the Arrayso perhaps this is part 
of my problem.


So for example, my thinking is that if I had 3 data sources, and they're 
sampled over time, I have:  4 "axes" - 4 DX Arrays as components under 1 
DX Field object.  Three of the arrays are one-dimensional and contain 
the data values, and the fouth array is one-dimensional and contains the 
capture times for all points.  Then the three data arrays are somehow 
linked to the fourth array to correlate the data value with 
time-of-capture.  Again, I'm worried I am going about this all-wrong.


I hope this is not too vague.  Thanks in advance for any guidance you 
can provide.

Best Regards,

Matt Genovese
University of Texas at Austin
--


--

===
Joel Richardson, Ph.D.   Phone: (207) 288-6435
The Jackson Laboratory   Fax:   (207) 288-6132
600 Main Street

Re: [opendx-dev] OpenDX data model confusion

2005-07-29 Thread Chris Pelkie
BTW, this was an opendx-users not -dev sort of question. For future reference.


On Jul 29, 2005, at 1:55 AM, Matt Genovese wrote:

___
Chris Pelkie
Scientific Visualization Producer
622 Rhodes Hall, Cornell Theory Center
Ithaca, NY 14853   (607) 254-8794


Re: [opendx-dev] OpenDX data model confusion

2005-07-29 Thread Chris Pelkie
The 'basis set' in DX is the "positions" component. You are close to what you need.
You need a 1-D (rank 1 shape 1) "positions". They can be simply 0..n-1, where n = number of items in (each of) your data array(s). This is what binds the other components together, in this case, just like an array index, but more generally, even if these were 3-D positions representing points in 3-D space, you would still associate your "data" components with the "positions". You can make this beast with Enumerate and Compute. Enumerate outputs a scalar array, Compute can make it 1-D vector (see below).

By virtue of associating the 4 data components (time is not special in DX) with the same positions, you 'relate' them as in a relational database, if you like to think of it that way. You have also guaranteed that each array has the same length and appears in the proper order, i.e., you've arranged it so that position 0 == time "0" (whatever actual time value that may be) == data0[0] == data1[0] == data2[0] (where "==" means "corresponds to" or "associates with"). So on up to position n-1 ==...data2[n-1]. These 5 components are bound into a Field because most DX modules like to work on Fields (because they know where things are stored, how they are associated, etc.).

So now it's trivial to Extract(data0) and Extract(data2) in parallel operations from the Field, Compute(float([a,b])) to make an array (of length n) of 2-vector floats [data0, data2]. These will become the new "positions" of the new Field that you will actually render. I like to do things the simple clean way, so trying to reinsert these over the old positions is not necessarily the best way to proceed. Instead, just send this 2-vector array into Construct's origin input. Viola, you get a new Field whose positions are your 2-vectors. You also get unnecessary (and sometimes annoying) line connections that join all these points in order, so I will often Remove("connections") right after Construct. Glyph, AutoColor, Image and you have a 2-d scatterplot. Add axes in Image. Any 2 of the 4 data components can be used. You can expand Compute to handle [a,b,c] and you get 3-d scatterplots. You can send any of the 4 data components (even if you've used them in positions) into the Construct "data" input to insert data onto each 2-vector position. Then AutoColor and Glyph will react to those data values (by default, Construct kicks out no data, so you have to put a "1" into "data" to avoid AutoColor bitching about the lack of data to color).

By the way, a scalar is not one-dimensional. It is zero-dimensional by definition. There is a precise meaning to 1-dimensional as you will find if you try to make a positions array with a scalar array. Doesn't work. You have to 'cast' it to 1-vector as follows: scalar input "a" -> Compute([a]). Further, positions MUST be float, thus the cast I did above for safety since one never knows what the 4 data input types are.

rank 0 = scalar (has no shape)
rank 1 = vector, now you must declare shape = n, where n = number of vector components (usually 1, 2, or 3, but DX has no known limit: I've worked with 57, and strings are character vectors that go to at least 1024)
rank 2 = tensor (read the manual)


On Jul 29, 2005, at 1:55 AM, Matt Genovese wrote:

Hello,

I am a little confused regarding the OpenDX data model, and would like to solicit input from those who understand it better than I.

My project is fairly simple: I am writing a C program to capture data as time progresses, and plot it in DX.  There are one or more axes (sources of data values), and obviously the time-axis is another source of data (there can actually be multiple discrete time axes, but I'll keep it simple for now).  Note that time does not progress at a constant rate.

The goal is to be able to plot any axis vs. a time axis.  However, more generally, I'd like to be able to plot any axis vs. any other axiswhich is really a scatter plot.  The points on the scatter plot are correlated (linked) by the discrete time which they were captured in the simulation.

I'd like to understand how to best assemble this into the DX data model.  My attempt is to group all the axes under a DX Field.  Each axis is essentially a DX Array of data, which is a component of the Field.  However, does this allow me to formulate the time-based plots or scatter plots I am looking for?  The Arrays I was building are scalar (rank 0) - just raw values (doubles) obtained over time...one for each axis.  I am also confused as to the "rank" and "shape" parameters, and how they affect organization of the data in the Arrayso perhaps this is part of my problem.

So for example, my thinking is that if I had 3 data sources, and they're sampled over time, I have:  4 "axes" - 4 DX Arrays as components under 1 DX Field object.  Three of the arrays are one-dimensional and contain the data values, and the fouth array is one-dimensional and contains the capture times for all points.  Then the three data