rebound 5.2.2__tar.gz → 5.2.3__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 (144) hide show
  1. {rebound-5.2.2/rebound.egg-info → rebound-5.2.3}/PKG-INFO +2 -2
  2. {rebound-5.2.2 → rebound-5.2.3}/README.md +1 -1
  3. {rebound-5.2.2 → rebound-5.2.3}/pyproject.toml +1 -1
  4. {rebound-5.2.2 → rebound-5.2.3}/rebound/frequency_analysis.py +3 -2
  5. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_frequency_analysis.py +14 -3
  6. {rebound-5.2.2 → rebound-5.2.3/rebound.egg-info}/PKG-INFO +2 -2
  7. {rebound-5.2.2 → rebound-5.2.3}/setup.py +1 -1
  8. {rebound-5.2.2 → rebound-5.2.3}/src/frequency_analysis.c +10 -5
  9. {rebound-5.2.2 → rebound-5.2.3}/src/rebound.c +1 -1
  10. {rebound-5.2.2 → rebound-5.2.3}/src/simulationarchive.c +27 -28
  11. {rebound-5.2.2 → rebound-5.2.3}/LICENSE +0 -0
  12. {rebound-5.2.2 → rebound-5.2.3}/MANIFEST.in +0 -0
  13. {rebound-5.2.2 → rebound-5.2.3}/rebound/__init__.py +0 -0
  14. {rebound-5.2.2 → rebound-5.2.3}/rebound/binarydata_field_descriptor.py +0 -0
  15. {rebound-5.2.2 → rebound-5.2.3}/rebound/citations.py +0 -0
  16. {rebound-5.2.2 → rebound-5.2.3}/rebound/horizons.py +0 -0
  17. {rebound-5.2.2 → rebound-5.2.3}/rebound/integrator.py +0 -0
  18. {rebound-5.2.2 → rebound-5.2.3}/rebound/ode.py +0 -0
  19. {rebound-5.2.2 → rebound-5.2.3}/rebound/orbit.py +0 -0
  20. {rebound-5.2.2 → rebound-5.2.3}/rebound/particle.py +0 -0
  21. {rebound-5.2.2 → rebound-5.2.3}/rebound/particles.py +0 -0
  22. {rebound-5.2.2 → rebound-5.2.3}/rebound/plotting.py +0 -0
  23. {rebound-5.2.2 → rebound-5.2.3}/rebound/rotation.py +0 -0
  24. {rebound-5.2.2 → rebound-5.2.3}/rebound/simulation.py +0 -0
  25. {rebound-5.2.2 → rebound-5.2.3}/rebound/simulationarchive.py +0 -0
  26. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/__init__.py +0 -0
  27. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_additional_forces.py +0 -0
  28. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_binary_fields.py +0 -0
  29. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_boundary.py +0 -0
  30. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_bs.py +0 -0
  31. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_collisions.py +0 -0
  32. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_copy.py +0 -0
  33. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_data.py +0 -0
  34. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_eos.py +0 -0
  35. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_fpcontract.py +0 -0
  36. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_gravity.py +0 -0
  37. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_horizons.py +0 -0
  38. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_import.py +0 -0
  39. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_integrator.py +0 -0
  40. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_janus.py +0 -0
  41. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_leapfrog.py +0 -0
  42. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_megno.py +0 -0
  43. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_mercurius.py +0 -0
  44. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_modify_orbital_parameters.py +0 -0
  45. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_name.py +0 -0
  46. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_orbital_elements.py +0 -0
  47. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_particle.py +0 -0
  48. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_pickle.py +0 -0
  49. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_plotting.py +0 -0
  50. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_post_timestep_modifications.py +0 -0
  51. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_random.py +0 -0
  52. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_restart_mercurius.py +0 -0
  53. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_rotations.py +0 -0
  54. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_saba.py +0 -0
  55. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_serialize.py +0 -0
  56. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_server.py +0 -0
  57. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_shearingsheet.py +0 -0
  58. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_simulation.py +0 -0
  59. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_simulationarchive.py +0 -0
  60. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_simulationarchive_matrix.py +0 -0
  61. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_size_of_simulation.py +0 -0
  62. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_tponly_encounter.py +0 -0
  63. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_trace.py +0 -0
  64. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_trace_full_bs.py +0 -0
  65. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_trace_full_ias15.py +0 -0
  66. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_transformations.py +0 -0
  67. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_units.py +0 -0
  68. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_variational.py +0 -0
  69. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_whfast.py +0 -0
  70. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_whfast512.py +0 -0
  71. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_whfast_advanced.py +0 -0
  72. {rebound-5.2.2 → rebound-5.2.3}/rebound/tests/test_whfast_testparticles.py +0 -0
  73. {rebound-5.2.2 → rebound-5.2.3}/rebound/tools.py +0 -0
  74. {rebound-5.2.2 → rebound-5.2.3}/rebound/units.py +0 -0
  75. {rebound-5.2.2 → rebound-5.2.3}/rebound/variation.py +0 -0
  76. {rebound-5.2.2 → rebound-5.2.3}/rebound/vectors.py +0 -0
  77. {rebound-5.2.2 → rebound-5.2.3}/rebound/widget.py +0 -0
  78. {rebound-5.2.2 → rebound-5.2.3}/rebound.egg-info/SOURCES.txt +0 -0
  79. {rebound-5.2.2 → rebound-5.2.3}/rebound.egg-info/dependency_links.txt +0 -0
  80. {rebound-5.2.2 → rebound-5.2.3}/rebound.egg-info/top_level.txt +0 -0
  81. {rebound-5.2.2 → rebound-5.2.3}/setup.cfg +0 -0
  82. {rebound-5.2.2 → rebound-5.2.3}/src/binarydata.c +0 -0
  83. {rebound-5.2.2 → rebound-5.2.3}/src/binarydata.h +0 -0
  84. {rebound-5.2.2 → rebound-5.2.3}/src/boundary.c +0 -0
  85. {rebound-5.2.2 → rebound-5.2.3}/src/boundary.h +0 -0
  86. {rebound-5.2.2 → rebound-5.2.3}/src/collision.c +0 -0
  87. {rebound-5.2.2 → rebound-5.2.3}/src/collision.h +0 -0
  88. {rebound-5.2.2 → rebound-5.2.3}/src/communication_mpi.c +0 -0
  89. {rebound-5.2.2 → rebound-5.2.3}/src/communication_mpi.h +0 -0
  90. {rebound-5.2.2 → rebound-5.2.3}/src/derivatives.c +0 -0
  91. {rebound-5.2.2 → rebound-5.2.3}/src/derivatives.h +0 -0
  92. {rebound-5.2.2 → rebound-5.2.3}/src/display.c +0 -0
  93. {rebound-5.2.2 → rebound-5.2.3}/src/display.h +0 -0
  94. {rebound-5.2.2 → rebound-5.2.3}/src/fmemopen.c +0 -0
  95. {rebound-5.2.2 → rebound-5.2.3}/src/fmemopen.h +0 -0
  96. {rebound-5.2.2 → rebound-5.2.3}/src/frequency_analysis.h +0 -0
  97. {rebound-5.2.2 → rebound-5.2.3}/src/glad.c +0 -0
  98. {rebound-5.2.2 → rebound-5.2.3}/src/glad.h +0 -0
  99. {rebound-5.2.2 → rebound-5.2.3}/src/gravity.c +0 -0
  100. {rebound-5.2.2 → rebound-5.2.3}/src/gravity.h +0 -0
  101. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_bs.c +0 -0
  102. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_bs.h +0 -0
  103. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_eos.c +0 -0
  104. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_eos.h +0 -0
  105. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_ias15.c +0 -0
  106. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_ias15.h +0 -0
  107. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_janus.c +0 -0
  108. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_janus.h +0 -0
  109. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_leapfrog.c +0 -0
  110. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_leapfrog.h +0 -0
  111. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_mercurius.c +0 -0
  112. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_mercurius.h +0 -0
  113. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_saba.c +0 -0
  114. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_saba.h +0 -0
  115. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_sei.c +0 -0
  116. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_sei.h +0 -0
  117. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_trace.c +0 -0
  118. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_trace.h +0 -0
  119. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_whfast.c +0 -0
  120. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_whfast.h +0 -0
  121. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_whfast512.c +0 -0
  122. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_whfast512.h +0 -0
  123. {rebound-5.2.2 → rebound-5.2.3}/src/integrator_whfast512.s +0 -0
  124. {rebound-5.2.2 → rebound-5.2.3}/src/khrplatform.h +0 -0
  125. {rebound-5.2.2 → rebound-5.2.3}/src/output.c +0 -0
  126. {rebound-5.2.2 → rebound-5.2.3}/src/output.h +0 -0
  127. {rebound-5.2.2 → rebound-5.2.3}/src/particle.c +0 -0
  128. {rebound-5.2.2 → rebound-5.2.3}/src/particle.h +0 -0
  129. {rebound-5.2.2 → rebound-5.2.3}/src/rebound.h +0 -0
  130. {rebound-5.2.2 → rebound-5.2.3}/src/rebound_internal.h +0 -0
  131. {rebound-5.2.2 → rebound-5.2.3}/src/rotations.c +0 -0
  132. {rebound-5.2.2 → rebound-5.2.3}/src/rotations.h +0 -0
  133. {rebound-5.2.2 → rebound-5.2.3}/src/server.c +0 -0
  134. {rebound-5.2.2 → rebound-5.2.3}/src/server.h +0 -0
  135. {rebound-5.2.2 → rebound-5.2.3}/src/simplefont.h +0 -0
  136. {rebound-5.2.2 → rebound-5.2.3}/src/simulation.c +0 -0
  137. {rebound-5.2.2 → rebound-5.2.3}/src/simulation.h +0 -0
  138. {rebound-5.2.2 → rebound-5.2.3}/src/simulationarchive.h +0 -0
  139. {rebound-5.2.2 → rebound-5.2.3}/src/tools.c +0 -0
  140. {rebound-5.2.2 → rebound-5.2.3}/src/tools.h +0 -0
  141. {rebound-5.2.2 → rebound-5.2.3}/src/transformations.c +0 -0
  142. {rebound-5.2.2 → rebound-5.2.3}/src/transformations.h +0 -0
  143. {rebound-5.2.2 → rebound-5.2.3}/src/tree.c +0 -0
  144. {rebound-5.2.2 → rebound-5.2.3}/src/tree.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rebound
3
- Version: 5.2.2
3
+ Version: 5.2.3
4
4
  Summary: An open-source multi-purpose N-body code
5
5
  Author-email: Hanno Rein <hanno@hanno-rein.de>
6
6
  License-Expression: GPL-3.0-only
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Dynamic: license-file
19
19
 
20
- [![Version](https://img.shields.io/badge/rebound-v5.2.2-green.svg?style=flat)](https://rebound.hanno-rein.de)
20
+ [![Version](https://img.shields.io/badge/rebound-v5.2.3-green.svg?style=flat)](https://rebound.hanno-rein.de)
21
21
  [![PyPI](https://badge.fury.io/py/rebound.svg)](https://badge.fury.io/py/rebound)
22
22
  [![GPL](https://img.shields.io/badge/license-GPL-green.svg?style=flat)](https://github.com/hannorein/rebound/blob/main/LICENSE)
23
23
  [![Docs](https://img.shields.io/badge/Documentation-green.svg?style=flat)](https://rebound.hanno-rein.de/)
@@ -1,4 +1,4 @@
1
- [![Version](https://img.shields.io/badge/rebound-v5.2.2-green.svg?style=flat)](https://rebound.hanno-rein.de)
1
+ [![Version](https://img.shields.io/badge/rebound-v5.2.3-green.svg?style=flat)](https://rebound.hanno-rein.de)
2
2
  [![PyPI](https://badge.fury.io/py/rebound.svg)](https://badge.fury.io/py/rebound)
3
3
  [![GPL](https://img.shields.io/badge/license-GPL-green.svg?style=flat)](https://github.com/hannorein/rebound/blob/main/LICENSE)
4
4
  [![Docs](https://img.shields.io/badge/Documentation-green.svg?style=flat)](https://rebound.hanno-rein.de/)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rebound"
7
- version = "5.2.2"
7
+ version = "5.2.3"
8
8
  description = "An open-source multi-purpose N-body code"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = "GPL-3.0-only"
@@ -4,9 +4,10 @@ FREQUENCY_ANALYSIS_TYPES = {"mft": 0, "fmft": 1, "fmft2": 2}
4
4
  FREQUENCY_ANALYSIS_ERRORS = [
5
5
  (-1, "Frequency analysis error: minfreq must be smaller than maxfreq."),
6
6
  (-2, "Frequency analysis error: nfreq must be larger than 0."),
7
- (-3, "Frequency analysis error: ndata must be power of 2."),
7
+ (-3, "Frequency analysis error: ndata must be a power of 2 and at least 2."),
8
8
  (-4, "Frequency analysis error: input array is NULL."),
9
9
  (-5, "Frequency analysis error: pointer to output array is NULL."),
10
+ (-6, "Frequency analysis error: cannot find frequencies in range [minfreq, maxfreq]."),
10
11
  ]
11
12
 
12
13
  def frequency_analysis(inp, type=0, nfreq=10, minfreq=-1e-3, maxfreq=1e-3):
@@ -49,7 +50,7 @@ def frequency_analysis(inp, type=0, nfreq=10, minfreq=-1e-3, maxfreq=1e-3):
49
50
  if inp.dtype != np.float64:
50
51
  raise ValueError("Input array must be have datatype np.float64")
51
52
 
52
- if isinstance(type, int):
53
+ if isinstance(type, int) and type in FREQUENCY_ANALYSIS_TYPES.values():
53
54
  type = ctypes.c_uint(type)
54
55
  elif isinstance(type, str):
55
56
  type = type.lower()
@@ -29,7 +29,7 @@ class TestFrequencyAnalysis(unittest.TestCase):
29
29
  nu_error = np.abs(nu[i]*1296000.0/datasep-nu5[i])
30
30
  self.assertLess(nu_error, 3e-4)
31
31
  A_error = np.abs((A[i]-A5[i])/A5[i])
32
- self.assertLess(nu_error, 2e-3)
32
+ self.assertLess(A_error, 2e-3)
33
33
  phi_error = np.abs(phi[i]/np.pi*180.0-phi5[i])
34
34
  self.assertLess(phi_error, 5e-1)
35
35
  def test_LA1990_type_1(self):
@@ -39,7 +39,7 @@ class TestFrequencyAnalysis(unittest.TestCase):
39
39
  nu_error = np.abs(nu[i]*1296000.0/datasep-nu5[i])
40
40
  self.assertLess(nu_error, 4e-6)
41
41
  A_error = np.abs((A[i]-A5[i])/A5[i])
42
- self.assertLess(nu_error, 1e-5)
42
+ self.assertLess(A_error, 1e-5)
43
43
  phi_error = np.abs(phi[i]/np.pi*180.0-phi5[i])
44
44
  self.assertLess(phi_error, 6e-3)
45
45
  def test_LA1990_type_2(self):
@@ -49,9 +49,20 @@ class TestFrequencyAnalysis(unittest.TestCase):
49
49
  nu_error = np.abs(nu[i]*1296000.0/datasep-nu5[i])
50
50
  self.assertLess(nu_error, 2e-8)
51
51
  A_error = np.abs((A[i]-A5[i])/A5[i])
52
- self.assertLess(nu_error, 3e-7)
52
+ self.assertLess(A_error, 3e-7)
53
53
  phi_error = np.abs(phi[i]/np.pi*180.0-phi5[i])
54
54
  self.assertLess(phi_error, 5e-5)
55
+ def test_invalid_analysis_type(self):
56
+ with self.assertRaises(ValueError):
57
+ rebound.frequency_analysis(np.zeros(16), type=3)
58
+ with self.assertRaises(ValueError):
59
+ rebound.frequency_analysis(np.zeros(16), type="other")
60
+ def test_no_frequencies_in_range(self):
61
+ domain = np.arange(16)
62
+ signal = np.zeros(2*len(domain)) # interleaved real/imaginary values
63
+ signal[0::2] = np.cos(np.pi / 4 * domain) # populate real components
64
+ with self.assertRaisesRegex(RuntimeError, "cannot find frequencies"):
65
+ rebound.frequency_analysis(signal, nfreq=1, minfreq=10.0, maxfreq=11.0)
55
66
 
56
67
  if __name__ == "__main__":
57
68
  unittest.main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rebound
3
- Version: 5.2.2
3
+ Version: 5.2.3
4
4
  Summary: An open-source multi-purpose N-body code
5
5
  Author-email: Hanno Rein <hanno@hanno-rein.de>
6
6
  License-Expression: GPL-3.0-only
@@ -17,7 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Dynamic: license-file
19
19
 
20
- [![Version](https://img.shields.io/badge/rebound-v5.2.2-green.svg?style=flat)](https://rebound.hanno-rein.de)
20
+ [![Version](https://img.shields.io/badge/rebound-v5.2.3-green.svg?style=flat)](https://rebound.hanno-rein.de)
21
21
  [![PyPI](https://badge.fury.io/py/rebound.svg)](https://badge.fury.io/py/rebound)
22
22
  [![GPL](https://img.shields.io/badge/license-GPL-green.svg?style=flat)](https://github.com/hannorein/rebound/blob/main/LICENSE)
23
23
  [![Docs](https://img.shields.io/badge/Documentation-green.svg?style=flat)](https://rebound.hanno-rein.de/)
@@ -35,7 +35,7 @@ try:
35
35
  ghash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip()
36
36
  ghash_arg = f"-DGITHASH={ghash}"
37
37
  except Exception:
38
- ghash_arg = "-DGITHASH=b06e3fcd9e50e2d9674f6f859ecd311091dd48b0" #GITHASHAUTOUPDATE
38
+ ghash_arg = "-DGITHASH=96efa5e98f9540c1e94161fe2ea68bead5d2b320" #GITHASHAUTOUPDATE
39
39
 
40
40
  ##### Link args
41
41
  extra_link_args = []
@@ -74,8 +74,8 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
74
74
  printf("Frequency analysis error: nfreq must be larger than 0.\n");
75
75
  return -2;
76
76
  }
77
- if ((ndata & (ndata - 1)) != 0){
78
- printf("Frequency analysis error: ndata must be power of 2.\n");
77
+ if (ndata < 2 || (ndata & (ndata - 1)) != 0){
78
+ printf("Frequency analysis error: ndata must be a power of 2 and at least 2.\n");
79
79
  return -3;
80
80
  }
81
81
  if (!input){
@@ -90,6 +90,8 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
90
90
 
91
91
  /* ALLOCATION OF VARIABLES */
92
92
 
93
+ int status = 0;
94
+
93
95
  double* xdata = malloc(sizeof(double)*ndata);
94
96
  double* ydata = malloc(sizeof(double)*ndata);
95
97
  double* x = malloc(sizeof(double)*ndata);
@@ -160,7 +162,8 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
160
162
  frequencies_removed++;
161
163
  if (frequencies_removed>FMFT_MAX_REMOVE){
162
164
  printf("Frequency analysis error: cannot find frequencies in range [minfreq, maxfreq].\n");
163
- return -6;
165
+ status = -6;
166
+ goto cleanup;
164
167
  }
165
168
  }
166
169
  }else{
@@ -233,7 +236,8 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
233
236
  frequencies_removed++;
234
237
  if (frequencies_removed>FMFT_MAX_REMOVE){
235
238
  printf("Frequency analysis error: cannot find frequencies in range [minfreq, maxfreq].\n");
236
- return -6;
239
+ status = -6;
240
+ goto cleanup;
237
241
  }
238
242
  }
239
243
 
@@ -364,6 +368,7 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
364
368
  // SORT THE FREQUENCIES IN DECREASING ORDER OF AMPLITUDE
365
369
  sort3(nfreq, &(output[1*nfreq]), &(output[0*nfreq]), &(output[1*nfreq]), &(output[2*nfreq]));
366
370
 
371
+ cleanup:
367
372
  /* FREE THE ALLOCATED VARIABLES */
368
373
  free(xdata);
369
374
  free(ydata);
@@ -382,7 +387,7 @@ int reb_frequency_analysis(double *output, size_t nfreq, double minfreq, double
382
387
  free(Q);
383
388
  free(alpha);
384
389
  free(B);
385
- return 0;
390
+ return status;
386
391
  }
387
392
 
388
393
  static void window(double *x, double *y, double *xdata, double *ydata, size_t ndata) {
@@ -40,7 +40,7 @@
40
40
  const uint32_t reb_string_size_max = REB_STRING_SIZE_MAX; // defined in rebound.h
41
41
  const size_t reb_messages_max_N = 10;
42
42
  const char* reb_build_str = __DATE__ " " __TIME__; // Date and time build string.
43
- const char* reb_version_str = "5.2.2"; // **VERSIONLINE** This line gets updated automatically. Do not edit manually.
43
+ const char* reb_version_str = "5.2.3"; // **VERSIONLINE** This line gets updated automatically. Do not edit manually.
44
44
  const char* reb_githash_str = STRINGIFY(GITHASH); // This line gets updated automatically. Do not edit manually.
45
45
 
46
46
  // NULL terminated list of custom registered integrators.
@@ -377,37 +377,36 @@ void reb_simulationarchive_free(struct reb_simulationarchive* sa){
377
377
  }
378
378
 
379
379
  void reb_simulationarchive_heartbeat(struct reb_simulation* const r){
380
- if (r->simulationarchive_filename!=NULL){
381
- int modes = 0;
382
- if (r->simulationarchive_auto_interval!=0) modes++;
383
- if (r->simulationarchive_auto_walltime!=0.) modes++;
384
- if (r->simulationarchive_auto_step!=0) modes++;
385
- if (modes>1){
386
- reb_simulation_error(r,"Only use one of simulationarchive_auto_interval, simulationarchive_auto_walltime, or simulationarchive_auto_step");
387
- }
388
- if (r->simulationarchive_auto_interval!=0.){
389
- const double sign = r->dt>0.?1.:-1;
390
- if (sign*r->simulationarchive_next <= sign*r->t){
391
- r->simulationarchive_next += sign*r->simulationarchive_auto_interval;
392
- //Snap
393
- reb_simulation_save_to_file(r, NULL);
394
- }
380
+ // This function assumes that r->simulationarchive_filename!=NULL
381
+ int modes = 0;
382
+ if (r->simulationarchive_auto_interval!=0) modes++;
383
+ if (r->simulationarchive_auto_walltime!=0.) modes++;
384
+ if (r->simulationarchive_auto_step!=0) modes++;
385
+ if (modes>1){
386
+ reb_simulation_error(r,"Only use one of simulationarchive_auto_interval, simulationarchive_auto_walltime, or simulationarchive_auto_step");
387
+ }
388
+ if (r->simulationarchive_auto_interval!=0.){
389
+ const double sign = r->dt>0.?1.:-1;
390
+ if (sign*r->simulationarchive_next <= sign*r->t){
391
+ r->simulationarchive_next += sign*r->simulationarchive_auto_interval;
392
+ //Snap
393
+ reb_simulation_save_to_file(r, NULL);
395
394
  }
396
- if (r->simulationarchive_auto_step!=0.){
397
- if (r->simulationarchive_next_step <= r->steps_done){
398
- r->simulationarchive_next_step += r->simulationarchive_auto_step;
399
- //Snap
400
- reb_simulation_save_to_file(r, NULL);
401
- }
395
+ }
396
+ if (r->simulationarchive_auto_step!=0.){
397
+ if (r->simulationarchive_next_step <= r->steps_done){
398
+ r->simulationarchive_next_step += r->simulationarchive_auto_step;
399
+ //Snap
400
+ reb_simulation_save_to_file(r, NULL);
402
401
  }
403
- if (r->simulationarchive_auto_walltime!=0.){
404
- if (r->simulationarchive_next <= r->walltime){
405
- r->simulationarchive_next += r->simulationarchive_auto_walltime;
406
- //Snap
407
- reb_simulation_save_to_file(r, NULL);
408
- }
409
- }
410
402
  }
403
+ if (r->simulationarchive_auto_walltime!=0.){
404
+ if (r->simulationarchive_next <= r->walltime){
405
+ r->simulationarchive_next += r->simulationarchive_auto_walltime;
406
+ //Snap
407
+ reb_simulation_save_to_file(r, NULL);
408
+ }
409
+ }
411
410
  }
412
411
 
413
412
  void reb_simulation_save_to_file(struct reb_simulation* const r, const char* filename){
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes