Skip to content

Commit

Permalink
time_expr namechange
Browse files Browse the repository at this point in the history
  • Loading branch information
darioizzo committed Jun 5, 2024
1 parent 2aa1a31 commit 13b432a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
10 changes: 5 additions & 5 deletions doc/notebooks/elp2000.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"id": "de4449ca-5f30-4905-8701-469ace9cc9ff",
"metadata": {},
"source": [
"It is possible to change the expression used to represent the time variable in the ELP2000 solution via the ``time`` keyword argument. This allows to rescale and change the origin of time in the ELP2000 formulae.\n",
"It is possible to change the expression used to represent the time variable in the ELP2000 solution via the ``time_expr`` keyword argument. This allows to rescale and change the origin of time in the ELP2000 formulae.\n",
"\n",
"For instance, if we want time to be measured in Julian days (rather than centuries) since J2000, we can write:"
]
Expand All @@ -114,7 +114,7 @@
],
"source": [
"print(\"x coordinate, threshold = 1e-2, time in days since J2000:\\n{}\\n\"\n",
" .format(hy.model.elp2000_cartesian_fk5(time=hy.time/36525., thresh = 1e-2)[0]))"
" .format(hy.model.elp2000_cartesian_fk5(time_expr=hy.time/36525., thresh = 1e-2)[0]))"
]
},
{
Expand Down Expand Up @@ -143,7 +143,7 @@
],
"source": [
"print(\"x coordinate, threshold = 1e-2, time in JD:\\n{}\\n\"\n",
" .format(hy.model.elp2000_cartesian_fk5(time=(hy.time-2451545.0)/36525., thresh = 1e-2)[0]))"
" .format(hy.model.elp2000_cartesian_fk5(time_expr=(hy.time-2451545.0)/36525., thresh = 1e-2)[0]))"
]
},
{
Expand Down Expand Up @@ -172,7 +172,7 @@
],
"source": [
"print(\"x coordinate, threshold = 1e-2, time represented as variable 'y':\\n{}\\n\"\n",
" .format(hy.model.elp2000_cartesian_fk5(time=hy.expression(\"y\"), thresh = 1e-2)[0]))"
" .format(hy.model.elp2000_cartesian_fk5(time_expr=hy.expression(\"y\"), thresh = 1e-2)[0]))"
]
},
{
Expand Down Expand Up @@ -230,7 +230,7 @@
" # Build the ELP2000 formulae for the geocentric Cartesian\n",
" # position of the Moon in the FK5 frame. Replace the\n",
" # default time variable and set a custom threshold level.\n",
" moon_x, moon_y, moon_z = hy.model.elp2000_cartesian_fk5(time=(tm-2451545.0)/36525.,\n",
" moon_x, moon_y, moon_z = hy.model.elp2000_cartesian_fk5(time_expr=(tm-2451545.0)/36525.,\n",
" thresh=thr)\n",
"\n",
" # Compile the function for the evaluation of moon_x/y/z.\n",
Expand Down
20 changes: 10 additions & 10 deletions doc/notebooks/thermoNETs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"source": [
"# Symbolic expression\n",
"nrlmsise00 = hy.model.nrlmsise00_tn(\n",
" geodetic=[h, lat, lon], f107=f107, f107a=f107a, ap=ap, time=hy.time\n",
" geodetic=[h, lat, lon], f107=f107, f107a=f107a, ap=ap, time_expr=hy.time\n",
")\n",
"\n",
"# Compiled function\n",
Expand Down Expand Up @@ -119,7 +119,7 @@
" y107=y107,\n",
" y107a=y107a,\n",
" dDstdT=dDstdT,\n",
" time=hy.time,\n",
" time_expr=hy.time,\n",
")\n",
"\n",
"# Compiled function\n",
Expand Down Expand Up @@ -413,7 +413,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"id": "b1e578d3",
"metadata": {},
"outputs": [],
Expand All @@ -425,7 +425,7 @@
"# We compute the geodetic coordinates\n",
"h,lat,lon=hy.model.cart2geo([xyz_ecef[0],xyz_ecef[1],xyz_ecef[2]])\n",
"# And the dynamics\n",
"density_nn = hy.model.nrlmsise00_tn(geodetic = [h / 1000,lat,lon], f107=f107, f107a=f107a, ap=ap, time=doy)\n",
"density_nn = hy.model.nrlmsise00_tn(geodetic = [h / 1000,lat,lon], f107=f107, f107a=f107a, ap=ap, time_expr=doy)\n",
"akepler_x=-mu*x*(x**2+y**2+z**2)**(-3/2)\n",
"akepler_y=-mu*y*(x**2+y**2+z**2)**(-3/2)\n",
"akepler_z=-mu*z*(x**2+y**2+z**2)**(-3/2)\n",
Expand All @@ -449,15 +449,15 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"id": "6b1c6288",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.43875622749328613 to build the integrator\n"
"0.46484804153442383 to build the integrator\n"
]
}
],
Expand All @@ -481,15 +481,15 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"id": "22dc24ce",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.7502858638763428 to propagate for 60 days\n"
"0.7670831680297852 to propagate for 60 days\n"
]
}
],
Expand All @@ -511,7 +511,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"id": "638817fa",
"metadata": {},
"outputs": [
Expand All @@ -521,7 +521,7 @@
"Text(0.5, 0, 'Days')"
]
},
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
},
Expand Down
8 changes: 4 additions & 4 deletions doc/notebooks/vsop2013.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "2997cfe8-ac86-4b32-bf23-de73208fcec8",
"metadata": {},
"outputs": [
Expand All @@ -156,7 +156,7 @@
],
"source": [
"print(\"Mars' semi-major axis solution, threshold = 6e-5, time in JD:\\n{}\\n\"\n",
" .format(hy.model.vsop2013_elliptic(4, 1, time=(hy.time-2451545.0)/365250., thresh = 6e-5)))"
" .format(hy.model.vsop2013_elliptic(4, 1, time_expr=(hy.time-2451545.0)/365250., thresh = 6e-5)))"
]
},
{
Expand Down Expand Up @@ -185,7 +185,7 @@
],
"source": [
"print(\"Mars' semi-major axis solution, threshold = 6e-5, time represented as the 'x' variable:\\n{}\\n\"\n",
" .format(hy.model.vsop2013_elliptic(4, 1, time=hy.expression('x'), thresh = 6e-5)))"
" .format(hy.model.vsop2013_elliptic(4, 1, time_expr=hy.expression('x'), thresh = 6e-5)))"
]
},
{
Expand Down Expand Up @@ -248,7 +248,7 @@
" venus_x, venus_y, venus_z = hy.model.vsop2013_cartesian_icrf(2,\n",
" # NOTE: measure time\n",
" # using the Julian date.\n",
" time=(tm-2451545.0)/365250.,\n",
" time_expr=(tm-2451545.0)/365250.,\n",
" thresh=thr)[:3]\n",
"\n",
" # Compile the function for the evaluation of venus_x/y/z.\n",
Expand Down
4 changes: 2 additions & 2 deletions heyoka/_test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def test_nrlmsise00(self):
"h", "lat", "lon", "f107", "f107a", "ap"
)
nrlmsise00 = model.nrlmsise00_tn(
geodetic=[h, lat, lon], f107=f107, f107a=f107a, ap=ap, time=time / 86400
geodetic=[h, lat, lon], f107=f107, f107a=f107a, ap=ap, time_expr=time / 86400
)
nrlmsise00_cf = cfunc([nrlmsise00], vars=[h, lat, lon, f107, f107a, ap])

