First of all, forgive the rather lengthy explanation, but I want to make sure that the problem space is well defined, so please bear with me.
I need to build a 3D surface plot of some spectra data for a client. The spectra data will be supplied as float values in a CSV file and I will be (presumably) using the TableImport node to access this information.
The CSV file will be formatted as follows:
- The first column of data will represent points along the X-axis (i.e. energy).
- Many subsequent columns will each represent a set of Y-axis values (i.e. absorption) at a given temperature step. For example, there could be a 100 of these columns and I am assuming for the moment that the temperature steps will all be the same.
So, to summarise, the 3D plot will comprise energy along the X-axis, absorption up the Y-axis, and temperature along the Z-axis.
Using an example CSV data-set to experiment with, I have setup a TableImport node to read the X-axis values into one float attribute (energy), and the columns of Y-axis values into a single float attribute (absorption) which has an attribute length set equal to the number of temperature columns.
This data shows up nicely in the Geometry Spreadsheet and I can see the following columns listed and with the expected float values beneath:
“energy, absorption#0, absorption#1, absorption#2, absorption#3, absorption#4, …” where #-n represents the number in square brackets.
So far so good.
I then pipe the output of the TableImport node into a PointWrangle node with VEX code that should generate the 3D plot. For example, @P = set(@energy, @absorption, zoffset); .
However, when I try to treat the multiple @absorption values as an array of float values (e.g. using @absorption, where i = 0, 1, 2, …), the VEX compiler complains bitterly (e.g. “Ambiguous call to array index operator”). It seems that I can only access and plot the first column of absorption data against the energy (i.e. it will only recognise @absorption as a legitimate variable, and nothing else).
So there are two questions that I hope you might be able to answer for me:
- How do you access values of an attribute that is in the form of a float array?
- Is there a better method (Python?) that I could use to generate this 3D plot?
Once again, apologies for the lengthy explanation.
Thanks in advance,