Skip to content

Commit

Permalink
fixed color bar label
Browse files Browse the repository at this point in the history
  • Loading branch information
rmahfuz authored and drsteve committed Aug 3, 2018
1 parent a6bdd68 commit a9270b9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Scripts/viz/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1) Put all netCDF files for which visulaizations are to be generated in the nc_files directory.
1) Put all netCDF restart files for which visulaizations are to be generated in the nc_files directory.
2) Populate/modify config.txt as desired.
3) Execute 'bash ram.sh'
4) Look for the generated images in the images directory
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
4 changes: 2 additions & 2 deletions Scripts/viz/ram_automate1.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def gen_vts(fileName):
to_write += '\t\t\t\t\t' + str(par_data[i][j][1] + 2*per_data[i][j][1]) + '\n'
to_write += '\t\t\t\t</DataArray>\n'

to_write += '\t\t\t\t<DataArray type="Float32" Name="helium ion pressure" NumberOfComponents="1" format="ascii">\n'
to_write += '\t\t\t\t<DataArray type="Float32" Name="heliumion pressure" NumberOfComponents="1" format="ascii">\n'
for i in range(25):
for j in range(20):
to_write += '\t\t\t\t\t' + str(par_data[i][j][2] + 2*per_data[i][j][2]) + '\n'
to_write += '\t\t\t\t</DataArray>\n'

to_write += '\t\t\t\t<DataArray type="Float32" Name="oxygen ion pressure" NumberOfComponents="1" format="ascii">\n'
to_write += '\t\t\t\t<DataArray type="Float32" Name="oxygenion pressure" NumberOfComponents="1" format="ascii">\n'
for i in range(25):
for j in range(20):
to_write += '\t\t\t\t\t' + str(par_data[i][j][3] + 2*per_data[i][j][3]) + '\n'
Expand Down
40 changes: 25 additions & 15 deletions Scripts/viz/ram_automate2.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,19 @@ def gen_viz(fileName):
# get color transfer function/color map for 'electronpressure'
#pressureLUT = GetColorTransferFunction('electronpressure')
pressureLUT = GetColorTransferFunction(properties['Plasma pressure display'] + 'pressure')
pressureLUT.RescaleOnVisibilityChange = 1

# show data in view
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay = Show(pressure_20130317_T04D_RSCE_GEO_t02000vts, renderView1)
# trace defaults for the display properties.
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.AmbientColor = [0.0, 0.0, 0.0]
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.ColorArrayName = ['POINTS', 'electron pressure']
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.ColorArrayName = ['POINTS', properties['Plasma pressure display'] + 'pressure']
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.LookupTable = pressureLUT
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.OSPRayScaleArray = 'electron pressure'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.OSPRayScaleArray = properties['Plasma pressure display'] + 'pressure'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.SelectOrientationVectors = 'None'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.ScaleFactor = 1.35
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.SelectScaleArray = 'electron pressure'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.SelectScaleArray = properties['Plasma pressure display'] + 'pressure'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.GlyphType = 'Arrow'
pressure_20130317_T04D_RSCE_GEO_t02000vtsDisplay.ScalarOpacityUnitDistance = 2.480431009474945

Expand Down Expand Up @@ -331,13 +332,13 @@ def gen_viz(fileName):
# trace defaults for the display properties.
pointVolumeInterpolator1Display.Representation = 'Outline'
pointVolumeInterpolator1Display.AmbientColor = [0.0, 0.0, 0.0]
pointVolumeInterpolator1Display.ColorArrayName = ['POINTS', 'electron pressure']
pointVolumeInterpolator1Display.ColorArrayName = ['POINTS', properties['Plasma pressure display'] + 'pressure']
pointVolumeInterpolator1Display.LookupTable = pressureLUT
pointVolumeInterpolator1Display.OSPRayScaleArray = 'electron pressure'
pointVolumeInterpolator1Display.OSPRayScaleArray = properties['Plasma pressure display'] + 'pressure'
pointVolumeInterpolator1Display.OSPRayScaleFunction = 'PiecewiseFunction'
pointVolumeInterpolator1Display.SelectOrientationVectors = 'None'
pointVolumeInterpolator1Display.ScaleFactor = 1.35
pointVolumeInterpolator1Display.SelectScaleArray = 'electron pressure'
pointVolumeInterpolator1Display.SelectScaleArray = properties['Plasma pressure display'] + 'pressure'
pointVolumeInterpolator1Display.GlyphType = 'Arrow'
pointVolumeInterpolator1Display.ScalarOpacityUnitDistance = 0.1909188309203679
pointVolumeInterpolator1Display.Slice = 50
Expand All @@ -354,7 +355,7 @@ def gen_viz(fileName):
# create a new 'Clip'
clip1 = Clip(Input=pointVolumeInterpolator1)
clip1.ClipType = 'Plane'
clip1.Scalars = ['POINTS', 'electron pressure']
clip1.Scalars = ['POINTS', properties['Plasma pressure display'] + 'pressure']
clip1.Value = 5.546324253082275

# Rescale transfer function
Expand All @@ -365,26 +366,33 @@ def gen_viz(fileName):

# Properties modified on clip1
clip1.ClipType = 'Sphere'
clip1.ClipType.Radius = 6.75

# show data in view
clip1Display = Show(clip1, renderView1)
# trace defaults for the display properties.
clip1Display.AmbientColor = [0.0, 0.0, 0.0]
clip1Display.ColorArrayName = ['POINTS', 'electron pressure']
clip1Display.ColorArrayName = ['POINTS', properties['Plasma pressure display'] + 'pressure']
clip1Display.LookupTable = pressureLUT
clip1Display.OSPRayScaleArray = 'electron pressure'
clip1Display.OSPRayScaleArray = properties['Plasma pressure display'] + 'pressure'
clip1Display.OSPRayScaleFunction = 'PiecewiseFunction'
clip1Display.SelectOrientationVectors = 'None'
clip1Display.ScaleFactor = 1.35
clip1Display.SelectScaleArray = 'electron pressure'
clip1Display.SelectScaleArray = properties['Plasma pressure display'] + 'pressure'
clip1Display.GlyphType = 'Arrow'
clip1Display.ScalarOpacityUnitDistance = 0.3035512141561865
clip1Display.GaussianRadius = 0.675
clip1Display.SetScaleArray = ['POINTS', 'electron pressure']
clip1Display.SetScaleArray = ['POINTS', properties['Plasma pressure display'] + 'pressure']
clip1Display.ScaleTransferFunction = 'PiecewiseFunction'
clip1Display.OpacityArray = ['POINTS', 'electron pressure']
clip1Display.OpacityArray = ['POINTS', properties['Plasma pressure display'] + 'pressure']
clip1Display.OpacityTransferFunction = 'PiecewiseFunction'

if properties['Plasma pressure display'][-3:] == 'ion':
species = properties['Plasma pressure display'][:-4] + ' ion pressure'
else:
species = properties['Plasma pressure display'] + ' pressure'
ColorBy(clip1Display, ('POINTS', species))

# init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction'
clip1Display.OSPRayScaleFunction.Points = [0.00253301385078493, 0.0, 0.5, 0.0, 553.421725972081, 1.0, 0.5, 0.0]

Expand All @@ -406,7 +414,7 @@ def gen_viz(fileName):
# convert to log space
bLUT.MapControlPointsToLogSpace()

# Properties modified on pressureLUT
# Properties modified on bLUT
bLUT.UseLogScale = 1
bLUT.ApplyPreset('Blues', True)

Expand Down Expand Up @@ -450,14 +458,14 @@ def gen_viz(fileName):
bLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
bLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
#bLUTColorBar.AspectRatio = 25
bLUTColorBar.add_attribute('AspectRatio', 90)
bLUTColorBar.add_attribute('AspectRatio', 130)
pressureLUTColorBar = GetScalarBar(pressureLUT, renderView1)
pressureLUTColorBar.TitleFontSize = 7
pressureLUTColorBar.LabelFontSize = 7
pressureLUTColorBar.TitleColor = [0.0, 0.0, 0.0]
pressureLUTColorBar.LabelColor = [0.0, 0.0, 0.0]
#pressureLUTColorBar.AspectRatio = 25
pressureLUTColorBar.add_attribute('AspectRatio', 90)
pressureLUTColorBar.add_attribute('AspectRatio', 130)

bLUT.add_attribute('Position2', [200,900])

Expand All @@ -479,6 +487,8 @@ def gen_viz(fileName):
renderView1.AxesGrid.ZLabelColor = [0.0, 0.0, 0.0]
renderView1.AxesGrid.ZLabelFontSize = 9

renderView1.ViewSize = [600, 600]
#renderView1.add_attribute('ViewSize', [400, 400])
SaveScreenshot('images/' + fileName + '_viz.png', magnification=1.75, quality=600, view=renderView1)
#========================================================================================================
if __name__ == '__main__':
Expand Down

0 comments on commit a9270b9

Please sign in to comment.