|
[Sponsors] |
[General] WriteImage of XYplot when script running = problem. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 20, 2014, 13:12 |
WriteImage of XYplot when script running = problem.
|
#1 |
Senior Member
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17 |
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 |
|
February 22, 2014, 13:44 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
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) Code:
DataRepresentation20.SeriesLineStyle = ['Hub', '2'] Render() time.sleep(5) WriteImage("XY/"+f[0]+"_UxVerticalDistribution.png", view = XYChartView1) 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 |
|
March 3, 2014, 05:52 |
|
#3 |
Senior Member
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17 |
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. |
|
March 3, 2014, 07:04 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
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 |
|
March 3, 2014, 08:59 |
|
#5 |
Senior Member
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17 |
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. |
|
March 4, 2014, 11:12 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
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') Code:
pvpython ./simple_test.py pvbatch ./simple_test.py 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. |
|
|
|
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 |