1515#include " xtensor/misc/xsort.hpp"
1616
1717Ejecta PyTophatJet (Real theta_c, Real E_iso, Real Gamma0, bool spreading, Real duration,
18- std::optional<PyMagnetar> magnetar) {
18+ const std::optional<PyMagnetar>& magnetar) {
1919 Ejecta jet;
2020 jet.eps_k = math::tophat (theta_c, E_iso);
2121 jet.Gamma0 = math::tophat_plus_one (theta_c, Gamma0 - 1 );
@@ -30,7 +30,7 @@ Ejecta PyTophatJet(Real theta_c, Real E_iso, Real Gamma0, bool spreading, Real d
3030}
3131
3232Ejecta PyGaussianJet (Real theta_c, Real E_iso, Real Gamma0, bool spreading, Real duration,
33- std::optional<PyMagnetar> magnetar) {
33+ const std::optional<PyMagnetar>& magnetar) {
3434 Ejecta jet;
3535 jet.eps_k = math::gaussian (theta_c, E_iso);
3636 jet.Gamma0 = math::gaussian_plus_one (theta_c, Gamma0 - 1 );
@@ -45,7 +45,7 @@ Ejecta PyGaussianJet(Real theta_c, Real E_iso, Real Gamma0, bool spreading, Real
4545}
4646
4747Ejecta PyPowerLawJet (Real theta_c, Real E_iso, Real Gamma0, Real k_e, Real k_g, bool spreading, Real duration,
48- std::optional<PyMagnetar> magnetar) {
48+ const std::optional<PyMagnetar>& magnetar) {
4949 Ejecta jet;
5050 jet.eps_k = math::powerlaw (theta_c, E_iso, k_e);
5151 jet.Gamma0 = math::powerlaw_plus_one (theta_c, Gamma0 - 1 , k_g);
@@ -70,7 +70,7 @@ Ejecta PyPowerLawWing(Real theta_c, Real E_iso_w, Real Gamma0_w, Real k_e, Real
7070}
7171
7272Ejecta PyStepPowerLawJet (Real theta_c, Real E_iso, Real Gamma0, Real E_iso_w, Real Gamma0_w, Real k_e, Real k_g,
73- bool spreading, Real duration, std::optional<PyMagnetar> magnetar) {
73+ bool spreading, Real duration, const std::optional<PyMagnetar>& magnetar) {
7474 Ejecta jet;
7575 jet.eps_k = math::step_powerlaw (theta_c, E_iso, E_iso_w, k_e);
7676 jet.Gamma0 = math::step_powerlaw_plus_one (theta_c, Gamma0 - 1 , Gamma0_w - 1 , k_g);
@@ -86,7 +86,7 @@ Ejecta PyStepPowerLawJet(Real theta_c, Real E_iso, Real Gamma0, Real E_iso_w, Re
8686}
8787
8888Ejecta PyTwoComponentJet (Real theta_c, Real E_iso, Real Gamma0, Real theta_w, Real E_iso_w, Real Gamma0_w,
89- bool spreading, Real duration, std::optional<PyMagnetar> magnetar) {
89+ bool spreading, Real duration, const std::optional<PyMagnetar>& magnetar) {
9090 Ejecta jet;
9191 jet.eps_k = math::two_component (theta_c, theta_w, E_iso, E_iso_w);
9292
@@ -319,7 +319,7 @@ auto PyModel::generate_exposure_sampling(PyArray const& t, PyArray const& nu, Py
319319 // Generate time-frequency samples within each exposure window
320320 for (size_t i = 0 , j = 0 ; i < t.size () && j < total_points; ++i) {
321321 const Real t_start = t (i);
322- const Real dt = expo_time (i) / (num_points - 1 );
322+ const Real dt = expo_time (i) / static_cast <Real> (num_points - 1 );
323323
324324 for (size_t k = 0 ; k < num_points && j < total_points; ++k, ++j) {
325325 t_obs (j) = t_start + k * dt;
@@ -375,15 +375,15 @@ auto PyModel::flux_density_exposures(PyArray const& t, PyArray const& nu, PyArra
375375 " time, frequency, and exposure time arrays must have the same size" );
376376 AFTERGLOW_REQUIRE (num_points >= 2 , " num_points must be at least 2 to sample within each exposure time" );
377377
378- const auto sampling = generate_exposure_sampling (t, nu, expo_time, num_points);
378+ const auto [t_obs_sorted, nu_obs_sorted, idx_sorted] = generate_exposure_sampling (t, nu, expo_time, num_points);
379379
380380 auto flux_func = [](Observer& obs, Array const & time, Array const & freq, auto & photons) -> XTArray {
381381 return obs.specific_flux_series (time, freq, photons) / unit::flux_den_cgs;
382382 };
383383
384- auto result = compute_emission (sampling. t_obs_sorted , sampling. nu_obs_sorted , flux_func);
384+ auto result = compute_emission (t_obs_sorted, nu_obs_sorted, flux_func);
385385
386- average_exposure_flux (result, sampling. idx_sorted , t.size (), num_points);
386+ average_exposure_flux (result, idx_sorted, t.size (), num_points);
387387
388388 result.calc_total ();
389389 return result;
0 commit comments