multipers 2.2.3__cp312-cp312-win_amd64.whl → 2.3.0__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of multipers might be problematic. Click here for more details.

Files changed (182) hide show
  1. multipers/__init__.py +33 -31
  2. multipers/_signed_measure_meta.py +430 -430
  3. multipers/_slicer_meta.py +211 -212
  4. multipers/data/MOL2.py +458 -458
  5. multipers/data/UCR.py +18 -18
  6. multipers/data/graphs.py +466 -466
  7. multipers/data/immuno_regions.py +27 -27
  8. multipers/data/pytorch2simplextree.py +90 -90
  9. multipers/data/shape3d.py +101 -101
  10. multipers/data/synthetic.py +113 -111
  11. multipers/distances.py +198 -198
  12. multipers/filtration_conversions.pxd.tp +84 -84
  13. multipers/filtrations/__init__.py +18 -0
  14. multipers/filtrations/filtrations.py +289 -0
  15. multipers/filtrations.pxd +224 -224
  16. multipers/function_rips.cp312-win_amd64.pyd +0 -0
  17. multipers/function_rips.pyx +105 -105
  18. multipers/grids.cp312-win_amd64.pyd +0 -0
  19. multipers/grids.pyx +350 -350
  20. multipers/gudhi/Persistence_slices_interface.h +132 -132
  21. multipers/gudhi/Simplex_tree_interface.h +239 -245
  22. multipers/gudhi/Simplex_tree_multi_interface.h +516 -561
  23. multipers/gudhi/cubical_to_boundary.h +59 -59
  24. multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -450
  25. multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -1070
  26. multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -579
  27. multipers/gudhi/gudhi/Debug_utils.h +45 -45
  28. multipers/gudhi/gudhi/Fields/Multi_field.h +484 -484
  29. multipers/gudhi/gudhi/Fields/Multi_field_operators.h +455 -455
  30. multipers/gudhi/gudhi/Fields/Multi_field_shared.h +450 -450
  31. multipers/gudhi/gudhi/Fields/Multi_field_small.h +531 -531
  32. multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +507 -507
  33. multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +531 -531
  34. multipers/gudhi/gudhi/Fields/Z2_field.h +355 -355
  35. multipers/gudhi/gudhi/Fields/Z2_field_operators.h +376 -376
  36. multipers/gudhi/gudhi/Fields/Zp_field.h +420 -420
  37. multipers/gudhi/gudhi/Fields/Zp_field_operators.h +400 -400
  38. multipers/gudhi/gudhi/Fields/Zp_field_shared.h +418 -418
  39. multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -337
  40. multipers/gudhi/gudhi/Matrix.h +2107 -2107
  41. multipers/gudhi/gudhi/Multi_critical_filtration.h +1038 -1038
  42. multipers/gudhi/gudhi/Multi_persistence/Box.h +171 -171
  43. multipers/gudhi/gudhi/Multi_persistence/Line.h +282 -282
  44. multipers/gudhi/gudhi/Off_reader.h +173 -173
  45. multipers/gudhi/gudhi/One_critical_filtration.h +1432 -1431
  46. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +769 -769
  47. multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +686 -686
  48. multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +842 -842
  49. multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1350 -1350
  50. multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1105 -1105
  51. multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +859 -859
  52. multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +910 -910
  53. multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +139 -139
  54. multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +230 -230
  55. multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +211 -211
  56. multipers/gudhi/gudhi/Persistence_matrix/boundary_cell_position_to_id_mapper.h +60 -60
  57. multipers/gudhi/gudhi/Persistence_matrix/boundary_face_position_to_id_mapper.h +60 -60
  58. multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +136 -136
  59. multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +190 -190
  60. multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +616 -616
  61. multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +150 -150
  62. multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +106 -106
  63. multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +219 -219
  64. multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +327 -327
  65. multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1140 -1140
  66. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +934 -934
  67. multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +934 -934
  68. multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +980 -980
  69. multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1092 -1092
  70. multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +192 -192
  71. multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +921 -921
  72. multipers/gudhi/gudhi/Persistence_matrix/columns/small_vector_column.h +1093 -1093
  73. multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +1012 -1012
  74. multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1244 -1244
  75. multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +186 -186
  76. multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +164 -164
  77. multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +156 -156
  78. multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +376 -376
  79. multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +540 -540
  80. multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -118
  81. multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -173
  82. multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -128
  83. multipers/gudhi/gudhi/Persistent_cohomology.h +745 -745
  84. multipers/gudhi/gudhi/Points_off_io.h +171 -171
  85. multipers/gudhi/gudhi/Simple_object_pool.h +69 -69
  86. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +463 -463
  87. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -83
  88. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +106 -106
  89. multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -277
  90. multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -62
  91. multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -27
  92. multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +62 -62
  93. multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +157 -157
  94. multipers/gudhi/gudhi/Simplex_tree.h +2794 -2794
  95. multipers/gudhi/gudhi/Simplex_tree_multi.h +152 -163
  96. multipers/gudhi/gudhi/distance_functions.h +62 -62
  97. multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -104
  98. multipers/gudhi/gudhi/persistence_interval.h +253 -253
  99. multipers/gudhi/gudhi/persistence_matrix_options.h +170 -170
  100. multipers/gudhi/gudhi/reader_utils.h +367 -367
  101. multipers/gudhi/mma_interface_coh.h +256 -255
  102. multipers/gudhi/mma_interface_h0.h +223 -231
  103. multipers/gudhi/mma_interface_matrix.h +284 -282
  104. multipers/gudhi/naive_merge_tree.h +536 -575
  105. multipers/gudhi/scc_io.h +310 -289
  106. multipers/gudhi/truc.h +890 -888
  107. multipers/io.cp312-win_amd64.pyd +0 -0
  108. multipers/io.pyx +711 -711
  109. multipers/ml/accuracies.py +90 -90
  110. multipers/ml/convolutions.py +520 -520
  111. multipers/ml/invariants_with_persistable.py +79 -79
  112. multipers/ml/kernels.py +176 -176
  113. multipers/ml/mma.py +713 -714
  114. multipers/ml/one.py +472 -472
  115. multipers/ml/point_clouds.py +352 -346
  116. multipers/ml/signed_measures.py +1589 -1589
  117. multipers/ml/sliced_wasserstein.py +461 -461
  118. multipers/ml/tools.py +113 -113
  119. multipers/mma_structures.cp312-win_amd64.pyd +0 -0
  120. multipers/mma_structures.pxd +127 -127
  121. multipers/mma_structures.pyx +4 -4
  122. multipers/mma_structures.pyx.tp +1085 -1085
  123. multipers/multi_parameter_rank_invariant/diff_helpers.h +84 -93
  124. multipers/multi_parameter_rank_invariant/euler_characteristic.h +97 -97
  125. multipers/multi_parameter_rank_invariant/function_rips.h +322 -322
  126. multipers/multi_parameter_rank_invariant/hilbert_function.h +769 -769
  127. multipers/multi_parameter_rank_invariant/persistence_slices.h +148 -148
  128. multipers/multi_parameter_rank_invariant/rank_invariant.h +369 -369
  129. multipers/multiparameter_edge_collapse.py +41 -41
  130. multipers/multiparameter_module_approximation/approximation.h +2296 -2295
  131. multipers/multiparameter_module_approximation/combinatory.h +129 -129
  132. multipers/multiparameter_module_approximation/debug.h +107 -107
  133. multipers/multiparameter_module_approximation/format_python-cpp.h +286 -286
  134. multipers/multiparameter_module_approximation/heap_column.h +238 -238
  135. multipers/multiparameter_module_approximation/images.h +79 -79
  136. multipers/multiparameter_module_approximation/list_column.h +174 -174
  137. multipers/multiparameter_module_approximation/list_column_2.h +232 -232
  138. multipers/multiparameter_module_approximation/ru_matrix.h +347 -347
  139. multipers/multiparameter_module_approximation/set_column.h +135 -135
  140. multipers/multiparameter_module_approximation/structure_higher_dim_barcode.h +36 -36
  141. multipers/multiparameter_module_approximation/unordered_set_column.h +166 -166
  142. multipers/multiparameter_module_approximation/utilities.h +403 -419
  143. multipers/multiparameter_module_approximation/vector_column.h +223 -223
  144. multipers/multiparameter_module_approximation/vector_matrix.h +331 -331
  145. multipers/multiparameter_module_approximation/vineyards.h +464 -464
  146. multipers/multiparameter_module_approximation/vineyards_trajectories.h +649 -649
  147. multipers/multiparameter_module_approximation.cp312-win_amd64.pyd +0 -0
  148. multipers/multiparameter_module_approximation.pyx +216 -217
  149. multipers/pickle.py +90 -53
  150. multipers/plots.py +342 -334
  151. multipers/point_measure.cp312-win_amd64.pyd +0 -0
  152. multipers/point_measure.pyx +322 -320
  153. multipers/simplex_tree_multi.cp312-win_amd64.pyd +0 -0
  154. multipers/simplex_tree_multi.pxd +133 -133
  155. multipers/simplex_tree_multi.pyx +18 -15
  156. multipers/simplex_tree_multi.pyx.tp +1939 -1935
  157. multipers/slicer.cp312-win_amd64.pyd +0 -0
  158. multipers/slicer.pxd +81 -20
  159. multipers/slicer.pxd.tp +215 -214
  160. multipers/slicer.pyx +1091 -308
  161. multipers/slicer.pyx.tp +924 -914
  162. multipers/tensor/tensor.h +672 -672
  163. multipers/tensor.pxd +13 -13
  164. multipers/test.pyx +44 -44
  165. multipers/tests/__init__.py +57 -57
  166. multipers/torch/diff_grids.py +217 -217
  167. multipers/torch/rips_density.py +310 -304
  168. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/LICENSE +21 -21
  169. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/METADATA +21 -11
  170. multipers-2.3.0.dist-info/RECORD +182 -0
  171. multipers/tests/test_diff_helper.py +0 -73
  172. multipers/tests/test_hilbert_function.py +0 -82
  173. multipers/tests/test_mma.py +0 -83
  174. multipers/tests/test_point_clouds.py +0 -49
  175. multipers/tests/test_python-cpp_conversion.py +0 -82
  176. multipers/tests/test_signed_betti.py +0 -181
  177. multipers/tests/test_signed_measure.py +0 -89
  178. multipers/tests/test_simplextreemulti.py +0 -221
  179. multipers/tests/test_slicer.py +0 -221
  180. multipers-2.2.3.dist-info/RECORD +0 -189
  181. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/WHEEL +0 -0
  182. {multipers-2.2.3.dist-info → multipers-2.3.0.dist-info}/top_level.txt +0 -0
multipers/slicer.pyx CHANGED
@@ -2,8 +2,6 @@
2
2
  from multipers.simplex_tree_multi import SimplexTreeMulti, SimplexTreeMulti_type
3
3
  import multipers
4
4
  from typing import Optional,Literal
5
- import multipers.io as mio
6
- import multipers.grids as mpg
7
5
  import threading
8
6
  import os
9
7
  from joblib import Parallel, delayed
@@ -13,6 +11,7 @@ from multipers.filtrations cimport *
13
11
  from multipers.filtration_conversions cimport *
14
12
  ## TODO: these two are not needed, remove that by updating rank code.
15
13
  from multipers.point_measure import sparsify, rank_decomposition_by_rectangles
14
+ from multipers.grids import compute_grid
16
15
 
17
16
  import numpy as np
18
17
  cimport cython
@@ -458,10 +457,14 @@ cdef class _KSlicer_Matrix0_vine_i32:
458
457
  copy_.minpres_degree = self.minpres_degree
459
458
  copy_.filtration_grid = self.filtration_grid
460
459
  return copy_
461
- def get_barcode(self):
460
+ def get_barcode(self, bool keep_inf = False):
462
461
  """
463
462
  Returns the current barcode.
464
463
  """
464
+ if keep_inf:
465
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
466
+ else:
467
+ bcs = _KSlicer_Matrix0_vine_i32._threshold_bcs(self.truc.get_barcode())
465
468
  return self.truc.get_barcode()
466
469
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_vine_i32:
467
470
  """
@@ -625,7 +628,7 @@ cdef class _KSlicer_Matrix0_vine_i32:
625
628
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
626
629
  return np.asarray(out)
627
630
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
628
- return mpg.compute_grid(
631
+ return compute_grid(
629
632
  self.get_filtrations_values().T,
630
633
  strategy=grid_strategy,
631
634
  **infer_grid_kwargs,
@@ -672,7 +675,7 @@ cdef class _KSlicer_Matrix0_vine_i32:
672
675
  if not force and self.is_squeezed:
673
676
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
674
677
  if filtration_grid is None:
675
- filtration_grid = mpg.compute_grid(
678
+ filtration_grid = compute_grid(
676
679
  self.get_filtrations_values().T,
677
680
  strategy=grid_strategy,
678
681
  resolution=resolution)
@@ -740,6 +743,33 @@ cdef class _KSlicer_Matrix0_vine_i32:
740
743
  """
741
744
  return self.truc.get_current_order()
742
745
 
746
+ def to_scc(
747
+ self,
748
+ path:os.PathLike,
749
+ int num_parameters = -1,
750
+ int degree = -1,
751
+ bool rivet_compatible = False,
752
+ bool ignore_last_generators = False,
753
+ bool strip_comments = False,
754
+ bool reverse = False,
755
+ bool unsqueeze = True,
756
+ ):
757
+ """
758
+ Writes current slicer to a file in scc format.
759
+ """
760
+ if degree == -1 and not rivet_compatible:
761
+ degree = 1
762
+ cdef string c_path = path.encode(encoding="utf-8")
763
+ if self.is_squeezed and unsqueeze:
764
+ kwargs = locals()
765
+ kwargs.pop("self",0)
766
+ kwargs.pop("c_path",0)
767
+ self.unsqueeze().to_scc(**kwargs)
768
+ return
769
+ with nogil:
770
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
771
+
772
+
743
773
  #------------------------------------------------------------------------------
744
774
  cdef class _KSlicer_Matrix1_vine_i32:
745
775
  cdef C_KSlicer_Matrix1_vine_i32 truc
@@ -817,10 +847,14 @@ cdef class _KSlicer_Matrix1_vine_i32:
817
847
  copy_.minpres_degree = self.minpres_degree
818
848
  copy_.filtration_grid = self.filtration_grid
819
849
  return copy_
820
- def get_barcode(self):
850
+ def get_barcode(self, bool keep_inf = False):
821
851
  """
822
852
  Returns the current barcode.
823
853
  """
854
+ if keep_inf:
855
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
856
+ else:
857
+ bcs = _KSlicer_Matrix1_vine_i32._threshold_bcs(self.truc.get_barcode())
824
858
  return self.truc.get_barcode()
825
859
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_vine_i32:
826
860
  """
@@ -984,7 +1018,7 @@ cdef class _KSlicer_Matrix1_vine_i32:
984
1018
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
985
1019
  return np.asarray(out)
986
1020
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
987
- return mpg.compute_grid(
1021
+ return compute_grid(
988
1022
  self.get_filtrations_values().T,
989
1023
  strategy=grid_strategy,
990
1024
  **infer_grid_kwargs,
@@ -1031,7 +1065,7 @@ cdef class _KSlicer_Matrix1_vine_i32:
1031
1065
  if not force and self.is_squeezed:
1032
1066
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
1033
1067
  if filtration_grid is None:
1034
- filtration_grid = mpg.compute_grid(
1068
+ filtration_grid = compute_grid(
1035
1069
  self.get_filtrations_values().T,
1036
1070
  strategy=grid_strategy,
1037
1071
  resolution=resolution)
@@ -1099,6 +1133,33 @@ cdef class _KSlicer_Matrix1_vine_i32:
1099
1133
  """
1100
1134
  return self.truc.get_current_order()
1101
1135
 
1136
+ def to_scc(
1137
+ self,
1138
+ path:os.PathLike,
1139
+ int num_parameters = -1,
1140
+ int degree = -1,
1141
+ bool rivet_compatible = False,
1142
+ bool ignore_last_generators = False,
1143
+ bool strip_comments = False,
1144
+ bool reverse = False,
1145
+ bool unsqueeze = True,
1146
+ ):
1147
+ """
1148
+ Writes current slicer to a file in scc format.
1149
+ """
1150
+ if degree == -1 and not rivet_compatible:
1151
+ degree = 1
1152
+ cdef string c_path = path.encode(encoding="utf-8")
1153
+ if self.is_squeezed and unsqueeze:
1154
+ kwargs = locals()
1155
+ kwargs.pop("self",0)
1156
+ kwargs.pop("c_path",0)
1157
+ self.unsqueeze().to_scc(**kwargs)
1158
+ return
1159
+ with nogil:
1160
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
1161
+
1162
+
1102
1163
  #------------------------------------------------------------------------------
1103
1164
  cdef class _KSlicer_Matrix0_vine_i64:
1104
1165
  cdef C_KSlicer_Matrix0_vine_i64 truc
@@ -1176,10 +1237,14 @@ cdef class _KSlicer_Matrix0_vine_i64:
1176
1237
  copy_.minpres_degree = self.minpres_degree
1177
1238
  copy_.filtration_grid = self.filtration_grid
1178
1239
  return copy_
1179
- def get_barcode(self):
1240
+ def get_barcode(self, bool keep_inf = False):
1180
1241
  """
1181
1242
  Returns the current barcode.
1182
1243
  """
1244
+ if keep_inf:
1245
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
1246
+ else:
1247
+ bcs = _KSlicer_Matrix0_vine_i64._threshold_bcs(self.truc.get_barcode())
1183
1248
  return self.truc.get_barcode()
1184
1249
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_vine_i64:
1185
1250
  """
@@ -1343,7 +1408,7 @@ cdef class _KSlicer_Matrix0_vine_i64:
1343
1408
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
1344
1409
  return np.asarray(out)
1345
1410
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
1346
- return mpg.compute_grid(
1411
+ return compute_grid(
1347
1412
  self.get_filtrations_values().T,
1348
1413
  strategy=grid_strategy,
1349
1414
  **infer_grid_kwargs,
@@ -1390,7 +1455,7 @@ cdef class _KSlicer_Matrix0_vine_i64:
1390
1455
  if not force and self.is_squeezed:
1391
1456
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
1392
1457
  if filtration_grid is None:
1393
- filtration_grid = mpg.compute_grid(
1458
+ filtration_grid = compute_grid(
1394
1459
  self.get_filtrations_values().T,
1395
1460
  strategy=grid_strategy,
1396
1461
  resolution=resolution)
@@ -1458,6 +1523,33 @@ cdef class _KSlicer_Matrix0_vine_i64:
1458
1523
  """
1459
1524
  return self.truc.get_current_order()
1460
1525
 
1526
+ def to_scc(
1527
+ self,
1528
+ path:os.PathLike,
1529
+ int num_parameters = -1,
1530
+ int degree = -1,
1531
+ bool rivet_compatible = False,
1532
+ bool ignore_last_generators = False,
1533
+ bool strip_comments = False,
1534
+ bool reverse = False,
1535
+ bool unsqueeze = True,
1536
+ ):
1537
+ """
1538
+ Writes current slicer to a file in scc format.
1539
+ """
1540
+ if degree == -1 and not rivet_compatible:
1541
+ degree = 1
1542
+ cdef string c_path = path.encode(encoding="utf-8")
1543
+ if self.is_squeezed and unsqueeze:
1544
+ kwargs = locals()
1545
+ kwargs.pop("self",0)
1546
+ kwargs.pop("c_path",0)
1547
+ self.unsqueeze().to_scc(**kwargs)
1548
+ return
1549
+ with nogil:
1550
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
1551
+
1552
+
1461
1553
  #------------------------------------------------------------------------------
1462
1554
  cdef class _KSlicer_Matrix1_vine_i64:
1463
1555
  cdef C_KSlicer_Matrix1_vine_i64 truc
@@ -1535,10 +1627,14 @@ cdef class _KSlicer_Matrix1_vine_i64:
1535
1627
  copy_.minpres_degree = self.minpres_degree
1536
1628
  copy_.filtration_grid = self.filtration_grid
1537
1629
  return copy_
1538
- def get_barcode(self):
1630
+ def get_barcode(self, bool keep_inf = False):
1539
1631
  """
1540
1632
  Returns the current barcode.
1541
1633
  """
1634
+ if keep_inf:
1635
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
1636
+ else:
1637
+ bcs = _KSlicer_Matrix1_vine_i64._threshold_bcs(self.truc.get_barcode())
1542
1638
  return self.truc.get_barcode()
1543
1639
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_vine_i64:
1544
1640
  """
@@ -1702,7 +1798,7 @@ cdef class _KSlicer_Matrix1_vine_i64:
1702
1798
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
1703
1799
  return np.asarray(out)
1704
1800
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
1705
- return mpg.compute_grid(
1801
+ return compute_grid(
1706
1802
  self.get_filtrations_values().T,
1707
1803
  strategy=grid_strategy,
1708
1804
  **infer_grid_kwargs,
@@ -1749,7 +1845,7 @@ cdef class _KSlicer_Matrix1_vine_i64:
1749
1845
  if not force and self.is_squeezed:
1750
1846
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
1751
1847
  if filtration_grid is None:
1752
- filtration_grid = mpg.compute_grid(
1848
+ filtration_grid = compute_grid(
1753
1849
  self.get_filtrations_values().T,
1754
1850
  strategy=grid_strategy,
1755
1851
  resolution=resolution)
@@ -1817,6 +1913,33 @@ cdef class _KSlicer_Matrix1_vine_i64:
1817
1913
  """
1818
1914
  return self.truc.get_current_order()
1819
1915
 
1916
+ def to_scc(
1917
+ self,
1918
+ path:os.PathLike,
1919
+ int num_parameters = -1,
1920
+ int degree = -1,
1921
+ bool rivet_compatible = False,
1922
+ bool ignore_last_generators = False,
1923
+ bool strip_comments = False,
1924
+ bool reverse = False,
1925
+ bool unsqueeze = True,
1926
+ ):
1927
+ """
1928
+ Writes current slicer to a file in scc format.
1929
+ """
1930
+ if degree == -1 and not rivet_compatible:
1931
+ degree = 1
1932
+ cdef string c_path = path.encode(encoding="utf-8")
1933
+ if self.is_squeezed and unsqueeze:
1934
+ kwargs = locals()
1935
+ kwargs.pop("self",0)
1936
+ kwargs.pop("c_path",0)
1937
+ self.unsqueeze().to_scc(**kwargs)
1938
+ return
1939
+ with nogil:
1940
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
1941
+
1942
+
1820
1943
  #------------------------------------------------------------------------------
1821
1944
  cdef class _KSlicer_Matrix0_vine_f32:
1822
1945
  cdef C_KSlicer_Matrix0_vine_f32 truc
@@ -1894,10 +2017,14 @@ cdef class _KSlicer_Matrix0_vine_f32:
1894
2017
  copy_.minpres_degree = self.minpres_degree
1895
2018
  copy_.filtration_grid = self.filtration_grid
1896
2019
  return copy_
1897
- def get_barcode(self):
2020
+ def get_barcode(self, bool keep_inf = False):
1898
2021
  """
1899
2022
  Returns the current barcode.
1900
2023
  """
2024
+ if keep_inf:
2025
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
2026
+ else:
2027
+ bcs = _KSlicer_Matrix0_vine_f32._threshold_bcs(self.truc.get_barcode())
1901
2028
  return self.truc.get_barcode()
1902
2029
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_vine_f32:
1903
2030
  """
@@ -2061,7 +2188,7 @@ cdef class _KSlicer_Matrix0_vine_f32:
2061
2188
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
2062
2189
  return np.asarray(out)
2063
2190
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
2064
- return mpg.compute_grid(
2191
+ return compute_grid(
2065
2192
  self.get_filtrations_values().T,
2066
2193
  strategy=grid_strategy,
2067
2194
  **infer_grid_kwargs,
@@ -2108,7 +2235,7 @@ cdef class _KSlicer_Matrix0_vine_f32:
2108
2235
  if not force and self.is_squeezed:
2109
2236
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
2110
2237
  if filtration_grid is None:
2111
- filtration_grid = mpg.compute_grid(
2238
+ filtration_grid = compute_grid(
2112
2239
  self.get_filtrations_values().T,
2113
2240
  strategy=grid_strategy,
2114
2241
  resolution=resolution)
@@ -2176,6 +2303,33 @@ cdef class _KSlicer_Matrix0_vine_f32:
2176
2303
  """
2177
2304
  return self.truc.get_current_order()
2178
2305
 
2306
+ def to_scc(
2307
+ self,
2308
+ path:os.PathLike,
2309
+ int num_parameters = -1,
2310
+ int degree = -1,
2311
+ bool rivet_compatible = False,
2312
+ bool ignore_last_generators = False,
2313
+ bool strip_comments = False,
2314
+ bool reverse = False,
2315
+ bool unsqueeze = True,
2316
+ ):
2317
+ """
2318
+ Writes current slicer to a file in scc format.
2319
+ """
2320
+ if degree == -1 and not rivet_compatible:
2321
+ degree = 1
2322
+ cdef string c_path = path.encode(encoding="utf-8")
2323
+ if self.is_squeezed and unsqueeze:
2324
+ kwargs = locals()
2325
+ kwargs.pop("self",0)
2326
+ kwargs.pop("c_path",0)
2327
+ self.unsqueeze().to_scc(**kwargs)
2328
+ return
2329
+ with nogil:
2330
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
2331
+
2332
+
2179
2333
  #------------------------------------------------------------------------------
2180
2334
  cdef class _KSlicer_Matrix1_vine_f32:
2181
2335
  cdef C_KSlicer_Matrix1_vine_f32 truc
@@ -2253,10 +2407,14 @@ cdef class _KSlicer_Matrix1_vine_f32:
2253
2407
  copy_.minpres_degree = self.minpres_degree
2254
2408
  copy_.filtration_grid = self.filtration_grid
2255
2409
  return copy_
2256
- def get_barcode(self):
2410
+ def get_barcode(self, bool keep_inf = False):
2257
2411
  """
2258
2412
  Returns the current barcode.
2259
2413
  """
2414
+ if keep_inf:
2415
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
2416
+ else:
2417
+ bcs = _KSlicer_Matrix1_vine_f32._threshold_bcs(self.truc.get_barcode())
2260
2418
  return self.truc.get_barcode()
2261
2419
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_vine_f32:
2262
2420
  """
@@ -2420,7 +2578,7 @@ cdef class _KSlicer_Matrix1_vine_f32:
2420
2578
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
2421
2579
  return np.asarray(out)
2422
2580
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
2423
- return mpg.compute_grid(
2581
+ return compute_grid(
2424
2582
  self.get_filtrations_values().T,
2425
2583
  strategy=grid_strategy,
2426
2584
  **infer_grid_kwargs,
@@ -2467,7 +2625,7 @@ cdef class _KSlicer_Matrix1_vine_f32:
2467
2625
  if not force and self.is_squeezed:
2468
2626
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
2469
2627
  if filtration_grid is None:
2470
- filtration_grid = mpg.compute_grid(
2628
+ filtration_grid = compute_grid(
2471
2629
  self.get_filtrations_values().T,
2472
2630
  strategy=grid_strategy,
2473
2631
  resolution=resolution)
@@ -2535,6 +2693,33 @@ cdef class _KSlicer_Matrix1_vine_f32:
2535
2693
  """
2536
2694
  return self.truc.get_current_order()
2537
2695
 
2696
+ def to_scc(
2697
+ self,
2698
+ path:os.PathLike,
2699
+ int num_parameters = -1,
2700
+ int degree = -1,
2701
+ bool rivet_compatible = False,
2702
+ bool ignore_last_generators = False,
2703
+ bool strip_comments = False,
2704
+ bool reverse = False,
2705
+ bool unsqueeze = True,
2706
+ ):
2707
+ """
2708
+ Writes current slicer to a file in scc format.
2709
+ """
2710
+ if degree == -1 and not rivet_compatible:
2711
+ degree = 1
2712
+ cdef string c_path = path.encode(encoding="utf-8")
2713
+ if self.is_squeezed and unsqueeze:
2714
+ kwargs = locals()
2715
+ kwargs.pop("self",0)
2716
+ kwargs.pop("c_path",0)
2717
+ self.unsqueeze().to_scc(**kwargs)
2718
+ return
2719
+ with nogil:
2720
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
2721
+
2722
+
2538
2723
  #------------------------------------------------------------------------------
2539
2724
  cdef class _KSlicer_Matrix0_vine_f64:
2540
2725
  cdef C_KSlicer_Matrix0_vine_f64 truc
@@ -2612,10 +2797,14 @@ cdef class _KSlicer_Matrix0_vine_f64:
2612
2797
  copy_.minpres_degree = self.minpres_degree
2613
2798
  copy_.filtration_grid = self.filtration_grid
2614
2799
  return copy_
2615
- def get_barcode(self):
2800
+ def get_barcode(self, bool keep_inf = False):
2616
2801
  """
2617
2802
  Returns the current barcode.
2618
2803
  """
2804
+ if keep_inf:
2805
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
2806
+ else:
2807
+ bcs = _KSlicer_Matrix0_vine_f64._threshold_bcs(self.truc.get_barcode())
2619
2808
  return self.truc.get_barcode()
2620
2809
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_vine_f64:
2621
2810
  """
@@ -2779,7 +2968,7 @@ cdef class _KSlicer_Matrix0_vine_f64:
2779
2968
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
2780
2969
  return np.asarray(out)
2781
2970
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
2782
- return mpg.compute_grid(
2971
+ return compute_grid(
2783
2972
  self.get_filtrations_values().T,
2784
2973
  strategy=grid_strategy,
2785
2974
  **infer_grid_kwargs,
@@ -2826,7 +3015,7 @@ cdef class _KSlicer_Matrix0_vine_f64:
2826
3015
  if not force and self.is_squeezed:
2827
3016
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
2828
3017
  if filtration_grid is None:
2829
- filtration_grid = mpg.compute_grid(
3018
+ filtration_grid = compute_grid(
2830
3019
  self.get_filtrations_values().T,
2831
3020
  strategy=grid_strategy,
2832
3021
  resolution=resolution)
@@ -2894,6 +3083,33 @@ cdef class _KSlicer_Matrix0_vine_f64:
2894
3083
  """
2895
3084
  return self.truc.get_current_order()
2896
3085
 
3086
+ def to_scc(
3087
+ self,
3088
+ path:os.PathLike,
3089
+ int num_parameters = -1,
3090
+ int degree = -1,
3091
+ bool rivet_compatible = False,
3092
+ bool ignore_last_generators = False,
3093
+ bool strip_comments = False,
3094
+ bool reverse = False,
3095
+ bool unsqueeze = True,
3096
+ ):
3097
+ """
3098
+ Writes current slicer to a file in scc format.
3099
+ """
3100
+ if degree == -1 and not rivet_compatible:
3101
+ degree = 1
3102
+ cdef string c_path = path.encode(encoding="utf-8")
3103
+ if self.is_squeezed and unsqueeze:
3104
+ kwargs = locals()
3105
+ kwargs.pop("self",0)
3106
+ kwargs.pop("c_path",0)
3107
+ self.unsqueeze().to_scc(**kwargs)
3108
+ return
3109
+ with nogil:
3110
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
3111
+
3112
+
2897
3113
  #------------------------------------------------------------------------------
2898
3114
  cdef class _KSlicer_Matrix1_vine_f64:
2899
3115
  cdef C_KSlicer_Matrix1_vine_f64 truc
@@ -2971,10 +3187,14 @@ cdef class _KSlicer_Matrix1_vine_f64:
2971
3187
  copy_.minpres_degree = self.minpres_degree
2972
3188
  copy_.filtration_grid = self.filtration_grid
2973
3189
  return copy_
2974
- def get_barcode(self):
3190
+ def get_barcode(self, bool keep_inf = False):
2975
3191
  """
2976
3192
  Returns the current barcode.
2977
3193
  """
3194
+ if keep_inf:
3195
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
3196
+ else:
3197
+ bcs = _KSlicer_Matrix1_vine_f64._threshold_bcs(self.truc.get_barcode())
2978
3198
  return self.truc.get_barcode()
2979
3199
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_vine_f64:
2980
3200
  """
@@ -3138,7 +3358,7 @@ cdef class _KSlicer_Matrix1_vine_f64:
3138
3358
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
3139
3359
  return np.asarray(out)
3140
3360
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
3141
- return mpg.compute_grid(
3361
+ return compute_grid(
3142
3362
  self.get_filtrations_values().T,
3143
3363
  strategy=grid_strategy,
3144
3364
  **infer_grid_kwargs,
@@ -3185,7 +3405,7 @@ cdef class _KSlicer_Matrix1_vine_f64:
3185
3405
  if not force and self.is_squeezed:
3186
3406
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
3187
3407
  if filtration_grid is None:
3188
- filtration_grid = mpg.compute_grid(
3408
+ filtration_grid = compute_grid(
3189
3409
  self.get_filtrations_values().T,
3190
3410
  strategy=grid_strategy,
3191
3411
  resolution=resolution)
@@ -3253,6 +3473,33 @@ cdef class _KSlicer_Matrix1_vine_f64:
3253
3473
  """
3254
3474
  return self.truc.get_current_order()
3255
3475
 
3476
+ def to_scc(
3477
+ self,
3478
+ path:os.PathLike,
3479
+ int num_parameters = -1,
3480
+ int degree = -1,
3481
+ bool rivet_compatible = False,
3482
+ bool ignore_last_generators = False,
3483
+ bool strip_comments = False,
3484
+ bool reverse = False,
3485
+ bool unsqueeze = True,
3486
+ ):
3487
+ """
3488
+ Writes current slicer to a file in scc format.
3489
+ """
3490
+ if degree == -1 and not rivet_compatible:
3491
+ degree = 1
3492
+ cdef string c_path = path.encode(encoding="utf-8")
3493
+ if self.is_squeezed and unsqueeze:
3494
+ kwargs = locals()
3495
+ kwargs.pop("self",0)
3496
+ kwargs.pop("c_path",0)
3497
+ self.unsqueeze().to_scc(**kwargs)
3498
+ return
3499
+ with nogil:
3500
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
3501
+
3502
+
3256
3503
  #------------------------------------------------------------------------------
3257
3504
  cdef class _Slicer_Matrix0_vine_i32:
3258
3505
  cdef C_Slicer_Matrix0_vine_i32 truc
@@ -3321,10 +3568,14 @@ cdef class _Slicer_Matrix0_vine_i32:
3321
3568
  copy_.minpres_degree = self.minpres_degree
3322
3569
  copy_.filtration_grid = self.filtration_grid
3323
3570
  return copy_
3324
- def get_barcode(self):
3571
+ def get_barcode(self, bool keep_inf = False):
3325
3572
  """
3326
3573
  Returns the current barcode.
3327
3574
  """
3575
+ if keep_inf:
3576
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
3577
+ else:
3578
+ bcs = _Slicer_Matrix0_vine_i32._threshold_bcs(self.truc.get_barcode())
3328
3579
  return self.truc.get_barcode()
3329
3580
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_vine_i32:
3330
3581
  """
@@ -3488,7 +3739,7 @@ cdef class _Slicer_Matrix0_vine_i32:
3488
3739
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
3489
3740
  return np.asarray(out)
3490
3741
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
3491
- return mpg.compute_grid(
3742
+ return compute_grid(
3492
3743
  self.get_filtrations_values().T,
3493
3744
  strategy=grid_strategy,
3494
3745
  **infer_grid_kwargs,
@@ -3535,7 +3786,7 @@ cdef class _Slicer_Matrix0_vine_i32:
3535
3786
  if not force and self.is_squeezed:
3536
3787
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
3537
3788
  if filtration_grid is None:
3538
- filtration_grid = mpg.compute_grid(
3789
+ filtration_grid = compute_grid(
3539
3790
  self.get_filtrations_values().T,
3540
3791
  strategy=grid_strategy,
3541
3792
  resolution=resolution)
@@ -3602,20 +3853,12 @@ cdef class _Slicer_Matrix0_vine_i32:
3602
3853
  Returns the current generator permutation (w.r.t. vineyard).
3603
3854
  """
3604
3855
  return self.truc.get_current_order()
3605
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_i32:
3606
- """
3607
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
3608
- """
3609
- cdef string c_path = path.encode(encoding="utf-8")
3610
- with nogil:
3611
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
3612
- return self
3613
3856
 
