FluctuationAnalysisTools 1.11.0__tar.gz → 1.11.0.dev0__tar.gz

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.
Files changed (162) hide show
  1. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/workflows/reusable_test.yml +2 -4
  2. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/workflows/test-and-release.yml +0 -1
  3. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.gitignore +0 -3
  4. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.pre-commit-config.yaml +1 -1
  5. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/FluctuationAnalysisTools.egg-info/PKG-INFO +2 -5
  6. fluctuationanalysistools-1.11.0.dev0/FluctuationAnalysisTools.egg-info/SOURCES.txt +104 -0
  7. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/FluctuationAnalysisTools.egg-info/requires.txt +1 -6
  8. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/PKG-INFO +2 -5
  9. fluctuationanalysistools-1.11.0.dev0/StatTools/_version.py +34 -0
  10. fluctuationanalysistools-1.11.0.dev0/StatTools/analysis/__init__.py +19 -0
  11. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/bma.py +8 -8
  12. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/dfa.py +2 -37
  13. fluctuationanalysistools-1.11.0.dev0/StatTools/analysis/dpcca.py +313 -0
  14. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/dpcca_as_class.py +8 -32
  15. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/nd_dfa.py +1 -0
  16. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/utils.py +2 -106
  17. fluctuationanalysistools-1.11.0.dev0/StatTools/experimental/augmentation/perturbations.py +52 -0
  18. {fluctuationanalysistools-1.11.0/StatTools/experimental → fluctuationanalysistools-1.11.0.dev0/StatTools}/filters/kalman_filter.py +27 -70
  19. {fluctuationanalysistools-1.11.0/StatTools/experimental → fluctuationanalysistools-1.11.0.dev0/StatTools}/filters/symbolic_kalman.py +1 -5
  20. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/__init__.py +0 -1
  21. fluctuationanalysistools-1.11.0.dev0/StatTools/generators/kasdin_generator.py +172 -0
  22. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/ndfnoise_generator.py +7 -7
  23. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/visualization/plot_ff.py +2 -12
  24. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/pyproject.toml +2 -8
  25. fluctuationanalysistools-1.11.0.dev0/research/ff_analysis.ipynb +596 -0
  26. fluctuationanalysistools-1.11.0.dev0/research/kalman_filter/high-order_kalman.ipynb +282 -0
  27. fluctuationanalysistools-1.11.0.dev0/research/kalman_filter/kalman-kasdin.ipynb +2260 -0
  28. fluctuationanalysistools-1.11.0.dev0/research/kalman_filter/kalman_experiments.py +150 -0
  29. fluctuationanalysistools-1.11.0.dev0/research/kalman_filter/kalman_filter.ipynb +1004 -0
  30. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/research/kalman_filter/kalman_filter[ru].ipynb +2 -2
  31. fluctuationanalysistools-1.11.0.dev0/research/ndfnoise_generator.ipynb +600 -0
  32. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/setup.py +8 -4
  33. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_bma.py +0 -2
  34. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_dfa_func.py +15 -66
  35. fluctuationanalysistools-1.11.0.dev0/tests/test_dpcca.py +131 -0
  36. fluctuationanalysistools-1.11.0.dev0/tests/test_kalman_filter.py +35 -0
  37. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_kasdin_generator.py +0 -31
  38. fluctuationanalysistools-1.11.0.dev0/tests/test_ndfnoise_generator.py +69 -0
  39. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_ne_dfa.py +1 -0
  40. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_utils.py +1 -0
  41. fluctuationanalysistools-1.11.0/FluctuationAnalysisTools.egg-info/SOURCES.txt +0 -145
  42. fluctuationanalysistools-1.11.0/StatTools/_version.py +0 -21
  43. fluctuationanalysistools-1.11.0/StatTools/analysis/__init__.py +0 -42
  44. fluctuationanalysistools-1.11.0/StatTools/analysis/dpcca.py +0 -515
  45. fluctuationanalysistools-1.11.0/StatTools/experimental/analysis/analyse_ff.py +0 -405
  46. fluctuationanalysistools-1.11.0/StatTools/experimental/augmentation/perturbations.py +0 -123
  47. fluctuationanalysistools-1.11.0/StatTools/filters/kalman_filter.py +0 -144
  48. fluctuationanalysistools-1.11.0/StatTools/generators/kasdin_generator.py +0 -252
  49. fluctuationanalysistools-1.11.0/StatTools/generators/mfnoise_generator.py +0 -186
  50. fluctuationanalysistools-1.11.0/StatTools/generators/multi_scale_fractional_generator.py +0 -190
  51. fluctuationanalysistools-1.11.0/StatTools/utils/__init__.py +0 -0
  52. fluctuationanalysistools-1.11.0/StatTools/utils/io.py +0 -30
  53. fluctuationanalysistools-1.11.0/context7.json +0 -4
  54. fluctuationanalysistools-1.11.0/examples/kalman_filter.ipynb +0 -223
  55. fluctuationanalysistools-1.11.0/examples/mfnoise_visualization.ipynb +0 -314
  56. fluctuationanalysistools-1.11.0/research/__init__.py +0 -0
  57. fluctuationanalysistools-1.11.0/research/experimental/tds_dpcca.ipynb +0 -356
  58. fluctuationanalysistools-1.11.0/research/ff_analysis/ff_analysis_linear.ipynb +0 -725
  59. fluctuationanalysistools-1.11.0/research/ff_analysis/ff_analysis_relu.ipynb +0 -667
  60. fluctuationanalysistools-1.11.0/research/kalman_filter/README.md +0 -24
  61. fluctuationanalysistools-1.11.0/research/kalman_filter/__init__.py +0 -3
  62. fluctuationanalysistools-1.11.0/research/kalman_filter/kalman-kasdin.ipynb +0 -858
  63. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/__init__.py +0 -0
  64. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/data/tree_rwi.csv +0 -1119
  65. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dendrochronological_series.ipynb +0 -1768
  66. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/README.md +0 -45
  67. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/data/norw010-rwl-noaa.txt +0 -1295
  68. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/data/norw010.rwl +0 -1954
  69. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/data/norw010.txt +0 -361
  70. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/examples/preprocessingtrw.ipynb +0 -267
  71. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_1.csv +0 -1119
  72. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_2.csv +0 -1119
  73. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_3.csv +0 -1119
  74. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_4.csv +0 -1119
  75. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_5.csv +0 -1119
  76. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/dplr/tree_rwi_dplr_71.csv +0 -1119
  77. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/python/tree_rwi_python_15.csv +0 -1119
  78. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/results/python/tree_rwi_python_71.csv +0 -1119
  79. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/scripts/Download_rwl.R +0 -17
  80. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/scripts/Preprocess_rwl.R +0 -154
  81. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/dplR/scripts/preprocessingtrw.py +0 -182
  82. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/gen_filter_save.py +0 -346
  83. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/generate_drop_trees.py +0 -237
  84. fluctuationanalysistools-1.11.0/research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/synthetic_benchmarks.ipynb +0 -1316
  85. fluctuationanalysistools-1.11.0/research/kalman_filter/synthesis_save_matrix.py +0 -69
  86. fluctuationanalysistools-1.11.0/research/kalman_filter/the_impact_of_kalman_filter_transition_model_selection/the_impact_of_kalman_filter_transition_model_selection.ipynb +0 -972
  87. fluctuationanalysistools-1.11.0/research/multi_scale_fractional_generator.py.ipynb +0 -331
  88. fluctuationanalysistools-1.11.0/research/ndfnoise_generator.ipynb +0 -517
  89. fluctuationanalysistools-1.11.0/tests/test_dpcca.py +0 -248
  90. fluctuationanalysistools-1.11.0/tests/test_io_utils.py +0 -28
  91. fluctuationanalysistools-1.11.0/tests/test_kalman_filter.py +0 -252
  92. fluctuationanalysistools-1.11.0/tests/test_kalman_filter_experimental.py +0 -78
  93. fluctuationanalysistools-1.11.0/tests/test_mfnoise_generator.py +0 -338
  94. fluctuationanalysistools-1.11.0/tests/test_multi_scale_fractional_generator.py +0 -135
  95. fluctuationanalysistools-1.11.0/tests/test_ndfnoise_generator.py +0 -78
  96. fluctuationanalysistools-1.11.0/tests/test_perturbations.py +0 -52
  97. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.gitattributes +0 -0
  98. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  99. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  100. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/workflows/reusable_build-wheels.yml +0 -0
  101. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/workflows/reusable_pre-commit-validation.yml +0 -0
  102. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/.github/workflows/run-tests.yml +0 -0
  103. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/CHANGELOG.md +0 -0
  104. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/CONTRIBUTING.md +0 -0
  105. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/FluctuationAnalysisTools.egg-info/dependency_links.txt +0 -0
  106. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/FluctuationAnalysisTools.egg-info/top_level.txt +0 -0
  107. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/LICENSE.txt +0 -0
  108. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/MANIFEST.in +0 -0
  109. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/README.md +0 -0
  110. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/Gamma.py +0 -0
  111. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/__init__.py +0 -0
  112. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/fa.py +0 -0
  113. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/movmean.py +0 -0
  114. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/nonequidistant/__init__.py +0 -0
  115. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/nonequidistant/dfa.py +0 -0
  116. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/qss.py +0 -0
  117. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/support_ff.py +0 -0
  118. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/analysis/svd_dfa.py +0 -0
  119. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/auxiliary.py +0 -0
  120. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/experimental/__init__.py +0 -0
  121. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/experimental/analysis/__init__.py +0 -0
  122. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/experimental/analysis/tools.py +0 -0
  123. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/experimental/augmentation/__init__.py +0 -0
  124. {fluctuationanalysistools-1.11.0/StatTools/experimental/filters → fluctuationanalysistools-1.11.0.dev0/StatTools/experimental/synthesis}/__init__.py +0 -0
  125. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/experimental/synthesis/tools.py +0 -0
  126. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/base_filter.py +0 -0
  127. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/cholesky_transform.py +0 -0
  128. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/fbm.py +0 -0
  129. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/field_generator.py +0 -0
  130. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/generators/lbfbm_generator.py +0 -0
  131. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/native/.gitkeep +0 -0
  132. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/utilities/deprecation.py +0 -0
  133. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/StatTools/visualization/__init__.py +0 -0
  134. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/research/Video-based_marker-free_tracking_and_multi-scale_analysis.ipynb +0 -0
  135. {fluctuationanalysistools-1.11.0/StatTools/experimental/synthesis → fluctuationanalysistools-1.11.0.dev0/research}/__init__.py +0 -0
  136. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/research/bma.ipynb +0 -0
  137. {fluctuationanalysistools-1.11.0/StatTools/filters → fluctuationanalysistools-1.11.0.dev0/research/kalman_filter}/__init__.py +0 -0
  138. {fluctuationanalysistools-1.11.0/examples → fluctuationanalysistools-1.11.0.dev0/research/kalman_filter}/svd_dfa_demo.ipynb +0 -0
  139. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/research/lbfbm_generator.ipynb +0 -0
  140. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/research/readme.md +0 -0
  141. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/setup.cfg +0 -0
  142. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/src/cpp/DFA.cpp +0 -0
  143. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/src/cpp/StatTools_C_API.cpp +0 -0
  144. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/src/cpp/StatTools_bindings.cpp +0 -0
  145. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/src/cpp/StatTools_core.cpp +0 -0
  146. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/src/cpp/StatTools_core.h +0 -0
  147. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_dfa.py +0 -0
  148. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_fa.py +0 -0
  149. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_filter.py +0 -0
  150. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_filtered_array.py +0 -0
  151. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_lbfbm_generator.py +0 -0
  152. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_nddfa.py +0 -0
  153. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_pybind11_bindings.py +0 -0
  154. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_svd_dfa.py +0 -0
  155. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests/test_unified_generator.py +0 -0
  156. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/cholesky_with_R.py +0 -0
  157. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/dfa_test.py +0 -0
  158. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/dpcca_pipe.py +0 -0
  159. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/dpcca_test.py +0 -0
  160. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/ff_visualization_test.py +0 -0
  161. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/ff_zero_crossover_visualisation_test.py +0 -0
  162. {fluctuationanalysistools-1.11.0 → fluctuationanalysistools-1.11.0.dev0}/tests_manual/test_buffer.py +0 -0
