我正在Paraview中可视化空间数据的时间序列,我想让我的设置脚本根据整个时间序列上的字段范围为给定字段设置颜色表,而不是单个快照。我尝试用脚本计算的值来初始化查找表,但是没有用。
下图显示了运行我的设置脚本的结果。Python Shell窗口中的值是比例应设置的值,但颜色栏显示另一个值。
我的设置脚本的相关部分在这里。
# get the scales for the surface fields
mag_os_xdmf = FindSource('mag_os.xdmf')
with h5py.File(mag_os_xdmf.FileName.replace('xdmf', 'h5'), 'r') as h5:
for comp in ('br', 'bt', 'bp'):
scale = np.abs(h5[comp].value).max()
print(comp, scale)
ctab = [-scale, 0.23137254901960785, 0.2980392156862745, 0.7529411764705882,
scale, 0.7058823529411765, 0.01568627450980392, 0.14901960784313725]
DataRep = GetDisplayProperties(mag_os_xdmf)
lut = GetLookupTableForArray(comp, 1, NanColor=[0.24705882352941178, 0.0, 0.0],
RGBPoints = ctab, ColorSpace='Diverging' )
DataRep.ColorArrayName = ('POINT_DATA', comp)
DataRep.LookupTable = lut
Render()
为了便于比较,下面是我手动更改颜色栏时的python跟踪输出
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
mag_os_xdmf = GetActiveSource()
DataRepresentation6 = GetDisplayProperties(mag_os_xdmf)
a1_br_PVLookupTable = GetLookupTableForArray( "br", 1, RGBPoints=[-0.122, 0.23, 0.299, 0.754, 0.122, 0.706, 0.016, 0.15] )
DataRepresentation6.ScalarOpacityFunction = []
DataRepresentation6.ColorArrayName = ('POINT_DATA', 'br')
DataRepresentation6.LookupTable = a1_br_PVLookupTable
Render()
发布于 2016-06-08 22:32:18
您应该能够执行以下操作:
# get color transfer function/color map for 'br'
lut = GetColorTransferFunction('br')
# get opacity transfer function/opacity map for 'br'
opacityLut = GetOpacityTransferFunction('br')
# Rescale transfer function
lut.RescaleTransferFunction(-scale, scale)
# Rescale transfer function
opacityLut.RescaleTransferFunction(-scale, scale)
https://stackoverflow.com/questions/37571716
复制相似问题