How to converting by using "Table to Structed Grid" on Paraview? - csv

I tried converting a CSV file to Structured Grid.
Arrays in the file are X==size 16, Y==size 16, Z==size 24.
Unfortunately, defective result was returned. Many points are lacking, and volume rendering was failed.
But result of Filters/ Alphabetical/ Table To Points is no problem.

You have to make sure that your data is really a grid (that is to say that you have the coordinates of each point at the grid nodes), that you select the correct order for x,y,z (x should be the one the "changes fastest") and to set the extent correctly (from 0 to dimension-1)
For example, if your csv file should looks like:
X,Y,Z
0,0,0
1,0,0
0,1,0
1,1,0
0,0,1
1,0,1
0,1,1
1,1,1
you have to set the extent 0-1,0-1,0-1

Related

Using generator to save memory

Suppose I have one million files in my directory, It'd be a huge consumption in memory if I just did:
x = os.listdir('.')
Suppose for some reason, I chose to use os.walk method and did this to use generator:
def give_object(somepath)
for x in os.walk(somepath):
for j in x[2]:
yield j
os.walk is itself a generator, and I get a value of (cur_directory, sub_directories, list_of_all_files_in_cur_directory) via x. x[2] would contain the 1 million file names. In the second for statement, I'm also yielding a value, making a generator, but, at that point, I've already created a list out from x, So, Would this code really save memory space that would be used for the 1 million items? Or is this not a correct way of using generator for the use case? If so, how should I go about doing it?

Importing Nodes with Coordinates to Gephi from CSV

This question seems pretty stupid but I actually fail to find a simple solution to this. I have a csv file that is structured like this:
0 21 34.00 34.00
1 23 35.00 25.00
2 25 45.00 65.00
The first column is the node's id, the second is an unimportant attribute. The 3rd and 4th attribute are supposed to be the x and y position of the nodes.
I can import the file into the Data Laboratory without problems, but I fail to explain to Gephi to use the x y attributes as the corresponding properties. All I want to achieve is that Gephi sets the x Property to the value of the x Attribute (and y respectively). Also see picture.
Thanks for your help!
In the Layout window, you can select "Geo Layout" and define which columns are used as Latitude and Longitude.
The projection might come in weird if you do not actually have GeoData, but for me, this is fine.
In Gephi 0.8 there was a plugin called Recast column. This plugin is unfortunately not ported to Gephi 0.9 yet, but it allowed you to set Standard (hidden) Columns in the Node Table, from visible values in the nodes table. Thus if you have two columns of type Float or Decimal that represent your coordinates, you could set the coordinate values of your nodes.

Weka MLP multiple outputs

I'm using the multiplayer perceptron on Weka to classify data. Classification output should be a unique binary vector associated with certain input, e.g., 1, 1, -1, 1, -1, -1, 1. Output vector is 31-element long while input is 39-element vector of real numbers. That is, the output cannot be represented by one column in the CSV file. Rather, I should have 31 columns for output values (class) beside the 39 columns of the input. I know how to use Weka when I have one-column classes, but with such vector output I have a problem. I must have it like that because I need to compare it with MLP ANN in Matlab that hase 31 outputs in the output layer. Therefore, I cannot assign an abstract symbol for each unique combination in order to have one coloumn in my CSV. Your help is highly appreciated. Thanks in advance and have a nice day

How to use Gnuplot to create histogram from binned data from CSV file?

I have a CSV file which is generated by a process that outputs the data in pre-defined bins (say from -100 to +100 in steps of 10). So, each line looks somewhat like this:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
i.e. 20 comma separated values, the first representing the frequency in the range -100 to -90, while the last represents the frequency between 90 to 100.
The problem is, Gnuplot seems to require the raw data for it to be able to generate a histogram, whereas I have only the frequency distribution. How do I proceed in this case? I'm looking for the simplest possible histogram, that perhaps displays the data using vertical bars.
You already have histogram data, so you mustn't use "set histogram".
Generate the x-values from the linenumbers, and do a simple boxplot
plot dataf using (($0-10)*10):$1 with boxes

"Gis:property-value primitive" netlogo

I am using the gis extension in netlogo. I got stuck in this point:
Using the primitive gis:property-value
The line of code looks like this:
gis:set-drawing-color scale-color red (gis:property-value ? "POPULATION") 5000000 1000
I do not know what population and 5000000 1000 means , I mean I assign that name (population) and values (5000000 1000) or they are values that are already written in the .shp file.
"POPULATION" refers to something that already exists in the .shp file. I imagine it would show up if you browsed the contents of the file using standard GIS tools.
As for 5000000 1000, these are inputs to the scale-color primitive, to translate a range of population values to a range of shades of red. See http://ccl.northwestern.edu/netlogo/docs/dictionary.html#scale-color , and see also the Scale-color Example model in the Code Examples section of NetLogo's Models Library.
The number 500000 was apparently chosen by the model author based on their prior knowledge of the range of population values they expect to appear in the input file.
according to gis-extension manual gis:property-value is used like gis:property-value VectorFeature property-name to with this small peace of code, I guess your in a foreach loop. The ? is the shp ID in the loop for the "POPULATION" column and 5000000 1000 seem to be the value for this polygon!