Persistence Diagram Dictionary¶
Pipeline description¶
This example describes the usage of the dictionary of persistence diagrams for the topological analysis of ensemble data.
First, an ensemble of scalar fields is loaded from a cinema database.
Then, the PersistenceDiagram is computed for each scalar field.
All these diagrams are passed to PersistenceDiagramDictionary to compute:
- an ensemble of atom diagrams called dictionary,
- a set of barycentric weights (for each diagram), which can be interpreted as coordinates in the above dictionary.
This dictionary and those weights will then be used to compute barycenters of persistence diagrams as approximations of the input diagrams by using PersistenceDiagramDictionaryDecoding. The mentioned barycenters are computed using the algorithm implemented in PersistenceDiagramClustering.
The algorithm uses a classical gradient descent to optimize both outputs. It can also use a progressive approach to further facilitate the optimization.
The above screenshot presents a visual comparison between three input diagrams (center, left) and their respective approximations (center, right). Furthermore, we also have a planar visualization of the computed barycenters (colored spheres) and the dictionary (atoms are represented with black spheres).
The python script below computes the dictionary and the barycentric weights. Then, it saves the dictionary in a multiblock dataset and the weights in a .csv file.
ParaView¶
To reproduce the above screenshot, go to your ttk-data directory and enter the following command:
paraview states/persistenceDiagramDictionary.pvsm
Python code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
To run the above Python script, go to your ttk-data directory and enter the following command:
pvpython python/persistenceDiagramDictionary.py
Inputs¶
- Isabel.cdb: a cinema database containing 12 volumetric scalar fields (defined on regular grids).
Outputs¶
PD-Dictionary_dict.vtm: the output dictionary (i.e., set of atom diagrams).PD-Dictionary_weights.csv: the output weights (the coordinate of the input ensemble in the dictionary).