Expand Down Expand Up @@ -380,7 +380,7 @@ def test_jb08(self):
y107=y107,
y107a=y107a,
dDstdT=dDstdT,
time=time / 86400,
time_expr=time / 86400,
)
jb08_cf = cfunc(
[jb08],
Expand Down
30 changes: 15 additions & 15 deletions heyoka/expose_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,44 +339,44 @@ void expose_models(py::module_ &m)
m.def(
"_model_vsop2013_elliptic",
[](std::uint32_t pl_idx, std::uint32_t var_idx, hy::expression t_expr, double thresh) {
return hy::model::vsop2013_elliptic(pl_idx, var_idx, hy::kw::time = std::move(t_expr),
return hy::model::vsop2013_elliptic(pl_idx, var_idx, hy::kw::time_expr = std::move(t_expr),
hy::kw::thresh = thresh);
},
"pl_idx"_a, "var_idx"_a = 0, "time"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
m.def(
"_model_vsop2013_cartesian",
[](std::uint32_t pl_idx, hy::expression t_expr, double thresh) {
return hy::model::vsop2013_cartesian(pl_idx, hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
return hy::model::vsop2013_cartesian(pl_idx, hy::kw::time_expr = std::move(t_expr), hy::kw::thresh = thresh);
},
"pl_idx"_a, "time"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
"pl_idx"_a, "time_expr"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
m.def(
"_model_vsop2013_cartesian_icrf",
[](std::uint32_t pl_idx, hy::expression t_expr, double thresh) {
return hy::model::vsop2013_cartesian_icrf(pl_idx, hy::kw::time = std::move(t_expr),
return hy::model::vsop2013_cartesian_icrf(pl_idx, hy::kw::time_expr = std::move(t_expr),
hy::kw::thresh = thresh);
},
"pl_idx"_a, "time"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
"pl_idx"_a, "time_expr"_a = hy::time, "thresh"_a.noconvert() = 1e-9);
m.def("_model_get_vsop2013_mus", &hy::model::get_vsop2013_mus);

// ELP2000.
m.def(
"_model_elp2000_spherical",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_spherical(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
return hy::model::elp2000_spherical(hy::kw::time_expr = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
"time_expr"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def(
"_model_elp2000_cartesian_e2000",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_cartesian_e2000(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
return hy::model::elp2000_cartesian_e2000(hy::kw::time_expr = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
"time_expr"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def(
"_model_elp2000_cartesian_fk5",
[](hy::expression t_expr, double thresh) {
return hy::model::elp2000_cartesian_fk5(hy::kw::time = std::move(t_expr), hy::kw::thresh = thresh);
return hy::model::elp2000_cartesian_fk5(hy::kw::time_expr = std::move(t_expr), hy::kw::thresh = thresh);
},
"time"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
"time_expr"_a = hy::time, "thresh"_a.noconvert() = 1e-6);
m.def("_model_get_elp2000_mus", &hy::model::get_elp2000_mus);

// CR3BP.
Expand Down Expand Up @@ -430,9 +430,9 @@ void expose_models(py::module_ &m)
[](const std::vector<hy::expression> &geodetic, const hy::expression &f107, const hy::expression &f107a,
const hy::expression &ap, const hy::expression &time) -> hy::expression {
return hy::model::nrlmsise00_tn(hy::kw::geodetic = geodetic, hy::kw::f107 = f107, hy::kw::f107a = f107a,
hy::kw::ap = ap, hy::kw::time = time);
hy::kw::ap = ap, hy::kw::time_expr = time);
},
"geodetic"_a, "f107"_a, "f107a"_a, "ap"_a, "time"_a, docstrings::nrlmsise00_tn().c_str());
"geodetic"_a, "f107"_a, "f107a"_a, "ap"_a, "time_expr"_a, docstrings::nrlmsise00_tn().c_str());

// Thermospheric model JB08
m.def(
Expand All @@ -444,10 +444,10 @@ void expose_models(py::module_ &m)
return hy::model::jb08_tn(hy::kw::geodetic = geodetic, hy::kw::f107 = f107, hy::kw::f107a = f107a,
hy::kw::s107 = s107, hy::kw::s107a = s107a, hy::kw::m107 = m107,
hy::kw::m107a = m107a, hy::kw::y107 = y107, hy::kw::y107a = y107a,
hy::kw::dDstdT = dDstdT, hy::kw::time = time);
hy::kw::dDstdT = dDstdT, hy::kw::time_expr = time);
},
"geodetic"_a, "f107"_a, "f107a"_a, "s107"_a, "s107a"_a, "m107"_a, "m107a"_a, "y107"_a, "y107a"_a, "dDstdT"_a,
"time"_a, docstrings::jb08_tn().c_str());
"time_expr"_a, docstrings::jb08_tn().c_str());
}

} // namespace heyoka_py

0 comments on commit 13b432a

Please sign in to comment.