multidim

The multidim class provides user-facing tools for topological data analysis of multi-dimensional data.

The goal is to be honest about topology while also using speed/cleverness with a minimal amount of user headache.

Included are:

Examples

>>> X = np.load("tests/circle.npy")
>>> pc = PointCloud(X, max_length=-1)
>>> pc
A SimplicialComplex with 1000 points, 499500 edges, and 0 faces.
>>> np.all(pc.stratum[0]['pos'].values == True)
True
>>> pc.check()
>>> pc.make_pers0(cutoff=0.15)
>>> for v in pc.cells(0):
...     if v.positive:
...         print(v)
0+ Simplex 0 of height 0.0 and mass 1.0
0+ Simplex 74 of height 0.0 and mass 1.0
0+ Simplex 183 of height 0.0 and mass 1.0
0+ Simplex 195 of height 0.0 and mass 1.0
0+ Simplex 197 of height 0.0 and mass 1.0
0+ Simplex 231 of height 0.0 and mass 1.0
0+ Simplex 354 of height 0.0 and mass 1.0
0+ Simplex 397 of height 0.0 and mass 1.0
0+ Simplex 489 of height 0.0 and mass 1.0
0+ Simplex 530 of height 0.0 and mass 1.0
0+ Simplex 607 of height 0.0 and mass 1.0
0+ Simplex 757 of height 0.0 and mass 1.0
0+ Simplex 781 of height 0.0 and mass 1.0
0+ Simplex 800 of height 0.0 and mass 1.0
0+ Simplex 903 of height 0.0 and mass 1.0
0+ Simplex 980 of height 0.0 and mass 1.0
>>> pc.pers0.grab(5)['keepcode']
     birth_index  death_index  birth     death      pers
979          213          316    0.0  0.136923  0.136923
980          135          135    0.0  0.136992  0.136992
981          439          477    0.0  0.138059  0.138059
982          610          630    0.0  0.138474  0.138474
983          603          603    0.0  0.139332  0.139332
>>> pc.make_pers1_rca1(cutoff=0.2)
>>> pc.pers1.grab(5)['keepcode']
     birth_index  death_index     birth     death      pers
221         3217         9700  0.095619  0.168120  0.072501
220         2942         9661  0.091542  0.167720  0.076177
219         2713         9279  0.087438  0.164152  0.076713
224         3333        10439  0.097564  0.174643  0.077079
200         1816         7688  0.071490  0.149336  0.077846
>>> V=pc.stratum[0]
>>> V.loc[:10]
    height  mass    pos  rep
0      0.0   1.0   True    0
1      0.0   1.0  False    0
2      0.0   1.0  False    1
3      0.0   1.0  False    0
4      0.0   1.0  False    0
5      0.0   1.0  False    4
6      0.0   1.0  False    1
7      0.0   1.0  False    0
8      0.0   1.0  False    0
9      0.0   1.0  False    0
10     0.0   1.0  False    1
>>> pc.cells(0)[0]
0+ Simplex 0 of height 0.0 and mass 1.0
>>> pc.cells(0)[2]
0- Simplex 2 of height 0.0 and mass 1.0
>>> E=pc.stratum[1]
>>> E.loc[:10]
      height    pos  rep  bdy0  bdy1
0   0.001142  False    0   858   866
1   0.001997  False    1    98   187
2   0.002471  False    2   251   313
3   0.002670  False    3   599   629
4   0.002766  False    4   150   167
5   0.003405  False    5   573   620
6   0.003812  False    6   474   517
7   0.005357  False    7   893   988
8   0.005533  False    8   623   644
9   0.005914  False    9   648   744
10  0.006056  False   10   612   640
>>> pc.cells(1)[2]
1- Simplex 2 of height 0.0024707293775457456 and mass None

Functions

lower_star_for_image(img_array) Compute the lower star weighted simplicial complex from a 2d grid/image.
stratum_from_distances(dists[, max_length, …]) Construct a stratum dictionary from a symmetric matrix of distances.
stratum_maker([dim]) Make an empty stratum pandas.DataFrame of the appropriate dimension.

Classes

PointCloud(data_array[, max_length, …]) PointCloud is a class for embedded, weighted simplicial complexes.
Simplex(cellcomplex, dim, index) This class is a convenient container to access the data in the pd DataFrame stratum[dim] of a SimplicialComplex.
SimplexStratum(cell_complex, dim) SimplexStratum is a thin class for calling Simplex objects of a certain dimension from a SimplicialComplex.
SimplicialComplex([stratum]) A class for abstract weighted simplicial complexes.