@@ -57,15 +57,13 @@ jobs:
57
57
  if: ${{ inputs.os != 'ubuntu-latest' }}
58
58
  shell: bash
59
59
  run: |
60
- WHEEL=$(ls wheelhouse/*.whl)
61
- pip install "${WHEEL}[experimental,test]"
60
+ pip install wheelhouse/*.whl
62
61
 
63
62
  - name: Install FluctuationAnalysisTools from sdist
64
63
  if: ${{ inputs.os == 'ubuntu-latest' }}
65
64
  shell: bash
66
65
  run: |
67
- SDIST=$(ls wheelhouse/*.tar.gz)
68
- pip install "${SDIST}[experimental,test]"
66
+ pip install wheelhouse/*.tar.gz
69
67
 
70
68
  - name: Run tests
71
69
  run: |
@@ -87,7 +87,6 @@ jobs:
87
87
  find ./artifacts -name "*.tar.gz" -exec cp {} ./dist \;
88
88
 
89
89
  - name: Create Github Release
90
- if: contains(github.ref, 'release')
91
90
  uses: softprops/action-gh-release@v2
92
91
  with:
93
92
  tag_name: ${{ steps.get-release.outputs.tag }}
@@ -19,6 +19,3 @@ research/out/*
19
19
  memory-bank/*
20
20
  .theia/*
21
21
  .prompts/*
22
- research/kalman_filter/filter_matrices
23
- research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/data/model_signals
24
- research/kalman_filter/reconstruction_of_long_term_complex_system_dynamics/data/output
@@ -2,7 +2,7 @@
2
2
  # See https://pre-commit.com/hooks.html for more hooks
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v6.0.0
5
+ rev: v3.2.0
6
6
  hooks:
7
7
  - id: trailing-whitespace
8
8
  - id: end-of-file-fixer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FluctuationAnalysisTools
3
- Version: 1.11.0
3
+ Version: 1.11.0.dev0
4
4
  Summary: Python library for DFA, Hurst exponent, and fluctuation analysis of time series.
5
5
  Author: Maya Gavrichenkova, Timofey Baburin, Olga Ivleva
6
6
  Author-email: Aleksandr Sinitca <amsinitca@etu.ru>, Alexandr Kuzmenko <alexander.k.spb@gmail.com>, Asya Lyanova <ailianova@etu.ru>
@@ -17,12 +17,9 @@ Requires-Dist: scipy>=1.13.1
17
17
  Requires-Dist: setuptools>=70.0.0
18
18
  Requires-Dist: tqdm~=4.62.3
19
19
  Requires-Dist: pandas>=1.3.5
20
+ Requires-Dist: filterpy>=1.4.5
20
21
  Requires-Dist: sympy>=1.14.0
21
22
  Requires-Dist: pybind11>=2.11.1
22
- Provides-Extra: test
23
- Requires-Dist: pytest-timeout; extra == "test"
24
- Provides-Extra: experimental
25
- Requires-Dist: filterpy; extra == "experimental"
26
23
  Dynamic: license-file
27
24
 
28
25
  # FluctuationAnalysisTools
@@ -0,0 +1,104 @@
1
+ .gitattributes
2
+ .gitignore
3
+ .pre-commit-config.yaml
4
+ CHANGELOG.md
5
+ CONTRIBUTING.md
6
+ LICENSE.txt
7
+ MANIFEST.in
8
+ README.md
9
+ pyproject.toml
10
+ setup.py
11
+ .github/ISSUE_TEMPLATE/bug_report.md
12
+ .github/ISSUE_TEMPLATE/feature_request.md
13
+ .github/workflows/reusable_build-wheels.yml
14
+ .github/workflows/reusable_pre-commit-validation.yml
15
+ .github/workflows/reusable_test.yml
16
+ .github/workflows/run-tests.yml
17
+ .github/workflows/test-and-release.yml
18
+ FluctuationAnalysisTools.egg-info/PKG-INFO
19
+ FluctuationAnalysisTools.egg-info/SOURCES.txt
20
+ FluctuationAnalysisTools.egg-info/dependency_links.txt
21
+ FluctuationAnalysisTools.egg-info/requires.txt
22
+ FluctuationAnalysisTools.egg-info/top_level.txt
23
+ StatTools/Gamma.py
24
+ StatTools/__init__.py
25
+ StatTools/_version.py
26
+ StatTools/auxiliary.py
27
+ StatTools/analysis/__init__.py
28
+ StatTools/analysis/bma.py
29
+ StatTools/analysis/dfa.py
30
+ StatTools/analysis/dpcca.py
31
+ StatTools/analysis/dpcca_as_class.py
32
+ StatTools/analysis/fa.py
33
+ StatTools/analysis/movmean.py
34
+ StatTools/analysis/nd_dfa.py
35
+ StatTools/analysis/qss.py
36
+ StatTools/analysis/support_ff.py
37
+ StatTools/analysis/svd_dfa.py
38
+ StatTools/analysis/utils.py
39
+ StatTools/analysis/nonequidistant/__init__.py
40
+ StatTools/analysis/nonequidistant/dfa.py
41
+ StatTools/experimental/__init__.py
42
+ StatTools/experimental/analysis/__init__.py
43
+ StatTools/experimental/analysis/tools.py
44
+ StatTools/experimental/augmentation/__init__.py
45
+ StatTools/experimental/augmentation/perturbations.py
46
+ StatTools/experimental/synthesis/__init__.py
47
+ StatTools/experimental/synthesis/tools.py
48
+ StatTools/filters/kalman_filter.py
49
+ StatTools/filters/symbolic_kalman.py
50
+ StatTools/generators/__init__.py
51
+ StatTools/generators/base_filter.py
52
+ StatTools/generators/cholesky_transform.py
53
+ StatTools/generators/fbm.py
54
+ StatTools/generators/field_generator.py
55
+ StatTools/generators/kasdin_generator.py
56
+ StatTools/generators/lbfbm_generator.py
57
+ StatTools/generators/ndfnoise_generator.py
58
+ StatTools/native/.gitkeep
59
+ StatTools/utilities/deprecation.py
60
+ StatTools/visualization/__init__.py
61
+ StatTools/visualization/plot_ff.py
62
+ research/Video-based_marker-free_tracking_and_multi-scale_analysis.ipynb
63
+ research/__init__.py
64
+ research/bma.ipynb
65
+ research/ff_analysis.ipynb
66
+ research/lbfbm_generator.ipynb
67
+ research/ndfnoise_generator.ipynb
68
+ research/readme.md
69
+ research/kalman_filter/__init__.py
70
+ research/kalman_filter/high-order_kalman.ipynb
71
+ research/kalman_filter/kalman-kasdin.ipynb
72
+ research/kalman_filter/kalman_experiments.py
73
+ research/kalman_filter/kalman_filter.ipynb
74
+ research/kalman_filter/kalman_filter[ru].ipynb
75
+ research/kalman_filter/svd_dfa_demo.ipynb
76
+ src/cpp/DFA.cpp
77
+ src/cpp/StatTools_C_API.cpp
78
+ src/cpp/StatTools_bindings.cpp
79
+ src/cpp/StatTools_core.cpp
80
+ src/cpp/StatTools_core.h
81
+ tests/test_bma.py
82
+ tests/test_dfa.py
83
+ tests/test_dfa_func.py
84
+ tests/test_dpcca.py
85
+ tests/test_fa.py
86
+ tests/test_filter.py
87
+ tests/test_filtered_array.py
88
+ tests/test_kalman_filter.py
89
+ tests/test_kasdin_generator.py
90
+ tests/test_lbfbm_generator.py
91
+ tests/test_nddfa.py
92
+ tests/test_ndfnoise_generator.py
93
+ tests/test_ne_dfa.py
94
+ tests/test_pybind11_bindings.py
95
+ tests/test_svd_dfa.py
96
+ tests/test_unified_generator.py
97
+ tests/test_utils.py
98
+ tests_manual/cholesky_with_R.py
99
+ tests_manual/dfa_test.py
100
+ tests_manual/dpcca_pipe.py
101
+ tests_manual/dpcca_test.py
102
+ tests_manual/ff_visualization_test.py
103
+ tests_manual/ff_zero_crossover_visualisation_test.py
104
+ tests_manual/test_buffer.py
@@ -4,11 +4,6 @@ scipy>=1.13.1
4
4
  setuptools>=70.0.0
5
5
  tqdm~=4.62.3
6
6
  pandas>=1.3.5
7
+ filterpy>=1.4.5
7
8
  sympy>=1.14.0
8
9
  pybind11>=2.11.1
9
-
10
- [experimental]
11
- filterpy
12
-
13
- [test]
14
- pytest-timeout
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: FluctuationAnalysisTools
3
- Version: 1.11.0
3
+ Version: 1.11.0.dev0
4
4
  Summary: Python library for DFA, Hurst exponent, and fluctuation analysis of time series.
5
5
  Author: Maya Gavrichenkova, Timofey Baburin, Olga Ivleva
6
6
  Author-email: Aleksandr Sinitca <amsinitca@etu.ru>, Alexandr Kuzmenko <alexander.k.spb@gmail.com>, Asya Lyanova <ailianova@etu.ru>
@@ -17,12 +17,9 @@ Requires-Dist: scipy>=1.13.1
17
17
  Requires-Dist: setuptools>=70.0.0
18
18
  Requires-Dist: tqdm~=4.62.3
19
19
  Requires-Dist: pandas>=1.3.5
20
+ Requires-Dist: filterpy>=1.4.5
20
21
  Requires-Dist: sympy>=1.14.0
21
22
  Requires-Dist: pybind11>=2.11.1
22
- Provides-Extra: test
23
- Requires-Dist: pytest-timeout; extra == "test"
24
- Provides-Extra: experimental
25
- Requires-Dist: filterpy; extra == "experimental"
26
23
  Dynamic: license-file
27
24
 
28
25
  # FluctuationAnalysisTools
@@ -0,0 +1,34 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
12
+
13
+ TYPE_CHECKING = False
14
+ if TYPE_CHECKING:
15
+ from typing import Tuple
16
+ from typing import Union
17
+
18
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
20
+ else:
21
+ VERSION_TUPLE = object
22
+ COMMIT_ID = object
23
+
24
+ version: str
25
+ __version__: str
26
+ __version_tuple__: VERSION_TUPLE
27
+ version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
30
+
31
+ __version__ = version = '1.11.0.dev0'
32
+ __version_tuple__ = version_tuple = (1, 11, 0, 'dev0')
33
+
34
+ __commit_id__ = commit_id = 'g90f7796de'
@@ -0,0 +1,19 @@
1
+ from .bma import bma
2
+ from .dpcca import dpcca
3
+ from .fa import fa
4
+ from .nd_dfa import nd_dfa
5
+ from .support_ff import (
6
+ f_fcn,
7
+ f_fcn_without_overflaw,
8
+ ff_base_appriximation,
9
+ rev_f_fcn,
10
+ tf_minus_inf,
11
+ tf_plus_inf,
12
+ )
13
+ from .utils import (
14
+ analyse_cross_ff,
15
+ analyse_zero_cross_ff,
16
+ cross_fcn_sloped,
17
+ ff_params,
18
+ var_estimation,
19
+ )
@@ -70,22 +70,22 @@ def _bma_worker(
70
70
 
71
71
  t_indices = np.asarray(t_indices)
72
72
 
73
- # start and end for all indices
73
+ # start и end для всех индексов
74
74
  start = t_indices - n + 1
75
75
  end = t_indices
76
76
 
77
- # Array for result
78
- window_sums = np.zeros((cs.shape[0], len(t_indices)), dtype=cs.dtype)
77
+ # Массив для результата
78
+ window_sums = np.empty((cs.shape[0], len(t_indices)), dtype=cs.dtype)
79
79
 
80
- # Masks
80
+ # Маски
81
81
  mask_start_le_zero = start <= 0
82
82
  mask_start_gt_zero = ~mask_start_le_zero
83
83
 
84
- # Handle start <= 0
84
+ # Обработка start <= 0
85
85
  if mask_start_le_zero.any():
86
86
  window_sums[:, mask_start_le_zero] = cs[:, end[mask_start_le_zero]]
87
87
 
88
- # Handle start > 0
88
+ # Обработка start > 0
89
89
  if mask_start_gt_zero.any():
90
90
  window_sums[:, mask_start_gt_zero] = (
91
91
  cs[:, end[mask_start_gt_zero]] - cs[:, start[mask_start_gt_zero] - 1]
@@ -216,13 +216,13 @@ def bma(
216
216
  if isinstance(s, Iterable) and not isinstance(s, (str, bytes)):
217
217
  s = list(s)
218
218
  init_s_len = len(s)
219
- s = [x for x in s if x <= L / 4]
219
+ s = list(filter(lambda x: x <= L / 4, s))
220
220
  if len(s) < 1:
221
221
  raise ValueError(
222
222
  "All input scale values are larger than series length / 4!"
223
223
  )
224
224
  if len(s) != init_s_len:
225
- warnings.warn(f"BMA warning: only following scales are in use: {s}")
225
+ warnings.warn(f"\tBMA warning: only following scales are in use: {s}")
226
226
  elif isinstance(s, (float, int)):
227
227
  if s > L / 4:
228
228
  raise ValueError("Cannot use scale > length / 4")
@@ -1,6 +1,5 @@
1
1
  import time
2
2
  import warnings
3
- from collections.abc import Sequence
4
3
  from contextlib import closing
5
4
  from ctypes import c_double
6
5
  from functools import partial
@@ -134,8 +133,6 @@ def dfa(
134
133
  degree: int = 2,
135
134
  processes: int = 1,
136
135
  n_integral: int = 1,
137
- s_values: Union[int, Sequence, None] = None,
138
- s_min: int = 5,
139
136
  ) -> Tuple[np.ndarray, np.ndarray]:
140
137
  """
141
138
  Implementation of the Detrended Fluctuation Analysis (DFA) method.
@@ -148,8 +145,6 @@ def dfa(
148
145
  degree (int): Polynomial degree for detrending (default: 2).
149
146
  processes (int): Number of parallel workers (default: 1).
150
147
  n_integral (int): Number of cumulative sum operations to apply (default: 1).
151
- s_values (Union[int, Sequence, None]): points where fluctuation function F^2(s) is calculated (default: None).
152
- s_min (int): Minimal scale in s_values (default: 5).
153
148
 
154
149
  Returns:
155
150
  tuple: (s, F2_s)
@@ -169,38 +164,8 @@ def dfa(
169
164
  raise ValueError("Only 1D or 2D arrays are allowed!")
170
165
 
171
166
  series_len = data.shape[1]
172
- if s_values is None:
173
- s_max = int(series_len / 4)
174
- if s_max < s_min:
175
- raise ValueError(
176
- f"Cannot create scales with s_max({s_max}) < s_min({s_min})"
177
- )
178
- s_values = [
179
- int(exp(step)) for step in np.arange(np.log(s_min), np.log(s_max), 0.5)
180
- ]
181
- elif isinstance(s_values, Sequence):
182
- init_s_len = len(s_values)
183
- if init_s_len < 1:
184
- raise ValueError("Input s_values is empty.")
185
- s_values = list(filter(lambda x: x <= series_len / 4, s_values))
186
- if len(s_values) < 1:
187
- raise ValueError(
188
- "Invalid s_values: all entries are greater than L / 4. "
189
- "No valid scales found for analysis."
190
- )
191
-
192
- if len(s_values) != init_s_len:
193
- warnings.warn(
194
- f"DFA warning: only following S values are in use: {s_values}"
195
- f"\nOriginal input had {init_s_len} values.",
196
- UserWarning,
197
- stacklevel=2,
198
- )
199
-
200
- elif isinstance(s_values, (float, int)):
201
- if s_values > series_len / 4:
202
- raise ValueError("Cannot use S > L / 4")
203
- s_values = (s_values,)
167
+ s_max = int(series_len / 4)
168
+ s_values = [int(exp(step)) for step in np.arange(1.6, np.log(s_max), 0.5)]
204
169
 
205
170
  n_series = data.shape[0]
206
171
  results = None
@@ -0,0 +1,313 @@
1
+ import gc
2
+ from collections.abc import Iterable
3
+ from contextlib import closing
4
+ from ctypes import c_double
5
+ from functools import partial
6
+ from multiprocessing import Pool
7
+ from typing import Union
8
+
9
+ import numpy as np
10
+
11
+ from StatTools.auxiliary import SharedBuffer
12
+
13
+
14
+ def _covariation(signal: np.ndarray):
15
+ """
16
+ Implementation equation (4) from [1]
17
+
18
+ [1] Yuan, N., Fu, Z., Zhang, H. et al. Detrended Partial-Cross-Correlation Analysis: A New Method for Analyzing Correlations in Complex System. Sci Rep 5, 8143 (2015). https://doi.org/10.1038/srep08143
19
+ """
20
+ F = np.zeros((signal.shape[0], signal.shape[0]), dtype=float)
21
+ for n in range(signal.shape[0]):
22
+ for m in range(n + 1):
23
+ F[n][m] = np.mean(signal[n] * signal[m])
24
+ F[m][n] = F[n][m]
25
+ return F
26
+
27
+
28
+ def _correlation(F: np.ndarray):
29
+ """
30
+ Implementation equation (6) from [1]
31
+ [1] Yuan, N., Fu, Z., Zhang, H. et al. Detrended Partial-Cross-Correlation Analysis: A New Method for Analyzing Correlations in Complex System. Sci Rep 5, 8143 (2015). https://doi.org/10.1038/srep08143
32
+ """
33
+ R = np.zeros((F.shape[0], F.shape[0]), dtype=float)
34
+ for n in range(F.shape[0]):
35
+ for m in range(n + 1):
36
+ R[n][m] = F[n][m] / np.sqrt(F[n][n] * F[m][m])
37
+ R[m][n] = R[n][m]
38
+ return R
39
+
40
+
41
+ def _cross_correlation(R: np.ndarray):
42
+ """
43
+ Implementation equation (9) from [1]
44
+ [1] Yuan, N., Fu, Z., Zhang, H. et al. Detrended Partial-Cross-Correlation Analysis: A New Method for Analyzing Correlations in Complex System. Sci Rep 5, 8143 (2015). https://doi.org/10.1038/srep08143
45
+ """
46
+ P = np.zeros((R.shape[0], R.shape[0]), dtype=float)
47
+ Cinv = np.linalg.inv(R)
48
+ for n in range(R.shape[0]):
49
+ for m in range(n + 1):
50
+ if Cinv[n][n] * Cinv[m][m] < 0:
51
+ print(f" Error: Sqrt(-1)! No P array values for this S!")
52
+ break
53
+ P[n][m] = -Cinv[n][m] / np.sqrt(Cinv[n][n] * Cinv[m][m])
54
+ P[m][n] = P[n][m]
55
+ else:
56
+ continue
57
+ break
58
+ return P
59
+
60
+
61
+ # @profile()
62
+ def dpcca_worker(
63
+ s: Union[int, Iterable],
64
+ arr: Union[np.ndarray, None],
65
+ step: float,
66
+ pd: int,
67
+ buffer_in_use: bool,
68
+ gc_params: tuple = None,
69
+ short_vectors=False,
70
+ n_integral=1,
71
+ ) -> Union[tuple, None]:
72
+ """
73
+ Core of DPCAA algorithm. Takes bunch of S-values and returns 3 3d-matrices: first index
74
+ represents S value.
75
+ """
76
+ gc.set_threshold(10, 2, 2)
77
+ s_current = [s] if not isinstance(s, Iterable) else s
78
+
79
+ if buffer_in_use:
80
+ cumsum_arr = SharedBuffer.get("ARR")
81
+ else:
82
+ cumsum_arr = arr
83
+ for _ in range(n_integral):
84
+ cumsum_arr = np.cumsum(cumsum_arr, axis=1)
85
+
86
+ shape = cumsum_arr.shape if buffer_in_use else arr.shape
87
+
88
+ F = np.zeros((len(s_current), shape[0], shape[0]), dtype=float)
89
+ R = np.zeros((len(s_current), shape[0], shape[0]), dtype=float)
90
+ P = np.zeros((len(s_current), shape[0], shape[0]), dtype=float)
91
+
92
+ for s_i, s_val in enumerate(s_current):
93
+
94
+ V = np.arange(0, shape[1] - s_val, int(step * s_val))
95
+ Xw = np.arange(s_val, dtype=int)
96
+ Y = np.zeros((shape[0], len(V)), dtype=object)
97
+
98
+ for n in range(cumsum_arr.shape[0]):
99
+ for v_i, v in enumerate(V):
100
+ W = cumsum_arr[n][v : v + s_val]
101
+ if len(W) == 0:
102
+ print(f"\tFor s = {s_val} W is an empty slice!")
103
+ return P, R, F
104
+
105
+ p = np.polyfit(Xw, W, deg=pd)
106
+ Z = np.polyval(p, Xw)
107
+ Y[n][v_i] = Z - W
108
+
109
+ if gc_params is not None:
110
+ if n % gc_params[0] == 0:
111
+ gc.collect(gc_params[1])
112
+
113
+ Y = np.array([np.concatenate(Y[i]) for i in range(Y.shape[0])])
114
+
115
+ F[s_i] = _covariation(Y)
116
+ R[s_i] = _correlation(F[s_i])
117
+ P[s_i] = _cross_correlation(R[s_i])
118
+
119
+ return P, R, F
120
+
121
+
122
+ def start_pool_with_buffer(
123
+ buffer: SharedBuffer,
124
+ processes: int,
125
+ s_by_workers: np.ndarray,
126
+ pd: int,
127
+ step: float,
128
+ gc_params: tuple = None,
129
+ n_integral=1,
130
+ ):
131
+
132
+ for _ in range(n_integral):
133
+ buffer.apply_in_place(np.cumsum, by_1st_dim=True)
134
+
135
+ with closing(
136
+ Pool(
137
+ processes=processes,
138
+ initializer=buffer.buffer_init,
139
+ initargs=({"ARR": buffer},),
140
+ )
141
+ ) as pool:
142
+ pool_result = pool.map(
143
+ partial(
144
+ dpcca_worker,
145
+ arr=None,
146
+ pd=pd,
147
+ step=step,
148
+ buffer_in_use=True,
149
+ gc_params=gc_params,
150
+ ),
151
+ s_by_workers,
152
+ )
153
+
154
+ return pool_result
155
+
156
+
157
+ def concatenate_3d_matrices(p: np.ndarray, r: np.ndarray, f: np.ndarray):
158
+ P = np.concatenate(p, axis=1)[0]
159
+ R = np.concatenate(r, axis=1)[0]
160
+ F = np.concatenate(f, axis=1)[0]
161
+ return P, R, F
162
+
163
+
164
+ def dpcca(
165
+ arr: np.ndarray,
166
+ pd: int,
167
+ step: float,
168
+ s: Union[int, Iterable],
169
+ processes: int = 1,
170
+ buffer: Union[bool, SharedBuffer] = False,
171
+ gc_params: tuple = None,
172
+ short_vectors: bool = False,
173
+ n_integral: int = 1,
174
+ ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
175
+ """Implementation of the Detrended Partial-Cross-Correlation Analysis method proposed by Yuan, N. et al.[1]
176
+
177
+ Basic usage:
178
+ You can get whole F(s) function for first vector as:
179
+ ```python
180
+ s_vals = [i**2 for i in range(1, 5)]
181
+ P, R, F, S = dpcaa(input_array, 2, 0.5, s_vals, len(s_vals))
182
+ fluct_func = [F[s][0][0] for s in s_vals]
183
+ ```
184
+ [1] Yuan, N., Fu, Z., Zhang, H. et al. Detrended Partial-Cross-Correlation Analysis:
185
+ A New Method for Analyzing Correlations in Complex System. Sci Rep 5, 8143 (2015).
186
+ https://doi.org/10.1038/srep08143
187
+
188
+ Args:
189
+ arr (ndarray): dataset array
190
+ pd (int): polynomial degree
191
+ step (float): share of S - value. It's set usually as 0.5. The integer part of the number will be taken
192
+ s (Union[int, Iterable]): points where fluctuation function F(s) is calculated. More on that in the article.
193
+ processes (int, optional): num of workers to spawn. Defaults to 1.
194
+ buffer (Union[bool, SharedBuffer], optional): allows to share input array between processes. Defaults to False.
195
+ gc_params (tuple, optional): _description_. Defaults to None.
196
+ short_vectors (bool, optional): _description_. Defaults to False.
197
+ n_integral (int, optional): Number of cumsum operation before computation. Defaults to 1.
198
+
199
+ Raises:
200
+ ValueError: All input S values are larger than vector shape / 4.
201
+ ValueError: Cannot use S > L / 4.
202
+ ValueError: Wrong type of input buffer, if buffer is not SharedBuffer
203
+
204
+ Returns:
205
+ tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: [P, R, F^2, S], where
206
+ P is a partial cross-correlation levels on different time scales, coefficients can be used
207
+ to characterize the `intrinsic` relations between the two time series on time scales of S.
208
+ R is a coefficients matrix represents the level of cross-correlation on time scales of S.
209
+ However, it should be noted that it only shows the relations between two time series.
210
+ This may provide spurious correlation information if the two time series are both correlated with other signals.
211
+ F^2 is a covariance matrix (covariance between any two residuals on each scale),
212
+ S is used scales.
213
+ """
214
+ if short_vectors:
215
+ return dpcca_worker(
216
+ s,
217
+ arr,
218
+ step,
219
+ pd,
220
+ buffer_in_use=False,
221
+ gc_params=gc_params,
222
+ short_vectors=True,
223
+ n_integral=n_integral,
224
+ ) + (s,)
225
+
226
+ concatenate_all = False # concatenate if 1d array , no need to use 3d P, R, F
227
+ if arr.ndim == 1:
228
+ arr = np.array([arr])
229
+ concatenate_all = True
230
+
231
+ if isinstance(s, Iterable):
232
+ init_s_len = len(s)
233
+
234
+ s = list(filter(lambda x: x <= arr.shape[1] / 4, s))
235
+ if len(s) < 1:
236
+ raise ValueError("All input S values are larger than vector shape / 4 !")
237
+
238
+ if len(s) != init_s_len:
239
+ print(f"\tDPCAA warning: only following S values are in use: {s}")
240
+
241
+ elif isinstance(s, (float, int)):
242
+ if s > arr.shape[1] / 4:
243
+ raise ValueError("Cannot use S > L / 4")
244
+ s = (s,)
245
+
246
+ if processes == 1 or len(s) == 1:
247
+ p, r, f = dpcca_worker(
248
+ s,
249
+ arr,
250
+ step,
251
+ pd,
252
+ buffer_in_use=False,
253
+ gc_params=gc_params,
254
+ n_integral=n_integral,
255
+ )
256
+ if concatenate_all:
257
+ return concatenate_3d_matrices(p, r, f) + (s,)
258
+
259
+ return p, r, f, s
260
+
261
+ processes = len(s) if processes > len(s) else processes
262
+
263
+ S = np.array(s, dtype=int) if not isinstance(s, np.ndarray) else s
264
+ S_by_workers = np.array_split(S, processes)
265
+
266
+ if isinstance(buffer, bool):
267
+ if buffer:
268
+ shared_input = SharedBuffer(arr.shape, c_double)
269
+ shared_input.write(arr)
270
+
271
+ pool_result = start_pool_with_buffer(
272
+ shared_input,
273
+ processes,
274
+ S_by_workers,
275
+ pd,
276
+ step,
277
+ gc_params,
278
+ n_integral=n_integral,
279
+ )
280
+
281
+ else:
282
+ with closing(Pool(processes=processes)) as pool:
283
+ pool_result = pool.map(
284
+ partial(
285
+ dpcca_worker,
286
+ arr=arr,
287
+ pd=pd,
288
+ step=step,
289
+ buffer_in_use=False,
290
+ gc_params=gc_params,
291
+ n_integral=n_integral,
292
+ ),
293
+ S_by_workers,
294
+ )
295
+
296
+ elif isinstance(buffer, SharedBuffer):
297
+ pool_result = start_pool_with_buffer(
298
+ buffer, processes, S_by_workers, pd, step, gc_params, n_integral=n_integral
299
+ )
300
+ else:
301
+ raise ValueError("Wrong type of input buffer!")
302
+
303
+ P, R, F = np.array([]), np.array([]), np.array([])
304
+
305
+ for res in pool_result:
306
+ P = res[0] if P.size < 1 else np.vstack((P, res[0]))
307
+ R = res[1] if R.size < 1 else np.vstack((R, res[1]))
308
+ F = res[2] if F.size < 1 else np.vstack((F, res[2]))
309
+
310
+ if concatenate_all:
311
+ return concatenate_3d_matrices(P, R, F) + (s,)
312
+
313
+ return P, R, F, s