<div dir="ltr"><div dir="ltr">Dear All,<div><br></div><div>I'm trying to export a vtk into a csv file.</div><div> however, it gives me an error message "<span class="gmail-ansi-red-intense-fg gmail-ansi-bold" style="font-size:14px;white-space:pre-wrap;box-sizing:border-box;color:rgb(178,43,49);font-weight:bold">ValueError</span><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap">: all the input array dimensions except for the concatenation axis must match exactly."</span></div><div><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap">my code is shown below. Can someone help me with this? I really appreciate it.</span></div><div><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap"><br></span></div><div><font color="#000000"><span style="font-size:14px;white-space:pre-wrap">import vtk
from vtk.numpy_interface import dataset_adapter as dsa
import numpy as np
from scipy import sparse
import keras

reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName("1111.vtk")
reader.ReadAllFieldsOn()
reader.Update()
vtk_data = reader.GetOutput()
points = vtk_data.GetPoints()
n_points = points. GetNumberOfPoints()

vtk_dataset_adapter = dsa.WrapDataObject(vtk_data)
coords = vtk_dataset_adapter.GetPoints()
density = vtk_dataset_adapter.PointData['density']

data_export = np.column_stack((coords,density))

</span></font><pre style="box-sizing:border-box;overflow:auto;font-size:14px;padding:1px 0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-break:break-all;color:rgb(0,0,0);border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><span class="gmail-ansi-red-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,43,49);font-weight:bold">---------------------------------------------------------------------------</span>
<span class="gmail-ansi-red-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,43,49);font-weight:bold">ValueError</span>                                Traceback (most recent call last)
<span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold"><ipython-input-13-e1f4e90953a9></span> in <span class="gmail-ansi-cyan-fg" style="box-sizing:border-box;color:rgb(96,198,200)"><module></span><span class="gmail-ansi-blue-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,101,202);font-weight:bold">()</span>
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">     18</span> density <span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span> vtk_dataset_adapter<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">.</span>PointData<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">[</span><span class="gmail-ansi-blue-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,101,202);font-weight:bold">'density'</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">]</span>
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">     19</span> 
<span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">---> 20</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold"> </span>data_export <span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span> np<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">.</span>column_stack<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span>coords<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">,</span>density<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span>
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">     21</span> 
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">     22</span> 

<span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">E:\Anacondapython3.6\envs\mlbook\lib\site-packages\numpy\lib\shape_base.py</span> in <span class="gmail-ansi-cyan-fg" style="box-sizing:border-box;color:rgb(96,198,200)">column_stack</span><span class="gmail-ansi-blue-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,101,202);font-weight:bold">(tup)</span>
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">    367</span>             arr <span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span> array<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span>arr<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">,</span> copy<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span><span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">False</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">,</span> subok<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span><span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">True</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">,</span> ndmin<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">=</span><span class="gmail-ansi-cyan-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(37,143,143);font-weight:bold">2</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">.</span>T
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">    368</span>         arrays<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">.</span>append<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span>arr<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span>
<span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">--> 369</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">     </span><span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">return</span> _nx<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">.</span>concatenate<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span>arrays<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">,</span> <span class="gmail-ansi-cyan-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(37,143,143);font-weight:bold">1</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span>
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">    370</span> 
<span class="gmail-ansi-green-fg" style="box-sizing:border-box;color:rgb(0,162,80)">    371</span> <span class="gmail-ansi-green-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(0,116,39);font-weight:bold">def</span> dstack<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">(</span>tup<span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">)</span><span class="gmail-ansi-yellow-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,125,18);font-weight:bold">:</span>

<span class="gmail-ansi-red-intense-fg gmail-ansi-bold" style="box-sizing:border-box;color:rgb(178,43,49);font-weight:bold">ValueError</span>: all the input array dimensions except for the concatenation axis must match exactly
</pre><br class="gmail-Apple-interchange-newline"><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap">
</span></div><div><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap">Regards,</span></div><div><span style="color:rgb(0,0,0);font-size:14px;white-space:pre-wrap">Aaron</span></div></div></div>