revanalyzer.metrics.cf.L2

class revanalyzer.metrics.cf.L2(vectorizer, n_threads=1, show_time=False, normalize=True)

Bases: BasicCFMetric

Class describing metric L2.

Input:

vectorizer (CFVectorizer): vectorizer to be used for CF metric;

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

show_time (bool): flag to monitor time cost for large images, default: False;

normalize (bool): flag to control normalization of CF. If True, CF are normalized to satisfy the condition CF(0) = 1. See the details in Karsanina et al. (2021). Compressing soil structural information into parameterized correlation functions. European Journal of Soil Science, 72(2), 561-577. Default: True.

Methods

generate

Generates the correlation function L2 for a specific subsample.

read

Read the metric data generated for a specific subsample.

show

Vizualize the correlation function L2 for a specific subsample.

vectorize

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

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

Generates the correlation function L2 for a specific subsample.

Input:

cut (numpy.ndarray): 3D array representing a subsample;

cut_name (str): name of subsample;

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, step, cut_id)

Vizualize the correlation function L2 for a specific subsample.

Input:

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

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.

Input:

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

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

Output:

Depends on the chosen mode in CFVectorizer.

If mode = ‘all’:

(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.

If mode = ‘max:

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