tmd.Topology.statistics

TMD statistical analysis on PH diagrams algorithms implementation.

Functions

get_bifurcations(ph)

Return the bifurcations from the diagram.

get_lengths(ph)

Return the lengths of the bars from the diagram.

get_terminations(ph)

Return the terminations from the diagram.

get_total_length(ph)

Calculate the total length of a barcode.

nosify(var[, noise])

Adds noise to an instance of data.

transform_ph_from_length(ph[, keep_side])

Transform a persistence diagram into a (end_point, length) equivalent diagram.

transform_ph_to_length(ph[, keep_side])

Transform a persistence diagram into a (end, length) equivalent diagram.

tmd.Topology.statistics.get_bifurcations(ph)

Return the bifurcations from the diagram.

tmd.Topology.statistics.get_lengths(ph)

Return the lengths of the bars from the diagram.

tmd.Topology.statistics.get_terminations(ph)

Return the terminations from the diagram.

tmd.Topology.statistics.get_total_length(ph)

Calculate the total length of a barcode.

The total length is computed by summing the length of each bar. This should be equivalent to the total length of the tree if the barcode represents path distances.

tmd.Topology.statistics.nosify(var, noise=0.1)

Adds noise to an instance of data.

Can be used with a ph as follows:

noisy_pd = [add_noise(d, 1.0) if d[0] != 0.0
            else [d[0],add_noise([d[1]],1.0)[0]] for d in pd]

To output the new pd:

F = open(...)
for d in noisy_pd:
    towrite = '%f, %f\n'%(d[0],d[1])
    F.write(towrite)
F.close()
tmd.Topology.statistics.transform_ph_from_length(ph, keep_side='end')

Transform a persistence diagram into a (end_point, length) equivalent diagram.

If keep_side == “start”, return a (start_point, length) diagram.

Note

The direction of the diagram will be lost!

tmd.Topology.statistics.transform_ph_to_length(ph, keep_side='end')

Transform a persistence diagram into a (end, length) equivalent diagram.

If keep_side == “start”, return a (start_point, length) diagram.

Note

The direction of the diagram will be lost!