revanalyzer.metrics.pd.PD0

class revanalyzer.metrics.pd.PD0(vectorizer, n_threads=1, show_time=False)

Bases: BasicPDMetric

Class describing metric PD of rank 0.

Input:

vectorizer (SimpleBinningVectorizer, PersistenceImageVectorizer, LandscapeVectorizer or SilhouetteVectorizer object): vectorizer to be used for PD metric;

n_threads (int): number of threads used for data generation;

show_time (bool): flag to monitor time cost for large images.

Methods

generate

Generates the PD of rank 0 for a specific subcube.

read

Read the metric data generated for a specific subsample.

show

Vizualize the PD of rank 0 for a specific subcube.

vectorize

Vectorize the vector metric values for a given pair of subsamples using the method of vectorizer.

generate(cut, cut_name, outputdir, gendatadir=None)

Generates the PD of rank 0 for a specific subcube.

Input:

cut (numpy.ndarray): subsample;

cut_name (str): name of subcube;

outputdir (str): output folder.

read(inputdir, step, cut_id)

Read the metric data generated for a specific subsample.

Input:

inputdir (str): path to the folder containing image;

step (int): subsamples selection step;

cut_id (int: 0,..8): cut index.

Output:

metric value (float or np.array(dtype=’float’)).

show(inputdir, cut_step, cut_id)

Vizualize the PD of rank 0 for a specific subcube.

Input:

inputdir (str): path to the folder containing generated metric data for subcubes;

cut_step (int): subsamples selection step;

cut_id (int: 0,..8): cut index.

vectorize(v1, v2)

Vectorize the vector metric values for a given pair of subsamples using the method of vectorizer.

Input:

v1 (list(dtype = float)): data for the first subsample;

v2 (list(dtype = float)): data for the second subsample.

Output:

(list(dtype = float), list(dtype = float), float) - a tuple, in which the first two elements are vectorized metric values for a given pair of subsamples, and the last one is the normalized distance between these vectors.