3614
3857
  def to_scc(
3615
3858
  self,
3616
3859
  path:os.PathLike,
3617
3860
  int num_parameters = -1,
3618
- int degree = 1,
3861
+ int degree = -1,
3619
3862
  bool rivet_compatible = False,
3620
3863
  bool ignore_last_generators = False,
3621
3864
  bool strip_comments = False,
@@ -3625,6 +3868,8 @@ cdef class _Slicer_Matrix0_vine_i32:
3625
3868
  """
3626
3869
  Writes current slicer to a file in scc format.
3627
3870
  """
3871
+ if degree == -1 and not rivet_compatible:
3872
+ degree = 1
3628
3873
  cdef string c_path = path.encode(encoding="utf-8")
3629
3874
  if self.is_squeezed and unsqueeze:
3630
3875
  kwargs = locals()
@@ -3634,6 +3879,16 @@ cdef class _Slicer_Matrix0_vine_i32:
3634
3879
  return
3635
3880
  with nogil:
3636
3881
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
3882
+
3883
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_i32:
3884
+ """
3885
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
3886
+ """
3887
+ cdef string c_path = path.encode(encoding="utf-8")
3888
+ with nogil:
3889
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
3890
+ return self
3891
+
3637
3892
  def unsqueeze(self, grid=None, dtype = np.float64):
3638
3893
  from multipers.grids import evaluate_in_grid
3639
3894
  from multipers import Slicer
@@ -3715,10 +3970,14 @@ cdef class _Slicer_Matrix1_vine_i32:
3715
3970
  copy_.minpres_degree = self.minpres_degree
3716
3971
  copy_.filtration_grid = self.filtration_grid
3717
3972
  return copy_
3718
- def get_barcode(self):
3973
+ def get_barcode(self, bool keep_inf = False):
3719
3974
  """
3720
3975
  Returns the current barcode.
3721
3976
  """
3977
+ if keep_inf:
3978
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
3979
+ else:
3980
+ bcs = _Slicer_Matrix1_vine_i32._threshold_bcs(self.truc.get_barcode())
3722
3981
  return self.truc.get_barcode()
3723
3982
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_vine_i32:
3724
3983
  """
@@ -3882,7 +4141,7 @@ cdef class _Slicer_Matrix1_vine_i32:
3882
4141
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
3883
4142
  return np.asarray(out)
3884
4143
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
3885
- return mpg.compute_grid(
4144
+ return compute_grid(
3886
4145
  self.get_filtrations_values().T,
3887
4146
  strategy=grid_strategy,
3888
4147
  **infer_grid_kwargs,
@@ -3929,7 +4188,7 @@ cdef class _Slicer_Matrix1_vine_i32:
3929
4188
  if not force and self.is_squeezed:
3930
4189
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
3931
4190
  if filtration_grid is None:
3932
- filtration_grid = mpg.compute_grid(
4191
+ filtration_grid = compute_grid(
3933
4192
  self.get_filtrations_values().T,
3934
4193
  strategy=grid_strategy,
3935
4194
  resolution=resolution)
@@ -3996,20 +4255,12 @@ cdef class _Slicer_Matrix1_vine_i32:
3996
4255
  Returns the current generator permutation (w.r.t. vineyard).
3997
4256
  """
3998
4257
  return self.truc.get_current_order()
3999
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_i32:
4000
- """
4001
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
4002
- """
4003
- cdef string c_path = path.encode(encoding="utf-8")
4004
- with nogil:
4005
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
4006
- return self
4007
4258
 
4008
4259
  def to_scc(
4009
4260
  self,
4010
4261
  path:os.PathLike,
4011
4262
  int num_parameters = -1,
4012
- int degree = 1,
4263
+ int degree = -1,
4013
4264
  bool rivet_compatible = False,
4014
4265
  bool ignore_last_generators = False,
4015
4266
  bool strip_comments = False,
@@ -4019,6 +4270,8 @@ cdef class _Slicer_Matrix1_vine_i32:
4019
4270
  """
4020
4271
  Writes current slicer to a file in scc format.
4021
4272
  """
4273
+ if degree == -1 and not rivet_compatible:
4274
+ degree = 1
4022
4275
  cdef string c_path = path.encode(encoding="utf-8")
4023
4276
  if self.is_squeezed and unsqueeze:
4024
4277
  kwargs = locals()
@@ -4027,7 +4280,17 @@ cdef class _Slicer_Matrix1_vine_i32:
4027
4280
  self.unsqueeze().to_scc(**kwargs)
4028
4281
  return
4029
4282
  with nogil:
4030
- self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
4283
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
4284
+
4285
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_i32:
4286
+ """
4287
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
4288
+ """
4289
+ cdef string c_path = path.encode(encoding="utf-8")
4290
+ with nogil:
4291
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
4292
+ return self
4293
+
4031
4294
  def unsqueeze(self, grid=None, dtype = np.float64):
4032
4295
  from multipers.grids import evaluate_in_grid
4033
4296
  from multipers import Slicer
@@ -4109,10 +4372,14 @@ cdef class _Slicer_Matrix0_vine_i64:
4109
4372
  copy_.minpres_degree = self.minpres_degree
4110
4373
  copy_.filtration_grid = self.filtration_grid
4111
4374
  return copy_
4112
- def get_barcode(self):
4375
+ def get_barcode(self, bool keep_inf = False):
4113
4376
  """
4114
4377
  Returns the current barcode.
4115
4378
  """
4379
+ if keep_inf:
4380
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
4381
+ else:
4382
+ bcs = _Slicer_Matrix0_vine_i64._threshold_bcs(self.truc.get_barcode())
4116
4383
  return self.truc.get_barcode()
4117
4384
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_vine_i64:
4118
4385
  """
@@ -4276,7 +4543,7 @@ cdef class _Slicer_Matrix0_vine_i64:
4276
4543
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
4277
4544
  return np.asarray(out)
4278
4545
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
4279
- return mpg.compute_grid(
4546
+ return compute_grid(
4280
4547
  self.get_filtrations_values().T,
4281
4548
  strategy=grid_strategy,
4282
4549
  **infer_grid_kwargs,
@@ -4323,7 +4590,7 @@ cdef class _Slicer_Matrix0_vine_i64:
4323
4590
  if not force and self.is_squeezed:
4324
4591
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
4325
4592
  if filtration_grid is None:
4326
- filtration_grid = mpg.compute_grid(
4593
+ filtration_grid = compute_grid(
4327
4594
  self.get_filtrations_values().T,
4328
4595
  strategy=grid_strategy,
4329
4596
  resolution=resolution)
@@ -4390,20 +4657,12 @@ cdef class _Slicer_Matrix0_vine_i64:
4390
4657
  Returns the current generator permutation (w.r.t. vineyard).
4391
4658
  """
4392
4659
  return self.truc.get_current_order()
4393
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_i64:
4394
- """
4395
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
4396
- """
4397
- cdef string c_path = path.encode(encoding="utf-8")
4398
- with nogil:
4399
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
4400
- return self
4401
4660
 
4402
4661
  def to_scc(
4403
4662
  self,
4404
4663
  path:os.PathLike,
4405
4664
  int num_parameters = -1,
4406
- int degree = 1,
4665
+ int degree = -1,
4407
4666
  bool rivet_compatible = False,
4408
4667
  bool ignore_last_generators = False,
4409
4668
  bool strip_comments = False,
@@ -4413,6 +4672,8 @@ cdef class _Slicer_Matrix0_vine_i64:
4413
4672
  """
4414
4673
  Writes current slicer to a file in scc format.
4415
4674
  """
4675
+ if degree == -1 and not rivet_compatible:
4676
+ degree = 1
4416
4677
  cdef string c_path = path.encode(encoding="utf-8")
4417
4678
  if self.is_squeezed and unsqueeze:
4418
4679
  kwargs = locals()
@@ -4422,6 +4683,16 @@ cdef class _Slicer_Matrix0_vine_i64:
4422
4683
  return
4423
4684
  with nogil:
4424
4685
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
4686
+
4687
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_i64:
4688
+ """
4689
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
4690
+ """
4691
+ cdef string c_path = path.encode(encoding="utf-8")
4692
+ with nogil:
4693
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
4694
+ return self
4695
+
4425
4696
  def unsqueeze(self, grid=None, dtype = np.float64):
4426
4697
  from multipers.grids import evaluate_in_grid
4427
4698
  from multipers import Slicer
@@ -4503,10 +4774,14 @@ cdef class _Slicer_Matrix1_vine_i64:
4503
4774
  copy_.minpres_degree = self.minpres_degree
4504
4775
  copy_.filtration_grid = self.filtration_grid
4505
4776
  return copy_
4506
- def get_barcode(self):
4777
+ def get_barcode(self, bool keep_inf = False):
4507
4778
  """
4508
4779
  Returns the current barcode.
4509
4780
  """
4781
+ if keep_inf:
4782
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
4783
+ else:
4784
+ bcs = _Slicer_Matrix1_vine_i64._threshold_bcs(self.truc.get_barcode())
4510
4785
  return self.truc.get_barcode()
4511
4786
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_vine_i64:
4512
4787
  """
@@ -4670,7 +4945,7 @@ cdef class _Slicer_Matrix1_vine_i64:
4670
4945
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
4671
4946
  return np.asarray(out)
4672
4947
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
4673
- return mpg.compute_grid(
4948
+ return compute_grid(
4674
4949
  self.get_filtrations_values().T,
4675
4950
  strategy=grid_strategy,
4676
4951
  **infer_grid_kwargs,
@@ -4717,7 +4992,7 @@ cdef class _Slicer_Matrix1_vine_i64:
4717
4992
  if not force and self.is_squeezed:
4718
4993
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
4719
4994
  if filtration_grid is None:
4720
- filtration_grid = mpg.compute_grid(
4995
+ filtration_grid = compute_grid(
4721
4996
  self.get_filtrations_values().T,
4722
4997
  strategy=grid_strategy,
4723
4998
  resolution=resolution)
@@ -4784,20 +5059,12 @@ cdef class _Slicer_Matrix1_vine_i64:
4784
5059
  Returns the current generator permutation (w.r.t. vineyard).
4785
5060
  """
4786
5061
  return self.truc.get_current_order()
4787
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_i64:
4788
- """
4789
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
4790
- """
4791
- cdef string c_path = path.encode(encoding="utf-8")
4792
- with nogil:
4793
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
4794
- return self
4795
5062
 
4796
5063
  def to_scc(
4797
5064
  self,
4798
5065
  path:os.PathLike,
4799
5066
  int num_parameters = -1,
4800
- int degree = 1,
5067
+ int degree = -1,
4801
5068
  bool rivet_compatible = False,
4802
5069
  bool ignore_last_generators = False,
4803
5070
  bool strip_comments = False,
@@ -4807,6 +5074,8 @@ cdef class _Slicer_Matrix1_vine_i64:
4807
5074
  """
4808
5075
  Writes current slicer to a file in scc format.
4809
5076
  """
5077
+ if degree == -1 and not rivet_compatible:
5078
+ degree = 1
4810
5079
  cdef string c_path = path.encode(encoding="utf-8")
4811
5080
  if self.is_squeezed and unsqueeze:
4812
5081
  kwargs = locals()
@@ -4816,6 +5085,16 @@ cdef class _Slicer_Matrix1_vine_i64:
4816
5085
  return
4817
5086
  with nogil:
4818
5087
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
5088
+
5089
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_i64:
5090
+ """
5091
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5092
+ """
5093
+ cdef string c_path = path.encode(encoding="utf-8")
5094
+ with nogil:
5095
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5096
+ return self
5097
+
4819
5098
  def unsqueeze(self, grid=None, dtype = np.float64):
4820
5099
  from multipers.grids import evaluate_in_grid
4821
5100
  from multipers import Slicer
@@ -4897,10 +5176,14 @@ cdef class _Slicer_Matrix0_vine_f32:
4897
5176
  copy_.minpres_degree = self.minpres_degree
4898
5177
  copy_.filtration_grid = self.filtration_grid
4899
5178
  return copy_
4900
- def get_barcode(self):
5179
+ def get_barcode(self, bool keep_inf = False):
4901
5180
  """
4902
5181
  Returns the current barcode.
4903
5182
  """
5183
+ if keep_inf:
5184
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
5185
+ else:
5186
+ bcs = _Slicer_Matrix0_vine_f32._threshold_bcs(self.truc.get_barcode())
4904
5187
  return self.truc.get_barcode()
4905
5188
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_vine_f32:
4906
5189
  """
@@ -5064,7 +5347,7 @@ cdef class _Slicer_Matrix0_vine_f32:
5064
5347
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
5065
5348
  return np.asarray(out)
5066
5349
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
5067
- return mpg.compute_grid(
5350
+ return compute_grid(
5068
5351
  self.get_filtrations_values().T,
5069
5352
  strategy=grid_strategy,
5070
5353
  **infer_grid_kwargs,
@@ -5111,7 +5394,7 @@ cdef class _Slicer_Matrix0_vine_f32:
5111
5394
  if not force and self.is_squeezed:
5112
5395
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
5113
5396
  if filtration_grid is None:
5114
- filtration_grid = mpg.compute_grid(
5397
+ filtration_grid = compute_grid(
5115
5398
  self.get_filtrations_values().T,
5116
5399
  strategy=grid_strategy,
5117
5400
  resolution=resolution)
@@ -5178,20 +5461,12 @@ cdef class _Slicer_Matrix0_vine_f32:
5178
5461
  Returns the current generator permutation (w.r.t. vineyard).
5179
5462
  """
5180
5463
  return self.truc.get_current_order()
5181
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_f32:
5182
- """
5183
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5184
- """
5185
- cdef string c_path = path.encode(encoding="utf-8")
5186
- with nogil:
5187
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5188
- return self
5189
5464
 
5190
5465
  def to_scc(
5191
5466
  self,
5192
5467
  path:os.PathLike,
5193
5468
  int num_parameters = -1,
5194
- int degree = 1,
5469
+ int degree = -1,
5195
5470
  bool rivet_compatible = False,
5196
5471
  bool ignore_last_generators = False,
5197
5472
  bool strip_comments = False,
@@ -5201,6 +5476,8 @@ cdef class _Slicer_Matrix0_vine_f32:
5201
5476
  """
5202
5477
  Writes current slicer to a file in scc format.
5203
5478
  """
5479
+ if degree == -1 and not rivet_compatible:
5480
+ degree = 1
5204
5481
  cdef string c_path = path.encode(encoding="utf-8")
5205
5482
  if self.is_squeezed and unsqueeze:
5206
5483
  kwargs = locals()
@@ -5210,6 +5487,16 @@ cdef class _Slicer_Matrix0_vine_f32:
5210
5487
  return
5211
5488
  with nogil:
5212
5489
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
5490
+
5491
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_f32:
5492
+ """
5493
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5494
+ """
5495
+ cdef string c_path = path.encode(encoding="utf-8")
5496
+ with nogil:
5497
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5498
+ return self
5499
+
5213
5500
  def unsqueeze(self, grid=None, dtype = np.float64):
5214
5501
  from multipers.grids import evaluate_in_grid
5215
5502
  from multipers import Slicer
@@ -5291,10 +5578,14 @@ cdef class _Slicer_Matrix1_vine_f32:
5291
5578
  copy_.minpres_degree = self.minpres_degree
5292
5579
  copy_.filtration_grid = self.filtration_grid
5293
5580
  return copy_
5294
- def get_barcode(self):
5581
+ def get_barcode(self, bool keep_inf = False):
5295
5582
  """
5296
5583
  Returns the current barcode.
5297
5584
  """
5585
+ if keep_inf:
5586
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
5587
+ else:
5588
+ bcs = _Slicer_Matrix1_vine_f32._threshold_bcs(self.truc.get_barcode())
5298
5589
  return self.truc.get_barcode()
5299
5590
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_vine_f32:
5300
5591
  """
@@ -5458,7 +5749,7 @@ cdef class _Slicer_Matrix1_vine_f32:
5458
5749
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
5459
5750
  return np.asarray(out)
5460
5751
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
5461
- return mpg.compute_grid(
5752
+ return compute_grid(
5462
5753
  self.get_filtrations_values().T,
5463
5754
  strategy=grid_strategy,
5464
5755
  **infer_grid_kwargs,
@@ -5505,7 +5796,7 @@ cdef class _Slicer_Matrix1_vine_f32:
5505
5796
  if not force and self.is_squeezed:
5506
5797
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
5507
5798
  if filtration_grid is None:
5508
- filtration_grid = mpg.compute_grid(
5799
+ filtration_grid = compute_grid(
5509
5800
  self.get_filtrations_values().T,
5510
5801
  strategy=grid_strategy,
5511
5802
  resolution=resolution)
@@ -5572,20 +5863,12 @@ cdef class _Slicer_Matrix1_vine_f32:
5572
5863
  Returns the current generator permutation (w.r.t. vineyard).
5573
5864
  """
5574
5865
  return self.truc.get_current_order()
5575
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_f32:
5576
- """
5577
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5578
- """
5579
- cdef string c_path = path.encode(encoding="utf-8")
5580
- with nogil:
5581
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5582
- return self
5583
5866
 
5584
5867
  def to_scc(
5585
5868
  self,
5586
5869
  path:os.PathLike,
5587
5870
  int num_parameters = -1,
5588
- int degree = 1,
5871
+ int degree = -1,
5589
5872
  bool rivet_compatible = False,
5590
5873
  bool ignore_last_generators = False,
5591
5874
  bool strip_comments = False,
@@ -5595,6 +5878,8 @@ cdef class _Slicer_Matrix1_vine_f32:
5595
5878
  """
5596
5879
  Writes current slicer to a file in scc format.
5597
5880
  """
5881
+ if degree == -1 and not rivet_compatible:
5882
+ degree = 1
5598
5883
  cdef string c_path = path.encode(encoding="utf-8")
5599
5884
  if self.is_squeezed and unsqueeze:
5600
5885
  kwargs = locals()
@@ -5604,6 +5889,16 @@ cdef class _Slicer_Matrix1_vine_f32:
5604
5889
  return
5605
5890
  with nogil:
5606
5891
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
5892
+
5893
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_f32:
5894
+ """
5895
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5896
+ """
5897
+ cdef string c_path = path.encode(encoding="utf-8")
5898
+ with nogil:
5899
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5900
+ return self
5901
+
5607
5902
  def unsqueeze(self, grid=None, dtype = np.float64):
5608
5903
  from multipers.grids import evaluate_in_grid
5609
5904
  from multipers import Slicer
@@ -5685,10 +5980,14 @@ cdef class _Slicer_Matrix0_vine_f64:
5685
5980
  copy_.minpres_degree = self.minpres_degree
5686
5981
  copy_.filtration_grid = self.filtration_grid
5687
5982
  return copy_
5688
- def get_barcode(self):
5983
+ def get_barcode(self, bool keep_inf = False):
5689
5984
  """
5690
5985
  Returns the current barcode.
5691
5986
  """
5987
+ if keep_inf:
5988
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
5989
+ else:
5990
+ bcs = _Slicer_Matrix0_vine_f64._threshold_bcs(self.truc.get_barcode())
5692
5991
  return self.truc.get_barcode()
5693
5992
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_vine_f64:
5694
5993
  """
@@ -5852,7 +6151,7 @@ cdef class _Slicer_Matrix0_vine_f64:
5852
6151
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
5853
6152
  return np.asarray(out)
5854
6153
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
5855
- return mpg.compute_grid(
6154
+ return compute_grid(
5856
6155
  self.get_filtrations_values().T,
5857
6156
  strategy=grid_strategy,
5858
6157
  **infer_grid_kwargs,
@@ -5899,7 +6198,7 @@ cdef class _Slicer_Matrix0_vine_f64:
5899
6198
  if not force and self.is_squeezed:
5900
6199
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
5901
6200
  if filtration_grid is None:
5902
- filtration_grid = mpg.compute_grid(
6201
+ filtration_grid = compute_grid(
5903
6202
  self.get_filtrations_values().T,
5904
6203
  strategy=grid_strategy,
5905
6204
  resolution=resolution)
@@ -5966,20 +6265,12 @@ cdef class _Slicer_Matrix0_vine_f64:
5966
6265
  Returns the current generator permutation (w.r.t. vineyard).
5967
6266
  """
5968
6267
  return self.truc.get_current_order()
5969
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_f64:
5970
- """
5971
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
5972
- """
5973
- cdef string c_path = path.encode(encoding="utf-8")
5974
- with nogil:
5975
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
5976
- return self
5977
6268
 
5978
6269
  def to_scc(
5979
6270
  self,
5980
6271
  path:os.PathLike,
5981
6272
  int num_parameters = -1,
5982
- int degree = 1,
6273
+ int degree = -1,
5983
6274
  bool rivet_compatible = False,
5984
6275
  bool ignore_last_generators = False,
5985
6276
  bool strip_comments = False,
@@ -5989,6 +6280,8 @@ cdef class _Slicer_Matrix0_vine_f64:
5989
6280
  """
5990
6281
  Writes current slicer to a file in scc format.
5991
6282
  """
6283
+ if degree == -1 and not rivet_compatible:
6284
+ degree = 1
5992
6285
  cdef string c_path = path.encode(encoding="utf-8")
5993
6286
  if self.is_squeezed and unsqueeze:
5994
6287
  kwargs = locals()
@@ -5998,6 +6291,16 @@ cdef class _Slicer_Matrix0_vine_f64:
5998
6291
  return
5999
6292
  with nogil:
6000
6293
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
6294
+
6295
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_vine_f64:
6296
+ """
6297
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
6298
+ """
6299
+ cdef string c_path = path.encode(encoding="utf-8")
6300
+ with nogil:
6301
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
6302
+ return self
6303
+
6001
6304
  def unsqueeze(self, grid=None, dtype = np.float64):
6002
6305
  from multipers.grids import evaluate_in_grid
6003
6306
  from multipers import Slicer
@@ -6079,10 +6382,14 @@ cdef class _Slicer_Matrix1_vine_f64:
6079
6382
  copy_.minpres_degree = self.minpres_degree
6080
6383
  copy_.filtration_grid = self.filtration_grid
6081
6384
  return copy_
6082
- def get_barcode(self):
6385
+ def get_barcode(self, bool keep_inf = False):
6083
6386
  """
6084
6387
  Returns the current barcode.
6085
6388
  """
6389
+ if keep_inf:
6390
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
6391
+ else:
6392
+ bcs = _Slicer_Matrix1_vine_f64._threshold_bcs(self.truc.get_barcode())
6086
6393
  return self.truc.get_barcode()
6087
6394
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_vine_f64:
6088
6395
  """
@@ -6246,7 +6553,7 @@ cdef class _Slicer_Matrix1_vine_f64:
6246
6553
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
6247
6554
  return np.asarray(out)
6248
6555
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
6249
- return mpg.compute_grid(
6556
+ return compute_grid(
6250
6557
  self.get_filtrations_values().T,
6251
6558
  strategy=grid_strategy,
6252
6559
  **infer_grid_kwargs,
@@ -6293,7 +6600,7 @@ cdef class _Slicer_Matrix1_vine_f64:
6293
6600
  if not force and self.is_squeezed:
6294
6601
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
6295
6602
  if filtration_grid is None:
6296
- filtration_grid = mpg.compute_grid(
6603
+ filtration_grid = compute_grid(
6297
6604
  self.get_filtrations_values().T,
6298
6605
  strategy=grid_strategy,
6299
6606
  resolution=resolution)
@@ -6360,20 +6667,12 @@ cdef class _Slicer_Matrix1_vine_f64:
6360
6667
  Returns the current generator permutation (w.r.t. vineyard).
6361
6668
  """
6362
6669
  return self.truc.get_current_order()
6363
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_f64:
6364
- """
6365
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
6366
- """
6367
- cdef string c_path = path.encode(encoding="utf-8")
6368
- with nogil:
6369
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
6370
- return self
6371
6670
 
6372
6671
  def to_scc(
6373
6672
  self,
6374
6673
  path:os.PathLike,
6375
6674
  int num_parameters = -1,
6376
- int degree = 1,
6675
+ int degree = -1,
6377
6676
  bool rivet_compatible = False,
6378
6677
  bool ignore_last_generators = False,
6379
6678
  bool strip_comments = False,
@@ -6383,6 +6682,8 @@ cdef class _Slicer_Matrix1_vine_f64:
6383
6682
  """
6384
6683
  Writes current slicer to a file in scc format.
6385
6684
  """
6685
+ if degree == -1 and not rivet_compatible:
6686
+ degree = 1
6386
6687
  cdef string c_path = path.encode(encoding="utf-8")
6387
6688
  if self.is_squeezed and unsqueeze:
6388
6689
  kwargs = locals()
@@ -6392,6 +6693,16 @@ cdef class _Slicer_Matrix1_vine_f64:
6392
6693
  return
6393
6694
  with nogil:
6394
6695
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
6696
+
6697
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_vine_f64:
6698
+ """
6699
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
6700
+ """
6701
+ cdef string c_path = path.encode(encoding="utf-8")
6702
+ with nogil:
6703
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
6704
+ return self
6705
+
6395
6706
  def unsqueeze(self, grid=None, dtype = np.float64):
6396
6707
  from multipers.grids import evaluate_in_grid
6397
6708
  from multipers import Slicer
@@ -6482,10 +6793,14 @@ cdef class _KSlicer_Matrix0_i32:
6482
6793
  copy_.minpres_degree = self.minpres_degree
6483
6794
  copy_.filtration_grid = self.filtration_grid
6484
6795
  return copy_
6485
- def get_barcode(self):
6796
+ def get_barcode(self, bool keep_inf = False):
6486
6797
  """
6487
6798
  Returns the current barcode.
6488
6799
  """
6800
+ if keep_inf:
6801
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
6802
+ else:
6803
+ bcs = _KSlicer_Matrix0_i32._threshold_bcs(self.truc.get_barcode())
6489
6804
  return self.truc.get_barcode()
6490
6805
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_i32:
6491
6806
  """
@@ -6649,7 +6964,7 @@ cdef class _KSlicer_Matrix0_i32:
6649
6964
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
6650
6965
  return np.asarray(out)
6651
6966
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
6652
- return mpg.compute_grid(
6967
+ return compute_grid(
6653
6968
  self.get_filtrations_values().T,
6654
6969
  strategy=grid_strategy,
6655
6970
  **infer_grid_kwargs,
@@ -6696,7 +7011,7 @@ cdef class _KSlicer_Matrix0_i32:
6696
7011
  if not force and self.is_squeezed:
6697
7012
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
6698
7013
  if filtration_grid is None:
6699
- filtration_grid = mpg.compute_grid(
7014
+ filtration_grid = compute_grid(
6700
7015
  self.get_filtrations_values().T,
6701
7016
  strategy=grid_strategy,
6702
7017
  resolution=resolution)
@@ -6746,6 +7061,33 @@ cdef class _KSlicer_Matrix0_i32:
6746
7061
  return "Matrix"
6747
7062
 
6748
7063
 
7064
+ def to_scc(
7065
+ self,
7066
+ path:os.PathLike,
7067
+ int num_parameters = -1,
7068
+ int degree = -1,
7069
+ bool rivet_compatible = False,
7070
+ bool ignore_last_generators = False,
7071
+ bool strip_comments = False,
7072
+ bool reverse = False,
7073
+ bool unsqueeze = True,
7074
+ ):
7075
+ """
7076
+ Writes current slicer to a file in scc format.
7077
+ """
7078
+ if degree == -1 and not rivet_compatible:
7079
+ degree = 1
7080
+ cdef string c_path = path.encode(encoding="utf-8")
7081
+ if self.is_squeezed and unsqueeze:
7082
+ kwargs = locals()
7083
+ kwargs.pop("self",0)
7084
+ kwargs.pop("c_path",0)
7085
+ self.unsqueeze().to_scc(**kwargs)
7086
+ return
7087
+ with nogil:
7088
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
7089
+
7090
+
6749
7091
  #------------------------------------------------------------------------------
6750
7092
  cdef class _KSlicer_Matrix1_i32:
6751
7093
  cdef C_KSlicer_Matrix1_i32 truc
@@ -6823,10 +7165,14 @@ cdef class _KSlicer_Matrix1_i32:
6823
7165
  copy_.minpres_degree = self.minpres_degree
6824
7166
  copy_.filtration_grid = self.filtration_grid
6825
7167
  return copy_
6826
- def get_barcode(self):
7168
+ def get_barcode(self, bool keep_inf = False):
6827
7169
  """
6828
7170
  Returns the current barcode.
6829
7171
  """
7172
+ if keep_inf:
7173
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
7174
+ else:
7175
+ bcs = _KSlicer_Matrix1_i32._threshold_bcs(self.truc.get_barcode())
6830
7176
  return self.truc.get_barcode()
6831
7177
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_i32:
6832
7178
  """
@@ -6990,7 +7336,7 @@ cdef class _KSlicer_Matrix1_i32:
6990
7336
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
6991
7337
  return np.asarray(out)
6992
7338
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
6993
- return mpg.compute_grid(
7339
+ return compute_grid(
6994
7340
  self.get_filtrations_values().T,
6995
7341
  strategy=grid_strategy,
6996
7342
  **infer_grid_kwargs,
@@ -7037,7 +7383,7 @@ cdef class _KSlicer_Matrix1_i32:
7037
7383
  if not force and self.is_squeezed:
7038
7384
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
7039
7385
  if filtration_grid is None:
7040
- filtration_grid = mpg.compute_grid(
7386
+ filtration_grid = compute_grid(
7041
7387
  self.get_filtrations_values().T,
7042
7388
  strategy=grid_strategy,
7043
7389
  resolution=resolution)
@@ -7087,6 +7433,33 @@ cdef class _KSlicer_Matrix1_i32:
7087
7433
  return "Matrix"
7088
7434
 
7089
7435
 
7436
+ def to_scc(
7437
+ self,
7438
+ path:os.PathLike,
7439
+ int num_parameters = -1,
7440
+ int degree = -1,
7441
+ bool rivet_compatible = False,
7442
+ bool ignore_last_generators = False,
7443
+ bool strip_comments = False,
7444
+ bool reverse = False,
7445
+ bool unsqueeze = True,
7446
+ ):
7447
+ """
7448
+ Writes current slicer to a file in scc format.
7449
+ """
7450
+ if degree == -1 and not rivet_compatible:
7451
+ degree = 1
7452
+ cdef string c_path = path.encode(encoding="utf-8")
7453
+ if self.is_squeezed and unsqueeze:
7454
+ kwargs = locals()
7455
+ kwargs.pop("self",0)
7456
+ kwargs.pop("c_path",0)
7457
+ self.unsqueeze().to_scc(**kwargs)
7458
+ return
7459
+ with nogil:
7460
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
7461
+
7462
+
7090
7463
  #------------------------------------------------------------------------------
7091
7464
  cdef class _KSlicer_Matrix0_i64:
7092
7465
  cdef C_KSlicer_Matrix0_i64 truc
@@ -7164,10 +7537,14 @@ cdef class _KSlicer_Matrix0_i64:
7164
7537
  copy_.minpres_degree = self.minpres_degree
7165
7538
  copy_.filtration_grid = self.filtration_grid
7166
7539
  return copy_
7167
- def get_barcode(self):
7540
+ def get_barcode(self, bool keep_inf = False):
7168
7541
  """
7169
7542
  Returns the current barcode.
7170
7543
  """
7544
+ if keep_inf:
7545
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
7546
+ else:
7547
+ bcs = _KSlicer_Matrix0_i64._threshold_bcs(self.truc.get_barcode())
7171
7548
  return self.truc.get_barcode()
7172
7549
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_i64:
7173
7550
  """
@@ -7331,7 +7708,7 @@ cdef class _KSlicer_Matrix0_i64:
7331
7708
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
7332
7709
  return np.asarray(out)
7333
7710
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
7334
- return mpg.compute_grid(
7711
+ return compute_grid(
7335
7712
  self.get_filtrations_values().T,
7336
7713
  strategy=grid_strategy,
7337
7714
  **infer_grid_kwargs,
@@ -7378,7 +7755,7 @@ cdef class _KSlicer_Matrix0_i64:
7378
7755
  if not force and self.is_squeezed:
7379
7756
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
7380
7757
  if filtration_grid is None:
7381
- filtration_grid = mpg.compute_grid(
7758
+ filtration_grid = compute_grid(
7382
7759
  self.get_filtrations_values().T,
7383
7760
  strategy=grid_strategy,
7384
7761
  resolution=resolution)
@@ -7428,6 +7805,33 @@ cdef class _KSlicer_Matrix0_i64:
7428
7805
  return "Matrix"
7429
7806
 
7430
7807
 
7808
+ def to_scc(
7809
+ self,
7810
+ path:os.PathLike,
7811
+ int num_parameters = -1,
7812
+ int degree = -1,
7813
+ bool rivet_compatible = False,
7814
+ bool ignore_last_generators = False,
7815
+ bool strip_comments = False,
7816
+ bool reverse = False,
7817
+ bool unsqueeze = True,
7818
+ ):
7819
+ """
7820
+ Writes current slicer to a file in scc format.
7821
+ """
7822
+ if degree == -1 and not rivet_compatible:
7823
+ degree = 1
7824
+ cdef string c_path = path.encode(encoding="utf-8")
7825
+ if self.is_squeezed and unsqueeze:
7826
+ kwargs = locals()
7827
+ kwargs.pop("self",0)
7828
+ kwargs.pop("c_path",0)
7829
+ self.unsqueeze().to_scc(**kwargs)
7830
+ return
7831
+ with nogil:
7832
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
7833
+
7834
+
7431
7835
  #------------------------------------------------------------------------------
7432
7836
  cdef class _KSlicer_Matrix1_i64:
7433
7837
  cdef C_KSlicer_Matrix1_i64 truc
@@ -7505,10 +7909,14 @@ cdef class _KSlicer_Matrix1_i64:
7505
7909
  copy_.minpres_degree = self.minpres_degree
7506
7910
  copy_.filtration_grid = self.filtration_grid
7507
7911
  return copy_
7508
- def get_barcode(self):
7912
+ def get_barcode(self, bool keep_inf = False):
7509
7913
  """
7510
7914
  Returns the current barcode.
7511
7915
  """
7916
+ if keep_inf:
7917
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
7918
+ else:
7919
+ bcs = _KSlicer_Matrix1_i64._threshold_bcs(self.truc.get_barcode())
7512
7920
  return self.truc.get_barcode()
7513
7921
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_i64:
7514
7922
  """
@@ -7672,7 +8080,7 @@ cdef class _KSlicer_Matrix1_i64:
7672
8080
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
7673
8081
  return np.asarray(out)
7674
8082
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
7675
- return mpg.compute_grid(
8083
+ return compute_grid(
7676
8084
  self.get_filtrations_values().T,
7677
8085
  strategy=grid_strategy,
7678
8086
  **infer_grid_kwargs,
@@ -7719,7 +8127,7 @@ cdef class _KSlicer_Matrix1_i64:
7719
8127
  if not force and self.is_squeezed:
7720
8128
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
7721
8129
  if filtration_grid is None:
7722
- filtration_grid = mpg.compute_grid(
8130
+ filtration_grid = compute_grid(
7723
8131
  self.get_filtrations_values().T,
7724
8132
  strategy=grid_strategy,
7725
8133
  resolution=resolution)
@@ -7769,6 +8177,33 @@ cdef class _KSlicer_Matrix1_i64:
7769
8177
  return "Matrix"
7770
8178
 
7771
8179
 
8180
+ def to_scc(
8181
+ self,
8182
+ path:os.PathLike,
8183
+ int num_parameters = -1,
8184
+ int degree = -1,
8185
+ bool rivet_compatible = False,
8186
+ bool ignore_last_generators = False,
8187
+ bool strip_comments = False,
8188
+ bool reverse = False,
8189
+ bool unsqueeze = True,
8190
+ ):
8191
+ """
8192
+ Writes current slicer to a file in scc format.
8193
+ """
8194
+ if degree == -1 and not rivet_compatible:
8195
+ degree = 1
8196
+ cdef string c_path = path.encode(encoding="utf-8")
8197
+ if self.is_squeezed and unsqueeze:
8198
+ kwargs = locals()
8199
+ kwargs.pop("self",0)
8200
+ kwargs.pop("c_path",0)
8201
+ self.unsqueeze().to_scc(**kwargs)
8202
+ return
8203
+ with nogil:
8204
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
8205
+
8206
+
7772
8207
  #------------------------------------------------------------------------------
7773
8208
  cdef class _KSlicer_Matrix0_f32:
7774
8209
  cdef C_KSlicer_Matrix0_f32 truc
@@ -7846,10 +8281,14 @@ cdef class _KSlicer_Matrix0_f32:
7846
8281
  copy_.minpres_degree = self.minpres_degree
7847
8282
  copy_.filtration_grid = self.filtration_grid
7848
8283
  return copy_
7849
- def get_barcode(self):
8284
+ def get_barcode(self, bool keep_inf = False):
7850
8285
  """
7851
8286
  Returns the current barcode.
7852
8287
  """
8288
+ if keep_inf:
8289
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
8290
+ else:
8291
+ bcs = _KSlicer_Matrix0_f32._threshold_bcs(self.truc.get_barcode())
7853
8292
  return self.truc.get_barcode()
7854
8293
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_f32:
7855
8294
  """
@@ -8013,7 +8452,7 @@ cdef class _KSlicer_Matrix0_f32:
8013
8452
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
8014
8453
  return np.asarray(out)
8015
8454
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
8016
- return mpg.compute_grid(
8455
+ return compute_grid(
8017
8456
  self.get_filtrations_values().T,
8018
8457
  strategy=grid_strategy,
8019
8458
  **infer_grid_kwargs,
@@ -8060,7 +8499,7 @@ cdef class _KSlicer_Matrix0_f32:
8060
8499
  if not force and self.is_squeezed:
8061
8500
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
8062
8501
  if filtration_grid is None:
8063
- filtration_grid = mpg.compute_grid(
8502
+ filtration_grid = compute_grid(
8064
8503
  self.get_filtrations_values().T,
8065
8504
  strategy=grid_strategy,
8066
8505
  resolution=resolution)
@@ -8110,6 +8549,33 @@ cdef class _KSlicer_Matrix0_f32:
8110
8549
  return "Matrix"
8111
8550
 
8112
8551
 
8552
+ def to_scc(
8553
+ self,
8554
+ path:os.PathLike,
8555
+ int num_parameters = -1,
8556
+ int degree = -1,
8557
+ bool rivet_compatible = False,
8558
+ bool ignore_last_generators = False,
8559
+ bool strip_comments = False,
8560
+ bool reverse = False,
8561
+ bool unsqueeze = True,
8562
+ ):
8563
+ """
8564
+ Writes current slicer to a file in scc format.
8565
+ """
8566
+ if degree == -1 and not rivet_compatible:
8567
+ degree = 1
8568
+ cdef string c_path = path.encode(encoding="utf-8")
8569
+ if self.is_squeezed and unsqueeze:
8570
+ kwargs = locals()
8571
+ kwargs.pop("self",0)
8572
+ kwargs.pop("c_path",0)
8573
+ self.unsqueeze().to_scc(**kwargs)
8574
+ return
8575
+ with nogil:
8576
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
8577
+
8578
+
8113
8579
  #------------------------------------------------------------------------------
8114
8580
  cdef class _KSlicer_Matrix1_f32:
8115
8581
  cdef C_KSlicer_Matrix1_f32 truc
@@ -8187,10 +8653,14 @@ cdef class _KSlicer_Matrix1_f32:
8187
8653
  copy_.minpres_degree = self.minpres_degree
8188
8654
  copy_.filtration_grid = self.filtration_grid
8189
8655
  return copy_
8190
- def get_barcode(self):
8656
+ def get_barcode(self, bool keep_inf = False):
8191
8657
  """
8192
8658
  Returns the current barcode.
8193
8659
  """
8660
+ if keep_inf:
8661
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
8662
+ else:
8663
+ bcs = _KSlicer_Matrix1_f32._threshold_bcs(self.truc.get_barcode())
8194
8664
  return self.truc.get_barcode()
8195
8665
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_f32:
8196
8666
  """
@@ -8354,7 +8824,7 @@ cdef class _KSlicer_Matrix1_f32:
8354
8824
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
8355
8825
  return np.asarray(out)
8356
8826
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
8357
- return mpg.compute_grid(
8827
+ return compute_grid(
8358
8828
  self.get_filtrations_values().T,
8359
8829
  strategy=grid_strategy,
8360
8830
  **infer_grid_kwargs,
@@ -8401,7 +8871,7 @@ cdef class _KSlicer_Matrix1_f32:
8401
8871
  if not force and self.is_squeezed:
8402
8872
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
8403
8873
  if filtration_grid is None:
8404
- filtration_grid = mpg.compute_grid(
8874
+ filtration_grid = compute_grid(
8405
8875
  self.get_filtrations_values().T,
8406
8876
  strategy=grid_strategy,
8407
8877
  resolution=resolution)
@@ -8451,6 +8921,33 @@ cdef class _KSlicer_Matrix1_f32:
8451
8921
  return "Matrix"
8452
8922
 
8453
8923
 
8924
+ def to_scc(
8925
+ self,
8926
+ path:os.PathLike,
8927
+ int num_parameters = -1,
8928
+ int degree = -1,
8929
+ bool rivet_compatible = False,
8930
+ bool ignore_last_generators = False,
8931
+ bool strip_comments = False,
8932
+ bool reverse = False,
8933
+ bool unsqueeze = True,
8934
+ ):
8935
+ """
8936
+ Writes current slicer to a file in scc format.
8937
+ """
8938
+ if degree == -1 and not rivet_compatible:
8939
+ degree = 1
8940
+ cdef string c_path = path.encode(encoding="utf-8")
8941
+ if self.is_squeezed and unsqueeze:
8942
+ kwargs = locals()
8943
+ kwargs.pop("self",0)
8944
+ kwargs.pop("c_path",0)
8945
+ self.unsqueeze().to_scc(**kwargs)
8946
+ return
8947
+ with nogil:
8948
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
8949
+
8950
+
8454
8951
  #------------------------------------------------------------------------------
8455
8952
  cdef class _KSlicer_Matrix0_f64:
8456
8953
  cdef C_KSlicer_Matrix0_f64 truc
@@ -8528,10 +9025,14 @@ cdef class _KSlicer_Matrix0_f64:
8528
9025
  copy_.minpres_degree = self.minpres_degree
8529
9026
  copy_.filtration_grid = self.filtration_grid
8530
9027
  return copy_
8531
- def get_barcode(self):
9028
+ def get_barcode(self, bool keep_inf = False):
8532
9029
  """
8533
9030
  Returns the current barcode.
8534
9031
  """
9032
+ if keep_inf:
9033
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
9034
+ else:
9035
+ bcs = _KSlicer_Matrix0_f64._threshold_bcs(self.truc.get_barcode())
8535
9036
  return self.truc.get_barcode()
8536
9037
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix0_f64:
8537
9038
  """
@@ -8695,7 +9196,7 @@ cdef class _KSlicer_Matrix0_f64:
8695
9196
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
8696
9197
  return np.asarray(out)
8697
9198
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
8698
- return mpg.compute_grid(
9199
+ return compute_grid(
8699
9200
  self.get_filtrations_values().T,
8700
9201
  strategy=grid_strategy,
8701
9202
  **infer_grid_kwargs,
@@ -8742,7 +9243,7 @@ cdef class _KSlicer_Matrix0_f64:
8742
9243
  if not force and self.is_squeezed:
8743
9244
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
8744
9245
  if filtration_grid is None:
8745
- filtration_grid = mpg.compute_grid(
9246
+ filtration_grid = compute_grid(
8746
9247
  self.get_filtrations_values().T,
8747
9248
  strategy=grid_strategy,
8748
9249
  resolution=resolution)
@@ -8792,6 +9293,33 @@ cdef class _KSlicer_Matrix0_f64:
8792
9293
  return "Matrix"
8793
9294
 
8794
9295
 
9296
+ def to_scc(
9297
+ self,
9298
+ path:os.PathLike,
9299
+ int num_parameters = -1,
9300
+ int degree = -1,
9301
+ bool rivet_compatible = False,
9302
+ bool ignore_last_generators = False,
9303
+ bool strip_comments = False,
9304
+ bool reverse = False,
9305
+ bool unsqueeze = True,
9306
+ ):
9307
+ """
9308
+ Writes current slicer to a file in scc format.
9309
+ """
9310
+ if degree == -1 and not rivet_compatible:
9311
+ degree = 1
9312
+ cdef string c_path = path.encode(encoding="utf-8")
9313
+ if self.is_squeezed and unsqueeze:
9314
+ kwargs = locals()
9315
+ kwargs.pop("self",0)
9316
+ kwargs.pop("c_path",0)
9317
+ self.unsqueeze().to_scc(**kwargs)
9318
+ return
9319
+ with nogil:
9320
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
9321
+
9322
+
8795
9323
  #------------------------------------------------------------------------------
8796
9324
  cdef class _KSlicer_Matrix1_f64:
8797
9325
  cdef C_KSlicer_Matrix1_f64 truc
@@ -8869,10 +9397,14 @@ cdef class _KSlicer_Matrix1_f64:
8869
9397
  copy_.minpres_degree = self.minpres_degree
8870
9398
  copy_.filtration_grid = self.filtration_grid
8871
9399
  return copy_
8872
- def get_barcode(self):
9400
+ def get_barcode(self, bool keep_inf = False):
8873
9401
  """
8874
9402
  Returns the current barcode.
8875
9403
  """
9404
+ if keep_inf:
9405
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
9406
+ else:
9407
+ bcs = _KSlicer_Matrix1_f64._threshold_bcs(self.truc.get_barcode())
8876
9408
  return self.truc.get_barcode()
8877
9409
  def push_to_line(self, basepoint, direction=None)->_KSlicer_Matrix1_f64:
8878
9410
  """
@@ -9036,7 +9568,7 @@ cdef class _KSlicer_Matrix1_f64:
9036
9568
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
9037
9569
  return np.asarray(out)
9038
9570
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
9039
- return mpg.compute_grid(
9571
+ return compute_grid(
9040
9572
  self.get_filtrations_values().T,
9041
9573
  strategy=grid_strategy,
9042
9574
  **infer_grid_kwargs,
@@ -9083,7 +9615,7 @@ cdef class _KSlicer_Matrix1_f64:
9083
9615
  if not force and self.is_squeezed:
9084
9616
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
9085
9617
  if filtration_grid is None:
9086
- filtration_grid = mpg.compute_grid(
9618
+ filtration_grid = compute_grid(
9087
9619
  self.get_filtrations_values().T,
9088
9620
  strategy=grid_strategy,
9089
9621
  resolution=resolution)
@@ -9133,6 +9665,33 @@ cdef class _KSlicer_Matrix1_f64:
9133
9665
  return "Matrix"
9134
9666
 
9135
9667
 
9668
+ def to_scc(
9669
+ self,
9670
+ path:os.PathLike,
9671
+ int num_parameters = -1,
9672
+ int degree = -1,
9673
+ bool rivet_compatible = False,
9674
+ bool ignore_last_generators = False,
9675
+ bool strip_comments = False,
9676
+ bool reverse = False,
9677
+ bool unsqueeze = True,
9678
+ ):
9679
+ """
9680
+ Writes current slicer to a file in scc format.
9681
+ """
9682
+ if degree == -1 and not rivet_compatible:
9683
+ degree = 1
9684
+ cdef string c_path = path.encode(encoding="utf-8")
9685
+ if self.is_squeezed and unsqueeze:
9686
+ kwargs = locals()
9687
+ kwargs.pop("self",0)
9688
+ kwargs.pop("c_path",0)
9689
+ self.unsqueeze().to_scc(**kwargs)
9690
+ return
9691
+ with nogil:
9692
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
9693
+
9694
+
9136
9695
  #------------------------------------------------------------------------------
9137
9696
  cdef class _Slicer_Matrix0_i32:
9138
9697
  cdef C_Slicer_Matrix0_i32 truc
@@ -9201,10 +9760,14 @@ cdef class _Slicer_Matrix0_i32:
9201
9760
  copy_.minpres_degree = self.minpres_degree
9202
9761
  copy_.filtration_grid = self.filtration_grid
9203
9762
  return copy_
9204
- def get_barcode(self):
9763
+ def get_barcode(self, bool keep_inf = False):
9205
9764
  """
9206
9765
  Returns the current barcode.
9207
9766
  """
9767
+ if keep_inf:
9768
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
9769
+ else:
9770
+ bcs = _Slicer_Matrix0_i32._threshold_bcs(self.truc.get_barcode())
9208
9771
  return self.truc.get_barcode()
9209
9772
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_i32:
9210
9773
  """
@@ -9368,7 +9931,7 @@ cdef class _Slicer_Matrix0_i32:
9368
9931
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
9369
9932
  return np.asarray(out)
9370
9933
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
9371
- return mpg.compute_grid(
9934
+ return compute_grid(
9372
9935
  self.get_filtrations_values().T,
9373
9936
  strategy=grid_strategy,
9374
9937
  **infer_grid_kwargs,
@@ -9415,7 +9978,7 @@ cdef class _Slicer_Matrix0_i32:
9415
9978
  if not force and self.is_squeezed:
9416
9979
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
9417
9980
  if filtration_grid is None:
9418
- filtration_grid = mpg.compute_grid(
9981
+ filtration_grid = compute_grid(
9419
9982
  self.get_filtrations_values().T,
9420
9983
  strategy=grid_strategy,
9421
9984
  resolution=resolution)
@@ -9464,20 +10027,12 @@ cdef class _Slicer_Matrix0_i32:
9464
10027
  def pers_backend(self)->str:
9465
10028
  return "Matrix"
9466
10029
 
9467
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_i32:
9468
- """
9469
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
9470
- """
9471
- cdef string c_path = path.encode(encoding="utf-8")
9472
- with nogil:
9473
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
9474
- return self
9475
10030
 
9476
10031
  def to_scc(
9477
10032
  self,
9478
10033
  path:os.PathLike,
9479
10034
  int num_parameters = -1,
9480
- int degree = 1,
10035
+ int degree = -1,
9481
10036
  bool rivet_compatible = False,
9482
10037
  bool ignore_last_generators = False,
9483
10038
  bool strip_comments = False,
@@ -9487,6 +10042,8 @@ cdef class _Slicer_Matrix0_i32:
9487
10042
  """
9488
10043
  Writes current slicer to a file in scc format.
9489
10044
  """
10045
+ if degree == -1 and not rivet_compatible:
10046
+ degree = 1
9490
10047
  cdef string c_path = path.encode(encoding="utf-8")
9491
10048
  if self.is_squeezed and unsqueeze:
9492
10049
  kwargs = locals()
@@ -9496,6 +10053,16 @@ cdef class _Slicer_Matrix0_i32:
9496
10053
  return
9497
10054
  with nogil:
9498
10055
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
10056
+
10057
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_i32:
10058
+ """
10059
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10060
+ """
10061
+ cdef string c_path = path.encode(encoding="utf-8")
10062
+ with nogil:
10063
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10064
+ return self
10065
+
9499
10066
  def unsqueeze(self, grid=None, dtype = np.float64):
9500
10067
  from multipers.grids import evaluate_in_grid
9501
10068
  from multipers import Slicer
@@ -9577,10 +10144,14 @@ cdef class _Slicer_Matrix1_i32:
9577
10144
  copy_.minpres_degree = self.minpres_degree
9578
10145
  copy_.filtration_grid = self.filtration_grid
9579
10146
  return copy_
9580
- def get_barcode(self):
10147
+ def get_barcode(self, bool keep_inf = False):
9581
10148
  """
9582
10149
  Returns the current barcode.
9583
10150
  """
10151
+ if keep_inf:
10152
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
10153
+ else:
10154
+ bcs = _Slicer_Matrix1_i32._threshold_bcs(self.truc.get_barcode())
9584
10155
  return self.truc.get_barcode()
9585
10156
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_i32:
9586
10157
  """
@@ -9744,7 +10315,7 @@ cdef class _Slicer_Matrix1_i32:
9744
10315
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
9745
10316
  return np.asarray(out)
9746
10317
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
9747
- return mpg.compute_grid(
10318
+ return compute_grid(
9748
10319
  self.get_filtrations_values().T,
9749
10320
  strategy=grid_strategy,
9750
10321
  **infer_grid_kwargs,
@@ -9791,7 +10362,7 @@ cdef class _Slicer_Matrix1_i32:
9791
10362
  if not force and self.is_squeezed:
9792
10363
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
9793
10364
  if filtration_grid is None:
9794
- filtration_grid = mpg.compute_grid(
10365
+ filtration_grid = compute_grid(
9795
10366
  self.get_filtrations_values().T,
9796
10367
  strategy=grid_strategy,
9797
10368
  resolution=resolution)
@@ -9840,20 +10411,12 @@ cdef class _Slicer_Matrix1_i32:
9840
10411
  def pers_backend(self)->str:
9841
10412
  return "Matrix"
9842
10413
 
9843
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_i32:
9844
- """
9845
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
9846
- """
9847
- cdef string c_path = path.encode(encoding="utf-8")
9848
- with nogil:
9849
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
9850
- return self
9851
10414
 
9852
10415
  def to_scc(
9853
10416
  self,
9854
10417
  path:os.PathLike,
9855
10418
  int num_parameters = -1,
9856
- int degree = 1,
10419
+ int degree = -1,
9857
10420
  bool rivet_compatible = False,
9858
10421
  bool ignore_last_generators = False,
9859
10422
  bool strip_comments = False,
@@ -9863,6 +10426,8 @@ cdef class _Slicer_Matrix1_i32:
9863
10426
  """
9864
10427
  Writes current slicer to a file in scc format.
9865
10428
  """
10429
+ if degree == -1 and not rivet_compatible:
10430
+ degree = 1
9866
10431
  cdef string c_path = path.encode(encoding="utf-8")
9867
10432
  if self.is_squeezed and unsqueeze:
9868
10433
  kwargs = locals()
@@ -9872,6 +10437,16 @@ cdef class _Slicer_Matrix1_i32:
9872
10437
  return
9873
10438
  with nogil:
9874
10439
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
10440
+
10441
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_i32:
10442
+ """
10443
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10444
+ """
10445
+ cdef string c_path = path.encode(encoding="utf-8")
10446
+ with nogil:
10447
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10448
+ return self
10449
+
9875
10450
  def unsqueeze(self, grid=None, dtype = np.float64):
9876
10451
  from multipers.grids import evaluate_in_grid
9877
10452
  from multipers import Slicer
@@ -9953,10 +10528,14 @@ cdef class _Slicer_Matrix0_i64:
9953
10528
  copy_.minpres_degree = self.minpres_degree
9954
10529
  copy_.filtration_grid = self.filtration_grid
9955
10530
  return copy_
9956
- def get_barcode(self):
10531
+ def get_barcode(self, bool keep_inf = False):
9957
10532
  """
9958
10533
  Returns the current barcode.
9959
10534
  """
10535
+ if keep_inf:
10536
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
10537
+ else:
10538
+ bcs = _Slicer_Matrix0_i64._threshold_bcs(self.truc.get_barcode())
9960
10539
  return self.truc.get_barcode()
9961
10540
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_i64:
9962
10541
  """
@@ -10120,7 +10699,7 @@ cdef class _Slicer_Matrix0_i64:
10120
10699
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
10121
10700
  return np.asarray(out)
10122
10701
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
10123
- return mpg.compute_grid(
10702
+ return compute_grid(
10124
10703
  self.get_filtrations_values().T,
10125
10704
  strategy=grid_strategy,
10126
10705
  **infer_grid_kwargs,
@@ -10167,7 +10746,7 @@ cdef class _Slicer_Matrix0_i64:
10167
10746
  if not force and self.is_squeezed:
10168
10747
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
10169
10748
  if filtration_grid is None:
10170
- filtration_grid = mpg.compute_grid(
10749
+ filtration_grid = compute_grid(
10171
10750
  self.get_filtrations_values().T,
10172
10751
  strategy=grid_strategy,
10173
10752
  resolution=resolution)
@@ -10216,20 +10795,12 @@ cdef class _Slicer_Matrix0_i64:
10216
10795
  def pers_backend(self)->str:
10217
10796
  return "Matrix"
10218
10797
 
10219
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_i64:
10220
- """
10221
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10222
- """
10223
- cdef string c_path = path.encode(encoding="utf-8")
10224
- with nogil:
10225
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10226
- return self
10227
10798
 
10228
10799
  def to_scc(
10229
10800
  self,
10230
10801
  path:os.PathLike,
10231
10802
  int num_parameters = -1,
10232
- int degree = 1,
10803
+ int degree = -1,
10233
10804
  bool rivet_compatible = False,
10234
10805
  bool ignore_last_generators = False,
10235
10806
  bool strip_comments = False,
@@ -10239,6 +10810,8 @@ cdef class _Slicer_Matrix0_i64:
10239
10810
  """
10240
10811
  Writes current slicer to a file in scc format.
10241
10812
  """
10813
+ if degree == -1 and not rivet_compatible:
10814
+ degree = 1
10242
10815
  cdef string c_path = path.encode(encoding="utf-8")
10243
10816
  if self.is_squeezed and unsqueeze:
10244
10817
  kwargs = locals()
@@ -10248,6 +10821,16 @@ cdef class _Slicer_Matrix0_i64:
10248
10821
  return
10249
10822
  with nogil:
10250
10823
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
10824
+
10825
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_i64:
10826
+ """
10827
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10828
+ """
10829
+ cdef string c_path = path.encode(encoding="utf-8")
10830
+ with nogil:
10831
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10832
+ return self
10833
+
10251
10834
  def unsqueeze(self, grid=None, dtype = np.float64):
10252
10835
  from multipers.grids import evaluate_in_grid
10253
10836
  from multipers import Slicer
@@ -10329,10 +10912,14 @@ cdef class _Slicer_Matrix1_i64:
10329
10912
  copy_.minpres_degree = self.minpres_degree
10330
10913
  copy_.filtration_grid = self.filtration_grid
10331
10914
  return copy_
10332
- def get_barcode(self):
10915
+ def get_barcode(self, bool keep_inf = False):
10333
10916
  """
10334
10917
  Returns the current barcode.
10335
10918
  """
10919
+ if keep_inf:
10920
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
10921
+ else:
10922
+ bcs = _Slicer_Matrix1_i64._threshold_bcs(self.truc.get_barcode())
10336
10923
  return self.truc.get_barcode()
10337
10924
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_i64:
10338
10925
  """
@@ -10496,7 +11083,7 @@ cdef class _Slicer_Matrix1_i64:
10496
11083
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
10497
11084
  return np.asarray(out)
10498
11085
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
10499
- return mpg.compute_grid(
11086
+ return compute_grid(
10500
11087
  self.get_filtrations_values().T,
10501
11088
  strategy=grid_strategy,
10502
11089
  **infer_grid_kwargs,
@@ -10543,7 +11130,7 @@ cdef class _Slicer_Matrix1_i64:
10543
11130
  if not force and self.is_squeezed:
10544
11131
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
10545
11132
  if filtration_grid is None:
10546
- filtration_grid = mpg.compute_grid(
11133
+ filtration_grid = compute_grid(
10547
11134
  self.get_filtrations_values().T,
10548
11135
  strategy=grid_strategy,
10549
11136
  resolution=resolution)
@@ -10592,20 +11179,12 @@ cdef class _Slicer_Matrix1_i64:
10592
11179
  def pers_backend(self)->str:
10593
11180
  return "Matrix"
10594
11181
 
10595
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_i64:
10596
- """
10597
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10598
- """
10599
- cdef string c_path = path.encode(encoding="utf-8")
10600
- with nogil:
10601
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10602
- return self
10603
11182
 
10604
11183
  def to_scc(
10605
11184
  self,
10606
11185
  path:os.PathLike,
10607
11186
  int num_parameters = -1,
10608
- int degree = 1,
11187
+ int degree = -1,
10609
11188
  bool rivet_compatible = False,
10610
11189
  bool ignore_last_generators = False,
10611
11190
  bool strip_comments = False,
@@ -10615,6 +11194,8 @@ cdef class _Slicer_Matrix1_i64:
10615
11194
  """
10616
11195
  Writes current slicer to a file in scc format.
10617
11196
  """
11197
+ if degree == -1 and not rivet_compatible:
11198
+ degree = 1
10618
11199
  cdef string c_path = path.encode(encoding="utf-8")
10619
11200
  if self.is_squeezed and unsqueeze:
10620
11201
  kwargs = locals()
@@ -10624,6 +11205,16 @@ cdef class _Slicer_Matrix1_i64:
10624
11205
  return
10625
11206
  with nogil:
10626
11207
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
11208
+
11209
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_i64:
11210
+ """
11211
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
11212
+ """
11213
+ cdef string c_path = path.encode(encoding="utf-8")
11214
+ with nogil:
11215
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
11216
+ return self
11217
+
10627
11218
  def unsqueeze(self, grid=None, dtype = np.float64):
10628
11219
  from multipers.grids import evaluate_in_grid
10629
11220
  from multipers import Slicer
@@ -10705,10 +11296,14 @@ cdef class _Slicer_Matrix0_f32:
10705
11296
  copy_.minpres_degree = self.minpres_degree
10706
11297
  copy_.filtration_grid = self.filtration_grid
10707
11298
  return copy_
10708
- def get_barcode(self):
11299
+ def get_barcode(self, bool keep_inf = False):
10709
11300
  """
10710
11301
  Returns the current barcode.
10711
11302
  """
11303
+ if keep_inf:
11304
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
11305
+ else:
11306
+ bcs = _Slicer_Matrix0_f32._threshold_bcs(self.truc.get_barcode())
10712
11307
  return self.truc.get_barcode()
10713
11308
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_f32:
10714
11309
  """
@@ -10872,7 +11467,7 @@ cdef class _Slicer_Matrix0_f32:
10872
11467
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
10873
11468
  return np.asarray(out)
10874
11469
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
10875
- return mpg.compute_grid(
11470
+ return compute_grid(
10876
11471
  self.get_filtrations_values().T,
10877
11472
  strategy=grid_strategy,
10878
11473
  **infer_grid_kwargs,
@@ -10919,7 +11514,7 @@ cdef class _Slicer_Matrix0_f32:
10919
11514
  if not force and self.is_squeezed:
10920
11515
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
10921
11516
  if filtration_grid is None:
10922
- filtration_grid = mpg.compute_grid(
11517
+ filtration_grid = compute_grid(
10923
11518
  self.get_filtrations_values().T,
10924
11519
  strategy=grid_strategy,
10925
11520
  resolution=resolution)
@@ -10968,20 +11563,12 @@ cdef class _Slicer_Matrix0_f32:
10968
11563
  def pers_backend(self)->str:
10969
11564
  return "Matrix"
10970
11565
 
10971
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_f32:
10972
- """
10973
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
10974
- """
10975
- cdef string c_path = path.encode(encoding="utf-8")
10976
- with nogil:
10977
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
10978
- return self
10979
11566
 
10980
11567
  def to_scc(
10981
11568
  self,
10982
11569
  path:os.PathLike,
10983
11570
  int num_parameters = -1,
10984
- int degree = 1,
11571
+ int degree = -1,
10985
11572
  bool rivet_compatible = False,
10986
11573
  bool ignore_last_generators = False,
10987
11574
  bool strip_comments = False,
@@ -10991,6 +11578,8 @@ cdef class _Slicer_Matrix0_f32:
10991
11578
  """
10992
11579
  Writes current slicer to a file in scc format.
10993
11580
  """
11581
+ if degree == -1 and not rivet_compatible:
11582
+ degree = 1
10994
11583
  cdef string c_path = path.encode(encoding="utf-8")
10995
11584
  if self.is_squeezed and unsqueeze:
10996
11585
  kwargs = locals()
@@ -11000,6 +11589,16 @@ cdef class _Slicer_Matrix0_f32:
11000
11589
  return
11001
11590
  with nogil:
11002
11591
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
11592
+
11593
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_f32:
11594
+ """
11595
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
11596
+ """
11597
+ cdef string c_path = path.encode(encoding="utf-8")
11598
+ with nogil:
11599
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
11600
+ return self
11601
+
11003
11602
  def unsqueeze(self, grid=None, dtype = np.float64):
11004
11603
  from multipers.grids import evaluate_in_grid
11005
11604
  from multipers import Slicer
@@ -11081,10 +11680,14 @@ cdef class _Slicer_Matrix1_f32:
11081
11680
  copy_.minpres_degree = self.minpres_degree
11082
11681
  copy_.filtration_grid = self.filtration_grid
11083
11682
  return copy_
11084
- def get_barcode(self):
11683
+ def get_barcode(self, bool keep_inf = False):
11085
11684
  """
11086
11685
  Returns the current barcode.
11087
11686
  """
11687
+ if keep_inf:
11688
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
11689
+ else:
11690
+ bcs = _Slicer_Matrix1_f32._threshold_bcs(self.truc.get_barcode())
11088
11691
  return self.truc.get_barcode()
11089
11692
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_f32:
11090
11693
  """
@@ -11248,7 +11851,7 @@ cdef class _Slicer_Matrix1_f32:
11248
11851
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
11249
11852
  return np.asarray(out)
11250
11853
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
11251
- return mpg.compute_grid(
11854
+ return compute_grid(
11252
11855
  self.get_filtrations_values().T,
11253
11856
  strategy=grid_strategy,
11254
11857
  **infer_grid_kwargs,
@@ -11295,7 +11898,7 @@ cdef class _Slicer_Matrix1_f32:
11295
11898
  if not force and self.is_squeezed:
11296
11899
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
11297
11900
  if filtration_grid is None:
11298
- filtration_grid = mpg.compute_grid(
11901
+ filtration_grid = compute_grid(
11299
11902
  self.get_filtrations_values().T,
11300
11903
  strategy=grid_strategy,
11301
11904
  resolution=resolution)
@@ -11344,20 +11947,12 @@ cdef class _Slicer_Matrix1_f32:
11344
11947
  def pers_backend(self)->str:
11345
11948
  return "Matrix"
11346
11949
 
11347
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_f32:
11348
- """
11349
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
11350
- """
11351
- cdef string c_path = path.encode(encoding="utf-8")
11352
- with nogil:
11353
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
11354
- return self
11355
11950
 
11356
11951
  def to_scc(
11357
11952
  self,
11358
11953
  path:os.PathLike,
11359
11954
  int num_parameters = -1,
11360
- int degree = 1,
11955
+ int degree = -1,
11361
11956
  bool rivet_compatible = False,
11362
11957
  bool ignore_last_generators = False,
11363
11958
  bool strip_comments = False,
@@ -11367,6 +11962,8 @@ cdef class _Slicer_Matrix1_f32:
11367
11962
  """
11368
11963
  Writes current slicer to a file in scc format.
11369
11964
  """
11965
+ if degree == -1 and not rivet_compatible:
11966
+ degree = 1
11370
11967
  cdef string c_path = path.encode(encoding="utf-8")
11371
11968
  if self.is_squeezed and unsqueeze:
11372
11969
  kwargs = locals()
@@ -11376,6 +11973,16 @@ cdef class _Slicer_Matrix1_f32:
11376
11973
  return
11377
11974
  with nogil:
11378
11975
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
11976
+
11977
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_f32:
11978
+ """
11979
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
11980
+ """
11981
+ cdef string c_path = path.encode(encoding="utf-8")
11982
+ with nogil:
11983
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
11984
+ return self
11985
+
11379
11986
  def unsqueeze(self, grid=None, dtype = np.float64):
11380
11987
  from multipers.grids import evaluate_in_grid
11381
11988
  from multipers import Slicer
@@ -11457,10 +12064,14 @@ cdef class _Slicer_Matrix0_f64:
11457
12064
  copy_.minpres_degree = self.minpres_degree
11458
12065
  copy_.filtration_grid = self.filtration_grid
11459
12066
  return copy_
11460
- def get_barcode(self):
12067
+ def get_barcode(self, bool keep_inf = False):
11461
12068
  """
11462
12069
  Returns the current barcode.
11463
12070
  """
12071
+ if keep_inf:
12072
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
12073
+ else:
12074
+ bcs = _Slicer_Matrix0_f64._threshold_bcs(self.truc.get_barcode())
11464
12075
  return self.truc.get_barcode()
11465
12076
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix0_f64:
11466
12077
  """
@@ -11624,7 +12235,7 @@ cdef class _Slicer_Matrix0_f64:
11624
12235
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
11625
12236
  return np.asarray(out)
11626
12237
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
11627
- return mpg.compute_grid(
12238
+ return compute_grid(
11628
12239
  self.get_filtrations_values().T,
11629
12240
  strategy=grid_strategy,
11630
12241
  **infer_grid_kwargs,
@@ -11671,7 +12282,7 @@ cdef class _Slicer_Matrix0_f64:
11671
12282
  if not force and self.is_squeezed:
11672
12283
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
11673
12284
  if filtration_grid is None:
11674
- filtration_grid = mpg.compute_grid(
12285
+ filtration_grid = compute_grid(
11675
12286
  self.get_filtrations_values().T,
11676
12287
  strategy=grid_strategy,
11677
12288
  resolution=resolution)
@@ -11720,20 +12331,12 @@ cdef class _Slicer_Matrix0_f64:
11720
12331
  def pers_backend(self)->str:
11721
12332
  return "Matrix"
11722
12333
 
11723
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_f64:
11724
- """
11725
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
11726
- """
11727
- cdef string c_path = path.encode(encoding="utf-8")
11728
- with nogil:
11729
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
11730
- return self
11731
12334
 
11732
12335
  def to_scc(
11733
12336
  self,
11734
12337
  path:os.PathLike,
11735
12338
  int num_parameters = -1,
11736
- int degree = 1,
12339
+ int degree = -1,
11737
12340
  bool rivet_compatible = False,
11738
12341
  bool ignore_last_generators = False,
11739
12342
  bool strip_comments = False,
@@ -11743,6 +12346,8 @@ cdef class _Slicer_Matrix0_f64:
11743
12346
  """
11744
12347
  Writes current slicer to a file in scc format.
11745
12348
  """
12349
+ if degree == -1 and not rivet_compatible:
12350
+ degree = 1
11746
12351
  cdef string c_path = path.encode(encoding="utf-8")
11747
12352
  if self.is_squeezed and unsqueeze:
11748
12353
  kwargs = locals()
@@ -11752,6 +12357,16 @@ cdef class _Slicer_Matrix0_f64:
11752
12357
  return
11753
12358
  with nogil:
11754
12359
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
12360
+
12361
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix0_f64:
12362
+ """
12363
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
12364
+ """
12365
+ cdef string c_path = path.encode(encoding="utf-8")
12366
+ with nogil:
12367
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
12368
+ return self
12369
+
11755
12370
  def unsqueeze(self, grid=None, dtype = np.float64):
11756
12371
  from multipers.grids import evaluate_in_grid
11757
12372
  from multipers import Slicer
@@ -11833,10 +12448,14 @@ cdef class _Slicer_Matrix1_f64:
11833
12448
  copy_.minpres_degree = self.minpres_degree
11834
12449
  copy_.filtration_grid = self.filtration_grid
11835
12450
  return copy_
11836
- def get_barcode(self):
12451
+ def get_barcode(self, bool keep_inf = False):
11837
12452
  """
11838
12453
  Returns the current barcode.
11839
12454
  """
12455
+ if keep_inf:
12456
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
12457
+ else:
12458
+ bcs = _Slicer_Matrix1_f64._threshold_bcs(self.truc.get_barcode())
11840
12459
  return self.truc.get_barcode()
11841
12460
  def push_to_line(self, basepoint, direction=None)->_Slicer_Matrix1_f64:
11842
12461
  """
@@ -12000,7 +12619,7 @@ cdef class _Slicer_Matrix1_f64:
12000
12619
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
12001
12620
  return np.asarray(out)
12002
12621
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
12003
- return mpg.compute_grid(
12622
+ return compute_grid(
12004
12623
  self.get_filtrations_values().T,
12005
12624
  strategy=grid_strategy,
12006
12625
  **infer_grid_kwargs,
@@ -12047,7 +12666,7 @@ cdef class _Slicer_Matrix1_f64:
12047
12666
  if not force and self.is_squeezed:
12048
12667
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
12049
12668
  if filtration_grid is None:
12050
- filtration_grid = mpg.compute_grid(
12669
+ filtration_grid = compute_grid(
12051
12670
  self.get_filtrations_values().T,
12052
12671
  strategy=grid_strategy,
12053
12672
  resolution=resolution)
@@ -12096,20 +12715,12 @@ cdef class _Slicer_Matrix1_f64:
12096
12715
  def pers_backend(self)->str:
12097
12716
  return "Matrix"
12098
12717
 
12099
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_f64:
12100
- """
12101
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
12102
- """
12103
- cdef string c_path = path.encode(encoding="utf-8")
12104
- with nogil:
12105
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
12106
- return self
12107
12718
 
12108
12719
  def to_scc(
12109
12720
  self,
12110
12721
  path:os.PathLike,
12111
12722
  int num_parameters = -1,
12112
- int degree = 1,
12723
+ int degree = -1,
12113
12724
  bool rivet_compatible = False,
12114
12725
  bool ignore_last_generators = False,
12115
12726
  bool strip_comments = False,
@@ -12119,6 +12730,8 @@ cdef class _Slicer_Matrix1_f64:
12119
12730
  """
12120
12731
  Writes current slicer to a file in scc format.
12121
12732
  """
12733
+ if degree == -1 and not rivet_compatible:
12734
+ degree = 1
12122
12735
  cdef string c_path = path.encode(encoding="utf-8")
12123
12736
  if self.is_squeezed and unsqueeze:
12124
12737
  kwargs = locals()
@@ -12128,6 +12741,16 @@ cdef class _Slicer_Matrix1_f64:
12128
12741
  return
12129
12742
  with nogil:
12130
12743
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
12744
+
12745
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_Matrix1_f64:
12746
+ """
12747
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
12748
+ """
12749
+ cdef string c_path = path.encode(encoding="utf-8")
12750
+ with nogil:
12751
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
12752
+ return self
12753
+
12131
12754
  def unsqueeze(self, grid=None, dtype = np.float64):
12132
12755
  from multipers.grids import evaluate_in_grid
12133
12756
  from multipers import Slicer
@@ -12218,10 +12841,14 @@ cdef class _KSlicer_GudhiCohomology0_i32:
12218
12841
  copy_.minpres_degree = self.minpres_degree
12219
12842
  copy_.filtration_grid = self.filtration_grid
12220
12843
  return copy_
12221
- def get_barcode(self):
12844
+ def get_barcode(self, bool keep_inf = False):
12222
12845
  """
12223
12846
  Returns the current barcode.
12224
12847
  """
12848
+ if keep_inf:
12849
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
12850
+ else:
12851
+ bcs = _KSlicer_GudhiCohomology0_i32._threshold_bcs(self.truc.get_barcode())
12225
12852
  return self.truc.get_barcode()
12226
12853
  def push_to_line(self, basepoint, direction=None)->_KSlicer_GudhiCohomology0_i32:
12227
12854
  """
@@ -12385,7 +13012,7 @@ cdef class _KSlicer_GudhiCohomology0_i32:
12385
13012
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
12386
13013
  return np.asarray(out)
12387
13014
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
12388
- return mpg.compute_grid(
13015
+ return compute_grid(
12389
13016
  self.get_filtrations_values().T,
12390
13017
  strategy=grid_strategy,
12391
13018
  **infer_grid_kwargs,
@@ -12432,7 +13059,7 @@ cdef class _KSlicer_GudhiCohomology0_i32:
12432
13059
  if not force and self.is_squeezed:
12433
13060
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
12434
13061
  if filtration_grid is None:
12435
- filtration_grid = mpg.compute_grid(
13062
+ filtration_grid = compute_grid(
12436
13063
  self.get_filtrations_values().T,
12437
13064
  strategy=grid_strategy,
12438
13065
  resolution=resolution)
@@ -12482,6 +13109,33 @@ cdef class _KSlicer_GudhiCohomology0_i32:
12482
13109
  return "GudhiCohomology"
12483
13110
 
12484
13111
 
13112
+ def to_scc(
13113
+ self,
13114
+ path:os.PathLike,
13115
+ int num_parameters = -1,
13116
+ int degree = -1,
13117
+ bool rivet_compatible = False,
13118
+ bool ignore_last_generators = False,
13119
+ bool strip_comments = False,
13120
+ bool reverse = False,
13121
+ bool unsqueeze = True,
13122
+ ):
13123
+ """
13124
+ Writes current slicer to a file in scc format.
13125
+ """
13126
+ if degree == -1 and not rivet_compatible:
13127
+ degree = 1
13128
+ cdef string c_path = path.encode(encoding="utf-8")
13129
+ if self.is_squeezed and unsqueeze:
13130
+ kwargs = locals()
13131
+ kwargs.pop("self",0)
13132
+ kwargs.pop("c_path",0)
13133
+ self.unsqueeze().to_scc(**kwargs)
13134
+ return
13135
+ with nogil:
13136
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
13137
+
13138
+
12485
13139
  #------------------------------------------------------------------------------
12486
13140
  cdef class _KSlicer_GudhiCohomology0_i64:
12487
13141
  cdef C_KSlicer_GudhiCohomology0_i64 truc
@@ -12559,10 +13213,14 @@ cdef class _KSlicer_GudhiCohomology0_i64:
12559
13213
  copy_.minpres_degree = self.minpres_degree
12560
13214
  copy_.filtration_grid = self.filtration_grid
12561
13215
  return copy_
12562
- def get_barcode(self):
13216
+ def get_barcode(self, bool keep_inf = False):
12563
13217
  """
12564
13218
  Returns the current barcode.
12565
13219
  """
13220
+ if keep_inf:
13221
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
13222
+ else:
13223
+ bcs = _KSlicer_GudhiCohomology0_i64._threshold_bcs(self.truc.get_barcode())
12566
13224
  return self.truc.get_barcode()
12567
13225
  def push_to_line(self, basepoint, direction=None)->_KSlicer_GudhiCohomology0_i64:
12568
13226
  """
@@ -12726,7 +13384,7 @@ cdef class _KSlicer_GudhiCohomology0_i64:
12726
13384
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
12727
13385
  return np.asarray(out)
12728
13386
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
12729
- return mpg.compute_grid(
13387
+ return compute_grid(
12730
13388
  self.get_filtrations_values().T,
12731
13389
  strategy=grid_strategy,
12732
13390
  **infer_grid_kwargs,
@@ -12773,7 +13431,7 @@ cdef class _KSlicer_GudhiCohomology0_i64:
12773
13431
  if not force and self.is_squeezed:
12774
13432
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
12775
13433
  if filtration_grid is None:
12776
- filtration_grid = mpg.compute_grid(
13434
+ filtration_grid = compute_grid(
12777
13435
  self.get_filtrations_values().T,
12778
13436
  strategy=grid_strategy,
12779
13437
  resolution=resolution)
@@ -12823,6 +13481,33 @@ cdef class _KSlicer_GudhiCohomology0_i64:
12823
13481
  return "GudhiCohomology"
12824
13482
 
12825
13483
 
13484
+ def to_scc(
13485
+ self,
13486
+ path:os.PathLike,
13487
+ int num_parameters = -1,
13488
+ int degree = -1,
13489
+ bool rivet_compatible = False,
13490
+ bool ignore_last_generators = False,
13491
+ bool strip_comments = False,
13492
+ bool reverse = False,
13493
+ bool unsqueeze = True,
13494
+ ):
13495
+ """
13496
+ Writes current slicer to a file in scc format.
13497
+ """
13498
+ if degree == -1 and not rivet_compatible:
13499
+ degree = 1
13500
+ cdef string c_path = path.encode(encoding="utf-8")
13501
+ if self.is_squeezed and unsqueeze:
13502
+ kwargs = locals()
13503
+ kwargs.pop("self",0)
13504
+ kwargs.pop("c_path",0)
13505
+ self.unsqueeze().to_scc(**kwargs)
13506
+ return
13507
+ with nogil:
13508
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
13509
+
13510
+
12826
13511
  #------------------------------------------------------------------------------
12827
13512
  cdef class _KSlicer_GudhiCohomology0_f32:
12828
13513
  cdef C_KSlicer_GudhiCohomology0_f32 truc
@@ -12900,10 +13585,14 @@ cdef class _KSlicer_GudhiCohomology0_f32:
12900
13585
  copy_.minpres_degree = self.minpres_degree
12901
13586
  copy_.filtration_grid = self.filtration_grid
12902
13587
  return copy_
12903
- def get_barcode(self):
13588
+ def get_barcode(self, bool keep_inf = False):
12904
13589
  """
12905
13590
  Returns the current barcode.
12906
13591
  """
13592
+ if keep_inf:
13593
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
13594
+ else:
13595
+ bcs = _KSlicer_GudhiCohomology0_f32._threshold_bcs(self.truc.get_barcode())
12907
13596
  return self.truc.get_barcode()
12908
13597
  def push_to_line(self, basepoint, direction=None)->_KSlicer_GudhiCohomology0_f32:
12909
13598
  """
@@ -13067,7 +13756,7 @@ cdef class _KSlicer_GudhiCohomology0_f32:
13067
13756
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
13068
13757
  return np.asarray(out)
13069
13758
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
13070
- return mpg.compute_grid(
13759
+ return compute_grid(
13071
13760
  self.get_filtrations_values().T,
13072
13761
  strategy=grid_strategy,
13073
13762
  **infer_grid_kwargs,
@@ -13114,7 +13803,7 @@ cdef class _KSlicer_GudhiCohomology0_f32:
13114
13803
  if not force and self.is_squeezed:
13115
13804
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
13116
13805
  if filtration_grid is None:
13117
- filtration_grid = mpg.compute_grid(
13806
+ filtration_grid = compute_grid(
13118
13807
  self.get_filtrations_values().T,
13119
13808
  strategy=grid_strategy,
13120
13809
  resolution=resolution)
@@ -13164,6 +13853,33 @@ cdef class _KSlicer_GudhiCohomology0_f32:
13164
13853
  return "GudhiCohomology"
13165
13854
 
13166
13855
 
13856
+ def to_scc(
13857
+ self,
13858
+ path:os.PathLike,
13859
+ int num_parameters = -1,
13860
+ int degree = -1,
13861
+ bool rivet_compatible = False,
13862
+ bool ignore_last_generators = False,
13863
+ bool strip_comments = False,
13864
+ bool reverse = False,
13865
+ bool unsqueeze = True,
13866
+ ):
13867
+ """
13868
+ Writes current slicer to a file in scc format.
13869
+ """
13870
+ if degree == -1 and not rivet_compatible:
13871
+ degree = 1
13872
+ cdef string c_path = path.encode(encoding="utf-8")
13873
+ if self.is_squeezed and unsqueeze:
13874
+ kwargs = locals()
13875
+ kwargs.pop("self",0)
13876
+ kwargs.pop("c_path",0)
13877
+ self.unsqueeze().to_scc(**kwargs)
13878
+ return
13879
+ with nogil:
13880
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
13881
+
13882
+
13167
13883
  #------------------------------------------------------------------------------
13168
13884
  cdef class _KSlicer_GudhiCohomology0_f64:
13169
13885
  cdef C_KSlicer_GudhiCohomology0_f64 truc
@@ -13241,10 +13957,14 @@ cdef class _KSlicer_GudhiCohomology0_f64:
13241
13957
  copy_.minpres_degree = self.minpres_degree
13242
13958
  copy_.filtration_grid = self.filtration_grid
13243
13959
  return copy_
13244
- def get_barcode(self):
13960
+ def get_barcode(self, bool keep_inf = False):
13245
13961
  """
13246
13962
  Returns the current barcode.
13247
13963
  """
13964
+ if keep_inf:
13965
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
13966
+ else:
13967
+ bcs = _KSlicer_GudhiCohomology0_f64._threshold_bcs(self.truc.get_barcode())
13248
13968
  return self.truc.get_barcode()
13249
13969
  def push_to_line(self, basepoint, direction=None)->_KSlicer_GudhiCohomology0_f64:
13250
13970
  """
@@ -13408,7 +14128,7 @@ cdef class _KSlicer_GudhiCohomology0_f64:
13408
14128
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
13409
14129
  return np.asarray(out)
13410
14130
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
13411
- return mpg.compute_grid(
14131
+ return compute_grid(
13412
14132
  self.get_filtrations_values().T,
13413
14133
  strategy=grid_strategy,
13414
14134
  **infer_grid_kwargs,
@@ -13455,7 +14175,7 @@ cdef class _KSlicer_GudhiCohomology0_f64:
13455
14175
  if not force and self.is_squeezed:
13456
14176
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
13457
14177
  if filtration_grid is None:
13458
- filtration_grid = mpg.compute_grid(
14178
+ filtration_grid = compute_grid(
13459
14179
  self.get_filtrations_values().T,
13460
14180
  strategy=grid_strategy,
13461
14181
  resolution=resolution)
@@ -13505,6 +14225,33 @@ cdef class _KSlicer_GudhiCohomology0_f64:
13505
14225
  return "GudhiCohomology"
13506
14226
 
13507
14227
 
14228
+ def to_scc(
14229
+ self,
14230
+ path:os.PathLike,
14231
+ int num_parameters = -1,
14232
+ int degree = -1,
14233
+ bool rivet_compatible = False,
14234
+ bool ignore_last_generators = False,
14235
+ bool strip_comments = False,
14236
+ bool reverse = False,
14237
+ bool unsqueeze = True,
14238
+ ):
14239
+ """
14240
+ Writes current slicer to a file in scc format.
14241
+ """
14242
+ if degree == -1 and not rivet_compatible:
14243
+ degree = 1
14244
+ cdef string c_path = path.encode(encoding="utf-8")
14245
+ if self.is_squeezed and unsqueeze:
14246
+ kwargs = locals()
14247
+ kwargs.pop("self",0)
14248
+ kwargs.pop("c_path",0)
14249
+ self.unsqueeze().to_scc(**kwargs)
14250
+ return
14251
+ with nogil:
14252
+ self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
14253
+
14254
+
13508
14255
  #------------------------------------------------------------------------------
13509
14256
  cdef class _Slicer_GudhiCohomology0_i32:
13510
14257
  cdef C_Slicer_GudhiCohomology0_i32 truc
@@ -13573,10 +14320,14 @@ cdef class _Slicer_GudhiCohomology0_i32:
13573
14320
  copy_.minpres_degree = self.minpres_degree
13574
14321
  copy_.filtration_grid = self.filtration_grid
13575
14322
  return copy_
13576
- def get_barcode(self):
14323
+ def get_barcode(self, bool keep_inf = False):
13577
14324
  """
13578
14325
  Returns the current barcode.
13579
14326
  """
14327
+ if keep_inf:
14328
+ bcs = tuple(np.asarray(stuff, dtype = np.int32) for stuff in self.truc.get_barcode())
14329
+ else:
14330
+ bcs = _Slicer_GudhiCohomology0_i32._threshold_bcs(self.truc.get_barcode())
13580
14331
  return self.truc.get_barcode()
13581
14332
  def push_to_line(self, basepoint, direction=None)->_Slicer_GudhiCohomology0_i32:
13582
14333
  """
@@ -13740,7 +14491,7 @@ cdef class _Slicer_GudhiCohomology0_i32:
13740
14491
  out = _vff21cview_i32(v, copy=True, duplicate=self.num_parameters)
13741
14492
  return np.asarray(out)
13742
14493
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
13743
- return mpg.compute_grid(
14494
+ return compute_grid(
13744
14495
  self.get_filtrations_values().T,
13745
14496
  strategy=grid_strategy,
13746
14497
  **infer_grid_kwargs,
@@ -13787,7 +14538,7 @@ cdef class _Slicer_GudhiCohomology0_i32:
13787
14538
  if not force and self.is_squeezed:
13788
14539
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
13789
14540
  if filtration_grid is None:
13790
- filtration_grid = mpg.compute_grid(
14541
+ filtration_grid = compute_grid(
13791
14542
  self.get_filtrations_values().T,
13792
14543
  strategy=grid_strategy,
13793
14544
  resolution=resolution)
@@ -13836,20 +14587,12 @@ cdef class _Slicer_GudhiCohomology0_i32:
13836
14587
  def pers_backend(self)->str:
13837
14588
  return "GudhiCohomology"
13838
14589
 
13839
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_i32:
13840
- """
13841
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
13842
- """
13843
- cdef string c_path = path.encode(encoding="utf-8")
13844
- with nogil:
13845
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
13846
- return self
13847
14590
 
13848
14591
  def to_scc(
13849
14592
  self,
13850
14593
  path:os.PathLike,
13851
14594
  int num_parameters = -1,
13852
- int degree = 1,
14595
+ int degree = -1,
13853
14596
  bool rivet_compatible = False,
13854
14597
  bool ignore_last_generators = False,
13855
14598
  bool strip_comments = False,
@@ -13859,6 +14602,8 @@ cdef class _Slicer_GudhiCohomology0_i32:
13859
14602
  """
13860
14603
  Writes current slicer to a file in scc format.
13861
14604
  """
14605
+ if degree == -1 and not rivet_compatible:
14606
+ degree = 1
13862
14607
  cdef string c_path = path.encode(encoding="utf-8")
13863
14608
  if self.is_squeezed and unsqueeze:
13864
14609
  kwargs = locals()
@@ -13868,6 +14613,16 @@ cdef class _Slicer_GudhiCohomology0_i32:
13868
14613
  return
13869
14614
  with nogil:
13870
14615
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
14616
+
14617
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_i32:
14618
+ """
14619
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
14620
+ """
14621
+ cdef string c_path = path.encode(encoding="utf-8")
14622
+ with nogil:
14623
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
14624
+ return self
14625
+
13871
14626
  def unsqueeze(self, grid=None, dtype = np.float64):
13872
14627
  from multipers.grids import evaluate_in_grid
13873
14628
  from multipers import Slicer
@@ -13949,10 +14704,14 @@ cdef class _Slicer_GudhiCohomology0_i64:
13949
14704
  copy_.minpres_degree = self.minpres_degree
13950
14705
  copy_.filtration_grid = self.filtration_grid
13951
14706
  return copy_
13952
- def get_barcode(self):
14707
+ def get_barcode(self, bool keep_inf = False):
13953
14708
  """
13954
14709
  Returns the current barcode.
13955
14710
  """
14711
+ if keep_inf:
14712
+ bcs = tuple(np.asarray(stuff, dtype = np.int64) for stuff in self.truc.get_barcode())
14713
+ else:
14714
+ bcs = _Slicer_GudhiCohomology0_i64._threshold_bcs(self.truc.get_barcode())
13956
14715
  return self.truc.get_barcode()
13957
14716
  def push_to_line(self, basepoint, direction=None)->_Slicer_GudhiCohomology0_i64:
13958
14717
  """
@@ -14116,7 +14875,7 @@ cdef class _Slicer_GudhiCohomology0_i64:
14116
14875
  out = _vff21cview_i64(v, copy=True, duplicate=self.num_parameters)
14117
14876
  return np.asarray(out)
14118
14877
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
14119
- return mpg.compute_grid(
14878
+ return compute_grid(
14120
14879
  self.get_filtrations_values().T,
14121
14880
  strategy=grid_strategy,
14122
14881
  **infer_grid_kwargs,
@@ -14163,7 +14922,7 @@ cdef class _Slicer_GudhiCohomology0_i64:
14163
14922
  if not force and self.is_squeezed:
14164
14923
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
14165
14924
  if filtration_grid is None:
14166
- filtration_grid = mpg.compute_grid(
14925
+ filtration_grid = compute_grid(
14167
14926
  self.get_filtrations_values().T,
14168
14927
  strategy=grid_strategy,
14169
14928
  resolution=resolution)
@@ -14212,20 +14971,12 @@ cdef class _Slicer_GudhiCohomology0_i64:
14212
14971
  def pers_backend(self)->str:
14213
14972
  return "GudhiCohomology"
14214
14973
 
14215
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_i64:
14216
- """
14217
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
14218
- """
14219
- cdef string c_path = path.encode(encoding="utf-8")
14220
- with nogil:
14221
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
14222
- return self
14223
14974
 
14224
14975
  def to_scc(
14225
14976
  self,
14226
14977
  path:os.PathLike,
14227
14978
  int num_parameters = -1,
14228
- int degree = 1,
14979
+ int degree = -1,
14229
14980
  bool rivet_compatible = False,
14230
14981
  bool ignore_last_generators = False,
14231
14982
  bool strip_comments = False,
@@ -14235,6 +14986,8 @@ cdef class _Slicer_GudhiCohomology0_i64:
14235
14986
  """
14236
14987
  Writes current slicer to a file in scc format.
14237
14988
  """
14989
+ if degree == -1 and not rivet_compatible:
14990
+ degree = 1
14238
14991
  cdef string c_path = path.encode(encoding="utf-8")
14239
14992
  if self.is_squeezed and unsqueeze:
14240
14993
  kwargs = locals()
@@ -14244,6 +14997,16 @@ cdef class _Slicer_GudhiCohomology0_i64:
14244
14997
  return
14245
14998
  with nogil:
14246
14999
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
15000
+
15001
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_i64:
15002
+ """
15003
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
15004
+ """
15005
+ cdef string c_path = path.encode(encoding="utf-8")
15006
+ with nogil:
15007
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
15008
+ return self
15009
+
14247
15010
  def unsqueeze(self, grid=None, dtype = np.float64):
14248
15011
  from multipers.grids import evaluate_in_grid
14249
15012
  from multipers import Slicer
@@ -14325,10 +15088,14 @@ cdef class _Slicer_GudhiCohomology0_f32:
14325
15088
  copy_.minpres_degree = self.minpres_degree
14326
15089
  copy_.filtration_grid = self.filtration_grid
14327
15090
  return copy_
14328
- def get_barcode(self):
15091
+ def get_barcode(self, bool keep_inf = False):
14329
15092
  """
14330
15093
  Returns the current barcode.
14331
15094
  """
15095
+ if keep_inf:
15096
+ bcs = tuple(np.asarray(stuff, dtype = np.float32) for stuff in self.truc.get_barcode())
15097
+ else:
15098
+ bcs = _Slicer_GudhiCohomology0_f32._threshold_bcs(self.truc.get_barcode())
14332
15099
  return self.truc.get_barcode()
14333
15100
  def push_to_line(self, basepoint, direction=None)->_Slicer_GudhiCohomology0_f32:
14334
15101
  """
@@ -14492,7 +15259,7 @@ cdef class _Slicer_GudhiCohomology0_f32:
14492
15259
  out = _vff21cview_f32(v, copy=True, duplicate=self.num_parameters)
14493
15260
  return np.asarray(out)
14494
15261
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
14495
- return mpg.compute_grid(
15262
+ return compute_grid(
14496
15263
  self.get_filtrations_values().T,
14497
15264
  strategy=grid_strategy,
14498
15265
  **infer_grid_kwargs,
@@ -14539,7 +15306,7 @@ cdef class _Slicer_GudhiCohomology0_f32:
14539
15306
  if not force and self.is_squeezed:
14540
15307
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
14541
15308
  if filtration_grid is None:
14542
- filtration_grid = mpg.compute_grid(
15309
+ filtration_grid = compute_grid(
14543
15310
  self.get_filtrations_values().T,
14544
15311
  strategy=grid_strategy,
14545
15312
  resolution=resolution)
@@ -14588,20 +15355,12 @@ cdef class _Slicer_GudhiCohomology0_f32:
14588
15355
  def pers_backend(self)->str:
14589
15356
  return "GudhiCohomology"
14590
15357
 
14591
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_f32:
14592
- """
14593
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
14594
- """
14595
- cdef string c_path = path.encode(encoding="utf-8")
14596
- with nogil:
14597
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
14598
- return self
14599
15358
 
14600
15359
  def to_scc(
14601
15360
  self,
14602
15361
  path:os.PathLike,
14603
15362
  int num_parameters = -1,
14604
- int degree = 1,
15363
+ int degree = -1,
14605
15364
  bool rivet_compatible = False,
14606
15365
  bool ignore_last_generators = False,
14607
15366
  bool strip_comments = False,
@@ -14611,6 +15370,8 @@ cdef class _Slicer_GudhiCohomology0_f32:
14611
15370
  """
14612
15371
  Writes current slicer to a file in scc format.
14613
15372
  """
15373
+ if degree == -1 and not rivet_compatible:
15374
+ degree = 1
14614
15375
  cdef string c_path = path.encode(encoding="utf-8")
14615
15376
  if self.is_squeezed and unsqueeze:
14616
15377
  kwargs = locals()
@@ -14620,6 +15381,16 @@ cdef class _Slicer_GudhiCohomology0_f32:
14620
15381
  return
14621
15382
  with nogil:
14622
15383
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
15384
+
15385
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_f32:
15386
+ """
15387
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
15388
+ """
15389
+ cdef string c_path = path.encode(encoding="utf-8")
15390
+ with nogil:
15391
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
15392
+ return self
15393
+
14623
15394
  def unsqueeze(self, grid=None, dtype = np.float64):
14624
15395
  from multipers.grids import evaluate_in_grid
14625
15396
  from multipers import Slicer
@@ -14701,10 +15472,14 @@ cdef class _Slicer_GudhiCohomology0_f64:
14701
15472
  copy_.minpres_degree = self.minpres_degree
14702
15473
  copy_.filtration_grid = self.filtration_grid
14703
15474
  return copy_
14704
- def get_barcode(self):
15475
+ def get_barcode(self, bool keep_inf = False):
14705
15476
  """
14706
15477
  Returns the current barcode.
14707
15478
  """
15479
+ if keep_inf:
15480
+ bcs = tuple(np.asarray(stuff, dtype = np.float64) for stuff in self.truc.get_barcode())
15481
+ else:
15482
+ bcs = _Slicer_GudhiCohomology0_f64._threshold_bcs(self.truc.get_barcode())
14708
15483
  return self.truc.get_barcode()
14709
15484
  def push_to_line(self, basepoint, direction=None)->_Slicer_GudhiCohomology0_f64:
14710
15485
  """
@@ -14868,7 +15643,7 @@ cdef class _Slicer_GudhiCohomology0_f64:
14868
15643
  out = _vff21cview_f64(v, copy=True, duplicate=self.num_parameters)
14869
15644
  return np.asarray(out)
14870
15645
  def get_filtration_grid(self,grid_strategy:str="exact", **infer_grid_kwargs):
14871
- return mpg.compute_grid(
15646
+ return compute_grid(
14872
15647
  self.get_filtrations_values().T,
14873
15648
  strategy=grid_strategy,
14874
15649
  **infer_grid_kwargs,
@@ -14915,7 +15690,7 @@ cdef class _Slicer_GudhiCohomology0_f64:
14915
15690
  if not force and self.is_squeezed:
14916
15691
  raise ValueError("The slicer seems to be already squeezed. Use force=True to resqueeze.")
14917
15692
  if filtration_grid is None:
14918
- filtration_grid = mpg.compute_grid(
15693
+ filtration_grid = compute_grid(
14919
15694
  self.get_filtrations_values().T,
14920
15695
  strategy=grid_strategy,
14921
15696
  resolution=resolution)
@@ -14964,20 +15739,12 @@ cdef class _Slicer_GudhiCohomology0_f64:
14964
15739
  def pers_backend(self)->str:
14965
15740
  return "GudhiCohomology"
14966
15741
 
14967
- def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_f64:
14968
- """
14969
- Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
14970
- """
14971
- cdef string c_path = path.encode(encoding="utf-8")
14972
- with nogil:
14973
- self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
14974
- return self
14975
15742
 
14976
15743
  def to_scc(
14977
15744
  self,
14978
15745
  path:os.PathLike,
14979
15746
  int num_parameters = -1,
14980
- int degree = 1,
15747
+ int degree = -1,
14981
15748
  bool rivet_compatible = False,
14982
15749
  bool ignore_last_generators = False,
14983
15750
  bool strip_comments = False,
@@ -14987,6 +15754,8 @@ cdef class _Slicer_GudhiCohomology0_f64:
14987
15754
  """
14988
15755
  Writes current slicer to a file in scc format.
14989
15756
  """
15757
+ if degree == -1 and not rivet_compatible:
15758
+ degree = 1
14990
15759
  cdef string c_path = path.encode(encoding="utf-8")
14991
15760
  if self.is_squeezed and unsqueeze:
14992
15761
  kwargs = locals()
@@ -14996,6 +15765,16 @@ cdef class _Slicer_GudhiCohomology0_f64:
14996
15765
  return
14997
15766
  with nogil:
14998
15767
  self.truc.write_to_scc_file(c_path, num_parameters, degree, rivet_compatible, ignore_last_generators, strip_comments, reverse)
15768
+
15769
+ def _build_from_scc_file(self, path:os.PathLike, bool rivet_compatible = False, bool reverse = False, int shift_dimension = 0)->_Slicer_GudhiCohomology0_f64:
15770
+ """
15771
+ Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.
15772
+ """
15773
+ cdef string c_path = path.encode(encoding="utf-8")
15774
+ with nogil:
15775
+ self.truc.build_from_scc_file(c_path, rivet_compatible, reverse, shift_dimension)
15776
+ return self
15777
+
14999
15778
  def unsqueeze(self, grid=None, dtype = np.float64):
15000
15779
  from multipers.grids import evaluate_in_grid
15001
15780
  from multipers import Slicer
@@ -15072,8 +15851,10 @@ def from_function_delaunay(
15072
15851
  backend : slicer backend, e.g. "matrix", "clement"
15073
15852
  vineyard : bool, use a vineyard-compatible backend
15074
15853
  """
15854
+ from multipers.io import _init_external_softwares, function_delaunay_presentation_to_slicer
15075
15855
  s = multipers.Slicer(None, backend=backend, vineyard=vineyard, dtype=dtype)
15076
- mio.function_delaunay_presentation_to_slicer(s, points, grades, degree=degree, verbose=verbose,clear=clear)
15856
+ _init_external_softwares(requires=["function_delaunay"])
15857
+ function_delaunay_presentation_to_slicer(s, points, grades, degree=degree, verbose=verbose,clear=clear)
15077
15858
  if degree >= 0:
15078
15859
  s.minpres_degree = degree
15079
15860
  return s
@@ -15116,11 +15897,12 @@ def minimal_presentation(
15116
15897
  and returns it as a slicer.
15117
15898
  Backends differents than `mpfree` are unstable.
15118
15899
  """
15900
+ from multipers.io import _init_external_softwares, input_path, scc_reduce_from_str_to_slicer
15119
15901
  if is_slicer(slicer) and slicer.is_minpres and not force:
15120
15902
  from warnings import warn
15121
15903
  warn(f"The slicer seems to be already reduced, from homology of degree {slicer.minpres_degree}.")
15122
15904
  return slicer
15123
- mio._init_external_softwares(requires=[backend])
15905
+ _init_external_softwares(requires=[backend])
15124
15906
  if len(degrees)>0:
15125
15907
  def todo(int degree):
15126
15908
  return minimal_presentation(slicer, degree=degree, backend=backend, slicer_backend=slicer_backend, vineyard=vineyard, id=id, **minpres_kwargs)
@@ -15135,13 +15917,13 @@ def minimal_presentation(
15135
15917
  if dtype is None:
15136
15918
  dtype = slicer.dtype
15137
15919
  dimension = slicer.dimension - degree # latest = L-1, which is empty, -1 for degree 0, -2 for degree 1 etc.
15138
- slicer.to_scc(path=mio.input_path+id, strip_comments=True, degree=degree-1)
15920
+ slicer.to_scc(path=input_path+id, strip_comments=True, degree=degree-1)
15139
15921
  new_slicer = multipers.Slicer(None,backend=slicer_backend, vineyard=vineyard, dtype=dtype)
15140
15922
  if backend=="mpfree":
15141
15923
  shift_dimension=degree-1
15142
15924
  else:
15143
15925
  shift_dimension=degree
15144
- mio.scc_reduce_from_str_to_slicer(path=mio.input_path+id, slicer=new_slicer, dimension=dimension, backend=backend, shift_dimension=shift_dimension, **minpres_kwargs)
15926
+ scc_reduce_from_str_to_slicer(path=input_path+id, slicer=new_slicer, dimension=dimension, backend=backend, shift_dimension=shift_dimension, **minpres_kwargs)
15145
15927
  new_slicer.minpres_degree = degree
15146
15928
  if filtration_grid is not None:
15147
15929
  new_slicer.filtration_grid = filtration_grid
@@ -15259,7 +16041,8 @@ def to_blocks(input):
15259
16041
  if is_simplextree_multi(input):
15260
16042
  return input._to_scc()
15261
16043
  if isinstance(input, str) or isinstance(input, os.PathLike):
15262
- return mio.scc_parser(input)
16044
+ from multipers.io import scc_parser
16045
+ return scc_parser(input)
15263
16046
  raise ValueError("Input cannot be converted to blocks.")
15264
16047
 
15265
16048