Discussion:
[Paraview] Writing csv data in python script
denis cohen
2014-08-02 09:34:40 UTC
Permalink
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
But I get:
Traceback (most recent call last):
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'

Thanks for any help.

Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140802/71c27f4d/attachment.html>
Casey Goodlett
2014-08-05 17:38:37 UTC
Permalink
Denis,

You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.
Post by denis cohen
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'
Thanks for any help.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
http://public.kitware.com/mailman/listinfo/paraview
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140805/0071447d/attachment.html>
denis cohen
2014-08-08 15:30:58 UTC
Permalink
Hi Casey,

I've tried this like in your suggestion:

SetActiveSource(IntegrateVariables1)
DataSetCSVWriter()
FileName="foo_points.csv"
FieldAssociation = "Points"
UpdatePipeline()

and other similar commands but none produced a csv file. Any hints?

Thanks

Denis



On Tue, Aug 5, 2014 at 7:38 PM, Casey Goodlett <casey.goodlett at kitware.com>
Post by Casey Goodlett
Denis,
You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.
Post by denis cohen
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'
Thanks for any help.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
http://public.kitware.com/mailman/listinfo/paraview
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140808/da02beb1/attachment.html>
Casey Goodlett
2014-08-08 15:40:28 UTC
Permalink
Do you get any error messages in the python console or output window?

What type of data does your source produce polydata, unstructured grid, etc?
Post by denis cohen
Hi Casey,
SetActiveSource(IntegrateVariables1)
DataSetCSVWriter()
FileName="foo_points.csv"
FieldAssociation = "Points"
UpdatePipeline()
and other similar commands but none produced a csv file. Any hints?
Thanks
Denis
On Tue, Aug 5, 2014 at 7:38 PM, Casey Goodlett <casey.goodlett at kitware.com
Post by Casey Goodlett
Denis,
You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.
Post by denis cohen
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'
Thanks for any help.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
http://public.kitware.com/mailman/listinfo/paraview
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140808/1e27110f/attachment-0001.html>
denis cohen
2014-08-08 15:43:39 UTC
Permalink
Hi Casey,

I get no error and I read my data with XMLPartitionedUnstructuredGridReader.

Denis



On Fri, Aug 8, 2014 at 5:40 PM, Casey Goodlett <casey.goodlett at kitware.com>
Post by Casey Goodlett
Do you get any error messages in the python console or output window?
What type of data does your source produce polydata, unstructured grid,
etc?
On Fri, Aug 8, 2014 at 11:30 AM, denis cohen <denis.cohen at gmail.com>
Post by denis cohen
Hi Casey,
SetActiveSource(IntegrateVariables1)
DataSetCSVWriter()
FileName="foo_points.csv"
FieldAssociation = "Points"
UpdatePipeline()
and other similar commands but none produced a csv file. Any hints?
Thanks
Denis
On Tue, Aug 5, 2014 at 7:38 PM, Casey Goodlett <
Post by Casey Goodlett
Denis,
You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.
On Sat, Aug 2, 2014 at 5:34 AM, denis cohen <denis.cohen at gmail.com>
Post by denis cohen
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'
Thanks for any help.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
http://public.kitware.com/mailman/listinfo/paraview
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140808/8d3facc5/attachment.html>
Casey Goodlett
2014-08-08 15:46:23 UTC
Permalink
I tried this in the binary download of paraview 4.1
Post by denis cohen
Post by Casey Goodlett
s = Sphere()
w = DataSetCSVWriter(s, FileName='/tmp/test.csv',
FieldAssociation='Points')
Post by denis cohen
Post by Casey Goodlett
w.UpdatePipeline()
and successfully had a file written.

You might try explicitly passing your reader as input to the
DataSetCSVWriter rather than relying on the active source.

I am not familiar with partitioned unstructured grid to know if any
additional steps are needed.

good luck
Post by denis cohen
Hi Casey,
I get no error and I read my data with
XMLPartitionedUnstructuredGridReader.
Denis
On Fri, Aug 8, 2014 at 5:40 PM, Casey Goodlett <casey.goodlett at kitware.com
Post by Casey Goodlett
Do you get any error messages in the python console or output window?
What type of data does your source produce polydata, unstructured grid,
etc?
On Fri, Aug 8, 2014 at 11:30 AM, denis cohen <denis.cohen at gmail.com>
Hi Casey,
SetActiveSource(IntegrateVariables1)
DataSetCSVWriter()
FileName="foo_points.csv"
FieldAssociation = "Points"
UpdatePipeline()
and other similar commands but none produced a csv file. Any hints?
Thanks
Denis
On Tue, Aug 5, 2014 at 7:38 PM, Casey Goodlett <
Post by Casey Goodlett
Denis,
You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.
On Sat, Aug 2, 2014 at 5:34 AM, denis cohen <denis.cohen at gmail.com>
Post by denis cohen
Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'
Thanks for any help.
Denis
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://paraview.org/Wiki/ParaView
http://public.kitware.com/mailman/listinfo/paraview
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140808/3a7004e3/attachment.html>
Su, Simon M CTR USARMY ARL (US)
2014-08-08 16:01:36 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

Hi Casey,

On a somewhat related topic,
s = Sphere()
sum = 2 + 1
w = DataSetCSVWriter(s, FileName='/tmp/test.csv',
FieldAssociation='Points')
w.UpdatePipeline()
If I want to just write the value of variable sum to a csv file, how would
that be done?

Thanks
-simon




-----Original Message-----
From: ParaView [mailto:paraview-bounces at paraview.org] On Behalf Of Casey
Goodlett
Sent: Friday, August 08, 2014 11:46 AM
To: denis cohen
Cc: paraview
Subject: Re: [Paraview] Writing csv data in python script

I tried this in the binary download of paraview 4.1
s = Sphere()
w = DataSetCSVWriter(s, FileName='/tmp/test.csv',
FieldAssociation='Points')
w.UpdatePipeline()
and successfully had a file written.

You might try explicitly passing your reader as input to the DataSetCSVWriter
rather than relying on the active source.

I am not familiar with partitioned unstructured grid to know if any additional
steps are needed.


good luck



On Fri, Aug 8, 2014 at 11:43 AM, denis cohen <denis.cohen at gmail.com> wrote:


Hi Casey,


I get no error and I read my data with XMLPartitionedUnstructuredGridReader.


Denis




On Fri, Aug 8, 2014 at 5:40 PM, Casey Goodlett <casey.goodlett at kitware.com>
wrote:


Do you get any error messages in the python console or output window?


What type of data does your source produce polydata, unstructured grid, etc?



On Fri, Aug 8, 2014 at 11:30 AM, denis cohen <denis.cohen at gmail.com> wrote:


Hi Casey,

I've tried this like in your suggestion:

SetActiveSource(IntegrateVariables1)
DataSetCSVWriter()
FileName="foo_points.csv"
FieldAssociation = "Points"
UpdatePipeline()


and other similar commands but none produced a csv file. Any hints?

Thanks

Denis




On Tue, Aug 5, 2014 at 7:38 PM, Casey Goodlett <casey.goodlett at kitware.com>
wrote:


Denis,


You could look here
<http://public.kitware.com/gitweb?p=VeloView.git;a=blob;f=VelodyneHDL/python/veloview/applogic.py;h=4a0d7d546fe57c58a5e073964fc97dcaff03a51e;hb=HEAD>
on lines 468-476 for how this is done in VeloView. You can ignore the
rotateCSVFile function call.





On Sat, Aug 2, 2014 at 5:34 AM, denis cohen <denis.cohen at gmail.com> wrote:


Hi,
New to python scripting. How can one output a csv file inside a python
script/macro?
writer = CreateWriter(".../foo.csv", source)
writer.FieldAssociation = "Points" # or "Cells"
writer.UpdatePipeline()
del writer
But I get:
Traceback (most recent call last):
File "<string>", line 173, in <module>
AttributeError: 'str' object has no attribute 'UpdatePipeline'


Thanks for any help.


Denis



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview






--

Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310 <tel:%28919%29%20969-6990%20x310>





--

Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310 <tel:%28919%29%20969-6990%20x310>
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310

Classification: UNCLASSIFIED
Caveats: NONE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 9990 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140808/58c6d35b/attachment-0001.bin>
Casey Goodlett
2014-08-12 21:41:27 UTC
Permalink
I am not aware of any paraview specific way to do that. You could try the
standard python csv module https://docs.python.org/2/library/csv.html or
use numpy savetxt for arrays
http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html.
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140812/e9fe3159/attachment-0001.html>
Su, Simon M CTR USARMY ARL (US)
2014-08-13 16:27:25 UTC
Permalink
Classification: UNCLASSIFIED
Caveats: NONE

I will give it a try.

Thanks Casey,
-simon

-----Original Message-----
From: Casey Goodlett [mailto:casey.goodlett at kitware.com]
Sent: Tuesday, August 12, 2014 5:41 PM
To: Su, Simon M CTR USARMY ARL (US)
Cc: paraview
Subject: Re: [Paraview] Writing csv data in python script (UNCLASSIFIED)

I am not aware of any paraview specific way to do that. You could try the
standard python csv module https://docs.python.org/2/library/csv.html or use
numpy savetxt for arrays
http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html.
--
Casey B. Goodlett, Ph.D.
Technical Leader
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(919) 969-6990 x310

Classification: UNCLASSIFIED
Caveats: NONE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 9990 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140813/380099f5/attachment.bin>
Continue reading on narkive:
Search results for '[Paraview] Writing csv data in python script' (Questions and Answers)
10
replies
what are the must have freeware programs that are safe..or good ones to have?
started 2008-07-31 13:43:35 UTC
security
Loading...