Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

swh:1:snp:5c760c247cec42eef2064c5ff8a2fde4e71dfb7a
  • Code
  • Branches (1)
  • Releases (1)
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • v1.0.0
  • 60be01a
  • /
  • docs
  • /
  • scripts
  • /
  • figure_jet_bounds.py
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
content badge
swh:1:cnt:cb048a4f423cc98a44e94317e78452069a43e338
directory badge
swh:1:dir:08ef0cf7b60fda093cbbc11510ff1ce9206202c8
revision badge
swh:1:rev:e0203c82702b3dce63effdda1606d58181e829a0
snapshot badge
swh:1:snp:5c760c247cec42eef2064c5ff8a2fde4e71dfb7a

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: e0203c82702b3dce63effdda1606d58181e829a0 authored by Moritz Heinemann on 12 November 2024, 19:30:39 UTC
VofFlow 1.0
Tip revision: e0203c8
figure_jet_bounds.py
import os
from paraview.simple import *

# Config
dataset = '~/vofflow/output/result/bound_gap_smoothed.vtp'
plugin_path = '~/vofflow/install/lib/paraview-5.12/plugins/VofFlow/VofFlow.so'
output_path = '~/vofflow/output/fig_jet_bound.png'

label_jet = 15  # Use 20 for full dataset, 20 for "ds1", and 15 for "ds2"
label_drop = 8  # Use 12 for full dataset, 12 for "ds1", and 8 for "ds2"

# Load plugin
LoadPlugin(os.path.expanduser(plugin_path), ns=globals())

LoadPalette(paletteName='WhiteBackground')

renderView1 = GetActiveViewOrCreate('RenderView')

# Read smoothed bound data
reader = XMLPolyDataReader(registrationName='bounds', FileName=[os.path.expanduser(dataset)])
reader.PointArrayStatus = ['Labels', 'Normals']

# Cutout jet label
threshold1 = Threshold(registrationName='Threshold1', Input=reader)
threshold1.Scalars = ['POINTS', 'Labels']
threshold1.LowerThreshold = label_jet
threshold1.UpperThreshold = label_jet

# Mirror for esthetic reasons, that jets flows from left to right in image
reflect1 = Reflect(registrationName='Reflect1', Input=threshold1)
reflect1.Plane = 'Z Min'
reflect1.CopyInput = 0
reflect1.FlipAllInputArrays = 0

# Cut bounds in mirror plane to view "into" them
clip1 = Clip(registrationName='Clip1', Input=reflect1)
clip1.ClipType = 'Plane'
clip1.ClipType.Normal = [0.0, 0.0, 1.0]

# Cutout drop label
threshold2 = Threshold(registrationName='Threshold2', Input=reader)
threshold2.Scalars = ['POINTS', 'Labels']
threshold2.LowerThreshold = label_drop
threshold2.UpperThreshold = label_drop

# Mirror for esthetic reasons, that jets flows from left to right in image
reflect2 = Reflect(registrationName='Reflect2', Input=threshold2)
reflect2.Plane = 'Z Min'
reflect2.CopyInput = 0
reflect2.FlipAllInputArrays = 0

# Cut bounds in mirror plane to view "into" them
clip2 = Clip(registrationName='Clip2', Input=reflect2)
clip2.ClipType = 'Plane'
clip2.ClipType.Normal = [0.0, 0.0, 1.0]

# Render
color_jet = [1.0, 0.4980392156862745, 0.054901960784313725]
color_drop = [0.12156862745098039, 0.4666666666666667, 0.7058823529411765]

clip1Display = Show(clip1, renderView1, 'UnstructuredGridRepresentation')
clip1Display.Representation = 'Surface'
clip1Display.ColorArrayName = [None, '']
clip1Display.AmbientColor = color_jet
clip1Display.DiffuseColor = color_jet
clip1Display.Specular = 0.5
clip1Display.SpecularPower = 25.0
clip1Display.SelectNormalArray = 'Normals'

clip2Display = Show(clip2, renderView1, 'UnstructuredGridRepresentation')
clip2Display.Representation = 'Surface'
clip2Display.ColorArrayName = [None, '']
clip2Display.AmbientColor = color_drop
clip2Display.DiffuseColor = color_drop
clip2Display.Specular = 0.5
clip2Display.SpecularPower = 25.0
clip2Display.SelectNormalArray = 'Normals'

# Camera setup
renderView1.ViewSize = [2400, 800]
renderView1.ResetActiveCameraToPositiveZ()
renderView1.ResetCamera(False)
renderView1.CameraPosition = [0.29, -0.024, 0.4]
renderView1.CameraFocalPoint = [0.29, -0.024, 0.0]
renderView1.CameraViewUp = [0.0, 1.0, 0.0]
renderView1.OrientationAxesVisibility = 0
renderView1.Update()

# Save screenshot
output_path = os.path.expanduser(output_path)
os.makedirs(os.path.dirname(output_path), exist_ok=True)
SaveScreenshot(output_path, renderView1, ImageResolution=[2400, 800])

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API