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

[General] Python script: Auto-scale color scale

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By julien.decharentenay

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 3, 2013, 20:50
Default Python script: Auto-scale color scale
  #1
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 18
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Hi,

I am puzzled as to how to auto-scale the color scale when using python script to load and display variables.

When saving to a Python script, the RGBPoints variable explicitly nominates the upper and lower scale values (and associated colors) as shown below:

Code:
integrationTime_PVLookupTable = GetLookupTableForArray( "IntegrationTime", 1, Discretize=1, RGBPoints=[-0.722103597630862, 0.23, 0.299, 0.754, 0.5209744105817566, 0.706, 0.016, 0.15], UseLogScale=0, VectorComponent=0, NanColor=[0.25, 0.0, 0.0], NumberOfTableValues=256, EnableOpacityMapping=0, ColorSpace='Diverging', IndexedLookup=0, VectorMode='Magnitude', ScalarOpacityFunction=integrationTime_PiecewiseFunction, HSVWrap=0, ScalarRangeInitialized=1.0, AllowDuplicateScalars=1, Annotations=[], LockScalarRange=0 )
Is there a easy way to have autoscaling or retrieve the upper and lower field limits from the Python script?
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Old   December 8, 2013, 15:17
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
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 Julien,

Have a look into this post: http://www.cfd-online.com/Forums/ope...tml#post446333 post #6

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   December 9, 2013, 06:39
Default
  #3
Senior Member
 
Julien de Charentenay
Join Date: Jun 2009
Location: Australia
Posts: 231
Rep Power: 18
julien.decharentenay is on a distinguished road
Send a message via Skype™ to julien.decharentenay
Thanks Bruno. You're a champ - as usual.

I actually went through the thread as I was looking for a solution, but missed it (wrong assumption that it was more relevant for GUI based operation)...

For my reference, the bit of code is as follows:

Code:
    data = source.GetCellDataInformation()
    #data = source.GetPointDataInformation()

    #get the array and the respective min-max
    array = data.GetArray(arrayName)
    dataRange = array.GetRange(component)

    lookupTable.LockScalarRange = 1

    #Now let's hack in the range values
    lookupTable.RGBPoints[0] = dataRange[0] #min
    lookupTable.RGBPoints[4] = dataRange[1] #max
wyldckat likes this.
__________________
---
Julien de Charentenay
julien.decharentenay is offline   Reply With Quote

Reply

Tags
autoscale, pvbatch, python


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
[OpenFOAM] Using python script for automatic post processing of openFoam vPaquet ParaView 12 December 16, 2021 04:30
[General] Generating isosurface from vtk file with python script Leios ParaView 1 March 26, 2018 13:33
python script to create geometry for salome, and then mesh 6863523 Mesh Generation & Pre-Processing 4 March 18, 2017 10:00
[General] Transfer variables into python script from bash-shell cfdFreshman ParaView 0 December 3, 2015 04:33
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 10:36


All times are GMT -4. The time now is 11:32.