File size: 1,545 Bytes
4fe94e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys
import os

# Add the topology directory to Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))

from topologyScoring import pointCloudGeometryScore

def evaluateQmcpackCriticalPoints(gtFilename : str, reconFilename : str, verbose : bool = False):
    """
    Given two sets of critical points, return a similarity score from 0-10.
    
    A score of 0 is considered bad and a score of 10 is considered good.

    Args:
        gtPointsFile: The name of a file in legacy VTK format (.vtk) that stores the locations of each critical point
                      in the ground truth data. It should also have a point array called "CriticalType". It should assign
                      values as follows: 0: minimum. 1: 1-saddle. 2: 2-saddle. 3: maximum. 4: degenerate critical point.
        reconPointsFile: The name of a file in legacy VTK format (.vtk) that stores the locations and degeneracy types
                         of each point in the reconstructed data.
        verbose: Should error messages be printed if there are issues with the input files.
    """
    return pointCloudGeometryScore(gtFilename, "CriticalType", reconFilename, "CriticalType", verbose)

if __name__ == "__main__":

    if len(sys.argv) != 3:
        print(f"{os.path.basename(__file__)}: usage is 'python3 {os.path.basename(__file__)} gt_points.vtk recon_points.vtk'")
        exit(1)

    score = evaluateQmcpackCriticalPoints(sys.argv[1], sys.argv[2], verbose=True)

    print(f"These critical points scored: {score}")