This example computes the so-called cosmic web from a particle dataset (top left inset) modeling dark matter density in large-scale universe formation cosmological simulations. The dataset has been provided by the SciVis contest 2015.
First, a density estimation (with Gaussian kernels) is computed with the filter GaussianResampling, with a modest resolution (64^3, increase for improved details).
Second, the resulting density is slightly smoothed with the filter ScalarFieldSmoother (only 1 iteration).
Third, the density is normalized (in between 0 and 1) with the filter ScalarFieldNormalizer to facilitate the subsequent processing steps.
Next, the data undergoes a first step of simplification with the filter TopologicalSimplificationByPersistence, to remove the least significant extrema (involved in a persistence pair with a persistence smaller than 0.3).
Then, the MorseSmaleComplex is computed and saddle-saddle pairs with a persistence smaller than 0.3 are also simplified.
Finally the geometry of the 1-separatrices and the 2-separatrices are slightly smoothed with the filter GeometrySmoother (10 iterations each). The resulting 1-separatrices are shown before simplification in the top-right inset and after simplification in the bottom-left inset. The bottom-right inset shows the 2-separatrices.
By adjusting the persistence simplification threshold, for the extrema in the filter TopologicalSimplificationByPersistence, for the saddle-saddle pairs in the filter MorseSmaleComplex, the user can explore the patterns of the cosmic web at multiple scales of topological importance.
#!/usr/bin/env python#### import the simple module from the paraviewfromparaview.simpleimport*# ----------------------------------------------------------------# setup the data processing pipelines# ----------------------------------------------------------------# create a new 'XML PolyData Reader'ds14_scivis_0128_e4_dt04_10000vtp=XMLPolyDataReader(FileName=["ds14_scivis_0128_e4_dt04_1.0000.vtp"])# create a new 'Gaussian Resampling'gaussianResampling1=GaussianResampling(Input=ds14_scivis_0128_e4_dt04_10000vtp)gaussianResampling1.ResampleField=["POINTS","DarkMatter_Phi"]gaussianResampling1.ResamplingGrid=[64,64,64]gaussianResampling1.SplatAccumulationMode="Max"gaussianResampling1.GaussianSplatRadius=0.0125gaussianResampling1.ScaleSplats=0# create a new 'TTK ScalarFieldSmoother'tTKScalarFieldSmoother1=TTKScalarFieldSmoother(Input=gaussianResampling1)tTKScalarFieldSmoother1.ScalarField=["POINTS","SplatterValues"]tTKScalarFieldSmoother1.IterationNumber=1# create a new 'TTK ScalarFieldNormalizer'tTKScalarFieldNormalizer1=TTKScalarFieldNormalizer(Input=tTKScalarFieldSmoother1)tTKScalarFieldNormalizer1.ScalarField=["POINTS","SplatterValues"]# create a new 'TTK TopologicalSimplificationByPersistence'tTKTopologicalSimplificationByPersistence1=TTKTopologicalSimplificationByPersistence(Input=tTKScalarFieldNormalizer1)tTKTopologicalSimplificationByPersistence1.InputArray=["POINTS","SplatterValues"]tTKTopologicalSimplificationByPersistence1.PersistenceThreshold=0.3# create a new 'TTK MorseSmaleComplex'tTKMorseSmaleComplex1=TTKMorseSmaleComplex(Input=tTKTopologicalSimplificationByPersistence1)tTKMorseSmaleComplex1.ScalarField=["POINTS","SplatterValues"]tTKMorseSmaleComplex1.ReturnSaddleConnectors=1tTKMorseSmaleComplex1.SaddleConnectorsPersistenceThreshold=0.3tTKMorseSmaleComplex1.Forceloopfreegradient=0# create a new 'Threshold'threshold3=Threshold(Input=OutputPort(tTKMorseSmaleComplex1,1))threshold3.Scalars=["CELLS","SeparatrixType"]threshold3.LowerThreshold=2.0threshold3.UpperThreshold=2.0# create a new 'TTK GeometrySmoother'tTKGeometrySmoother2=TTKGeometrySmoother(registrationName="TTKGeometrySmoother2",Input=threshold3)tTKGeometrySmoother2.IterationNumber=10SaveData("cosmicWeb.vtu",tTKGeometrySmoother2)
To run the above Python script, go to your ttk-data directory and enter the following command: