Skip to content

Commit b005b6c

Browse files
authored
Merge pull request #213 from bluescarni/pr/heyoka_updates
Updates for latest heyoka
2 parents 04743c0 + 8d45292 commit b005b6c

21 files changed

+145
-194
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(NOT CMAKE_BUILD_TYPE)
1717
FORCE)
1818
endif()
1919

20-
project(heyoka.py VERSION 7.0.1 LANGUAGES CXX C)
20+
project(heyoka.py VERSION 7.2.0 LANGUAGES CXX C)
2121

2222
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")
2323

@@ -124,7 +124,7 @@ find_package(fmt REQUIRED CONFIG)
124124
message(STATUS "fmt version: ${fmt_VERSION}")
125125

126126
# heyoka.
127-
find_package(heyoka 7.0.0 REQUIRED CONFIG)
127+
find_package(heyoka 7.2.0 REQUIRED CONFIG)
128128

129129
# Python.
130130

doc/changelog.rst

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
Changelog
44
=========
55

6+
7.2.0 (2025-01-02)
7+
------------------
8+
9+
Changes
10+
~~~~~~~
11+
12+
- Clarify that epochs and dates have to be provided to the SGP4
13+
propagator in the UTC scale of time
14+
(`#213 <https://github.com/bluescarni/heyoka.py/pull/213>`__).
15+
- heyoka.py now requires version 7.2.0 of the
16+
heyoka C++ library
17+
(`#213 <https://github.com/bluescarni/heyoka.py/pull/213>`__).
18+
619
7.0.1 (2024-12-29)
720
------------------
821

doc/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dependencies
99
heyoka.py has several Python and C++ dependencies. On the C++ side, heyoka.py depends on:
1010

1111
* the `heyoka C++ library <https://github.com/bluescarni/heyoka>`__,
12-
version 7.0.x (**mandatory**),
12+
version 7.2.x (**mandatory**),
1313
* the `Boost <https://www.boost.org/>`__ C++ libraries (**mandatory**),
1414
* the `{fmt} <https://fmt.dev/latest/index.html>`__ library (**mandatory**),
1515
* the `TBB <https://github.com/oneapi-src/oneTBB>`__ library (**mandatory**),

doc/notebooks/sgp4_propagator.ipynb

+3-13
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,7 @@
123123
"id": "1e3ec1fa-1c09-46f7-a8fe-f6da4c33edb2",
124124
"metadata": {},
125125
"source": [
126-
"{py:func}`~heyoka.model.sgp4_propagator()` takes as only mandatory input argument the list of satellites, here represented as ``Satrec`` objects from the [sgp4 Python module](https://pypi.org/project/sgp4/). The list of satellites can alternatively be passed as a NumPy 2D array containing the GPE data for all satellites (see the documentation). {py:func}`~heyoka.model.sgp4_propagator()` returns a propagator object, by default of type {py:func}`~heyoka.model.sgp4_propagator_dbl()` (i.e., a double-precision propagator). You can also request a single-precision propagator via the {ref}`fp_type keyword argument <api_common_kwargs_fp_type>`.\n",
127-
"\n",
128-
"(tut_sgp4_propagator_epochs)=\n",
129-
"\n",
130-
"## A caveat on epochs and scales of time\n",
131-
"\n",
132-
"When an {py:func}`~heyoka.model.sgp4_propagator()` is constructed from a list of ``Satrec`` objects, the satellite epochs are represented as UTC Julian dates. Consequently, UTC Julian dates must also be used when specifying the {ref}`propagation epochs <tut_sgp4_scalar_propagation>`. The use of UTC Julian dates comes with an important caveat: UTC days do not constitute a uniform scale of time due to the potential presence of [leap seconds](https://en.wikipedia.org/wiki/Leap_second). As a consequence, if the time interval between the satellite epoch and the propagation epoch includes a leap second, the result of the propagation will be slightly wrong.\n",
133-
"\n",
134-
"Considering that the last leap second was added in 2016 and that leap seconds may be phased out altogether by 2035, this quirk should not manifest itself when using contemporary GPE data. For the purpose of this tutorial we will thus ignore the leap seconds issue altogether.\n",
135-
"\n",
136-
"If precise propagation across leap seconds is required, one should construct an {py:func}`~heyoka.model.sgp4_propagator()` not via a list of ``Satrec`` objects, but instead using the second overload which takes as input the GPE data as a NumPy 2D array. The GPE epochs in the array should be represented as Julian dates in a continuous scale of time such as [TAI](https://en.wikipedia.org/wiki/International_Atomic_Time). Similarly, the propagation epochs should be provided as Julian dates in the same scale of time. We recommend to use of a library such as [Astropy](https://docs.astropy.org/en/stable/time/index.html) to convert between UTC epochs and TAI Julian dates."
126+
"{py:func}`~heyoka.model.sgp4_propagator()` takes as only mandatory input argument the list of satellites, here represented as ``Satrec`` objects from the [sgp4 Python module](https://pypi.org/project/sgp4/). The list of satellites can alternatively be passed as a NumPy 2D array containing the GPE data for all satellites (see the documentation). {py:func}`~heyoka.model.sgp4_propagator()` returns a propagator object, by default of type {py:func}`~heyoka.model.sgp4_propagator_dbl()` (i.e., a double-precision propagator). You can also request a single-precision propagator via the {ref}`fp_type keyword argument <api_common_kwargs_fp_type>`."
137127
]
138128
},
139129
{
@@ -263,7 +253,7 @@
263253
"source": [
264254
"Julian dates are represented via the {py:attr}`~heyoka.model.sgp4_propagator_dbl.jdtype` type, which is a {ref}`structured NumPy datatype<numpy:defining-structured-types>` consisting of\n",
265255
"two floating-point fields, the first one called ``jd`` and representing a Julian date, the second one called ``frac`` representing a fractional correction to ``jd`` (so that the full\n",
266-
"Julian date is ``jd + frac``). Remember that, since we constructed the propagator from a list of ``Satrec`` objects, the Julian dates are to be provided in the UTC time scale.\n",
256+
"Julian date is ``jd + frac``). Julian dates must be provided in the UTC scale of time, following the [SOFA](http://www.iausofa.org/)/[ERFA](https://github.com/liberfa/erfa/) convention of handling leap seconds via slightly longer/shorter days. We highly recommend the use of a library such as [Astropy](https://docs.astropy.org/en/stable/time/index.html) to convert between calendar days and UTC Julian dates.\n",
267257
"\n",
268258
"Although in principle we could propagate each satellite to a different date, here we will be propagating *all* satellites to the same Julian date:"
269259
]
@@ -1206,7 +1196,7 @@
12061196
"name": "python",
12071197
"nbconvert_exporter": "python",
12081198
"pygments_lexer": "ipython3",
1209-
"version": "3.12.4"
1199+
"version": "3.13.1"
12101200
}
12111201
},
12121202
"nbformat": 4,

heyoka/__init__.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ def from_sympy(ex, s_dict={}):
153153

154154
if not isinstance(ex, Basic):
155155
raise TypeError(
156-
"The 'ex' parameter must be a sympy expression but it is of type {} instead"
157-
.format(type(ex))
156+
"The 'ex' parameter must be a sympy expression but it is of type {} instead".format(
157+
type(ex)
158+
)
158159
)
159160

160161
if not isinstance(s_dict, dict):
@@ -215,8 +216,9 @@ def set_serialization_backend(name):
215216

216217
if not name in _s11n_backend_map:
217218
raise ValueError(
218-
"The serialization backend '{}' is not valid. The valid backends are: {}"
219-
.format(name, list(_s11n_backend_map.keys()))
219+
"The serialization backend '{}' is not valid. The valid backends are: {}".format(
220+
name, list(_s11n_backend_map.keys())
221+
)
220222
)
221223

222224
new_backend = _s11n_backend_map[name]
@@ -289,8 +291,9 @@ def is_iterable(x):
289291
return _ensemble_propagate_process(tp, ta, arg, n_iter, gen, **kwargs)
290292

291293
raise ValueError(
292-
"The parallelisation algorithm must be one of {}, but '{}' was provided instead"
293-
.format(allowed_algos, algo)
294+
"The parallelisation algorithm must be one of {}, but '{}' was provided instead".format(
295+
allowed_algos, algo
296+
)
294297
)
295298

296299

heyoka/_test_batch_integrator.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ def __call__(self, ta):
214214
ta.propagate_for(fp_t(10.0), callback=broken_cb())
215215
self.assertTrue(
216216
"The call operator of a step callback is expected to return a boolean,"
217-
" but a value of type"
218-
in str(cm.exception)
217+
" but a value of type" in str(cm.exception)
219218
)
220219

221220
# Callback with pre_hook().
@@ -321,8 +320,7 @@ def __call__(self, ta):
321320
ta.propagate_until(fp_t(10.0), callback=broken_cb())
322321
self.assertTrue(
323322
"The call operator of a step callback is expected to return a boolean,"
324-
" but a value of type"
325-
in str(cm.exception)
323+
" but a value of type" in str(cm.exception)
326324
)
327325

328326
# Callback with pre_hook().
@@ -713,17 +711,15 @@ def test_propagate_grid(self):
713711
self.assertTrue(
714712
"Invalid grid passed to the propagate_grid() method of a batch"
715713
" integrator: the expected number of dimensions is 2, but the input"
716-
" array has a dimension of 1"
717-
in str(cm.exception)
714+
" array has a dimension of 1" in str(cm.exception)
718715
)
719716

720717
with self.assertRaises(ValueError) as cm:
721718
ta.propagate_grid(np.array([[1, 2], [3, 4]], dtype=fp_t))
722719
self.assertTrue(
723720
"Invalid grid passed to the propagate_grid() method of a batch"
724721
" integrator: the shape must be (n, 4) but the number of columns is 2"
725-
" instead"
726-
in str(cm.exception)
722+
" instead" in str(cm.exception)
727723
)
728724

729725
# Run a simple scalar/batch comparison.
@@ -747,7 +743,7 @@ def test_propagate_grid(self):
747743
self.assertTrue(bres[0] is None)
748744

749745
for idx, cur_ta in enumerate(tas):
750-
cur_ta.propagate_until(grid[0, idx]),
746+
(cur_ta.propagate_until(grid[0, idx]),)
751747

752748
sres = [
753749
tas[0].propagate_grid(grid[:, 0]),
@@ -842,8 +838,7 @@ def __call__(self, ta):
842838
ta.propagate_grid(grid, callback=broken_cb())
843839
self.assertTrue(
844840
"The call operator of a step callback is expected to return a boolean,"
845-
" but a value of type"
846-
in str(cm.exception)
841+
" but a value of type" in str(cm.exception)
847842
)
848843

849844
# Callback with pre_hook().

0 commit comments

Comments
 (0)