CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] WriteImage of XYplot when script running = problem.

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2014, 13:12
Default WriteImage of XYplot when script running = problem.
  #1
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
Hi all,

I really hope someone can help me because I have spent more than 2 days trying to solve this issue by different ways.

I am using paraview 3.10.1 64 bits over the HPC platform. In a point of the postprocess, I perform a double slice by plane over the domain to obtain a line with the data that I want. Then I want to use Plot Data to represent the velocity distribution in relation to the height.
Inside the attached script, I export the data to csv OK but the image is not correctly saved with writeImage.
But when the script has finished and then I write in the python shell the same command, the image is correctly saved.

It seems like a problem when saving images while a python script is running, but only with XYploy because for other types of images ( 3D Views), it works correctly.

Thank you very much for your help.

Best Regards
Attached Images
File Type: jpg test_nok.jpg (11.0 KB, 7 views)
File Type: jpg test_ok.jpg (30.3 KB, 9 views)
Attached Files
File Type: txt XY_forum.txt (3.4 KB, 16 views)
be_inspired is offline   Reply With Quote

Old   February 22, 2014, 13:44
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings be_inspired,

Very nice script! Many thanks for sharing!

OK, I've taken a look into the script code and my guess is that you should change this:
Code:
    DataRepresentation20.SeriesLineStyle = ['Hub', '2']
    time.sleep(5)
    Render()

    WriteImage("XY/"+f[0]+"_UxVerticalDistribution.png", view = XYChartView1)
To this:
Code:
    DataRepresentation20.SeriesLineStyle = ['Hub', '2']
    Render()
    time.sleep(5)

    WriteImage("XY/"+f[0]+"_UxVerticalDistribution.png", view = XYChartView1)
Namely to call sleep only after the render call, since it takes a little to render the data.

But without test data and a simpler test example, I'm not able to test this myself... or at least not very quickly

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   March 3, 2014, 05:52
Default
  #3
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
Thank you Bruno,

I have tried it without success. I have also tried the script into another linux machine ( with a graphic card) and now the output png file is all in black. I thought that maybe it could be related to the mesa graphic libraries, it seems that it is not, but now I do not know what to try.
be_inspired is offline   Reply With Quote

Old   March 3, 2014, 07:04
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Montero,

Like I wrote in the other post, without a simple test case, I'm not able to test this myself.

The one suggestion that does come to mind is to try and export to JPG instead of PNG. I've had some issues in the past with exporting to PNG, possibly due to a "libpng.so" conflict.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   March 3, 2014, 08:59
Default
  #5
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
Here I upload a simple csv file ( remove the final txt extension).
I have the same problem when I want to execute a python script that reads the csv file, plot the U:0 versus Height ( for example) and then, that plot is saved as a screenshot with "writeimage".
If after the script has ended I execute a single python script where I have only the line of writeimage, the screenshots is correctly obtained.

Thank you for your time

New news: I have tried with WriteAnimation instead of WriteImage and now the ouput is correct but I have 1 file per time step . The scrip loads the time 0 and the last time, so the required time to run the script is multiplied.

O am working with PV 3.12.0 and also with PV3.10.1. May it be some type of bug with writeImage when dealing with XYplot? WriteImage for 3D Views works ok.
Other possibility is that with "writeAnimation" the view is forces to be rendered and with WriteImage is not forced and I do not know how to do it.
Attached Files
File Type: txt csvtoPNG.csv.txt (4.7 KB, 3 views)
be_inspired is offline   Reply With Quote

Old   March 4, 2014, 11:12
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
The following script worked for me in ParaView 3.12.0:
Code:
from paraview.simple import *

csvtoPNG_csv = CSVReader( FileName=['/home/user/Montero/csvtoPNG.csv'] )
csvtoPNG_csv.FieldDelimiterCharacters = ';'
UpdatePipeline()
SetActiveSource(csvtoPNG_csv)

XYChartView1 = CreateXYPlotView()
XYChartView1.ViewTime = 0.0

PlotData1 = PlotData()
SetActiveSource(PlotData1)
DataRepresentation2 = Show()
DataRepresentation2.XArrayName = 'U:0'
DataRepresentation2.SeriesColor = ['U:1', '0.894118', '0.101961', '0.109804', 'U:2', '0.215686', '0.494118', '0.721569', 'Height', '0.301961', '0.686275', '0.290196']
DataRepresentation2.AttributeType = 'Row Data'
DataRepresentation2.SeriesVisibility = ['vtkOriginalIndices', '0', 'U:1', '0', 'U:2', '0', 'Height', '0']
UpdatePipeline()

AnimationScene1 = GetAnimationScene()
AnimationScene1.ViewModules = [ XYChartView1 ]
Render()

WriteImage('/home/user/Montero/test2.jpg')
Using pvpython and pvbatch also worked for me:
Code:
pvpython ./simple_test.py
pvbatch ./simple_test.py
Keep in mind that I used in the local machine, with graphical interface, not remotely.

I didn't need to use a call to "sleep()", because I believe that the trick might be to use "UpdatePipeline()", but you'll have to test this yourself, to confirm if it works properly for you as well.
wyldckat is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem About Running Fluent In Linux mitra FLUENT 18 June 20, 2019 02:11
Problem running movingCylinders case in parallel with foam-extend-3.1 mhkenergy OpenFOAM Running, Solving & CFD 5 March 3, 2017 05:20
ANSYS Licensing Problem, Processes Running but Showing as Not Running penguinman ANSYS 3 September 27, 2016 13:30
Running salome-meca from a java script Iche_Bins Structural Mechanics 0 October 9, 2013 06:44
Running Matlab script from Scheme code dhimans Fluent UDF and Scheme Programming 0 July 28, 2009 15:13


All times are GMT -4. The time now is 20:45.