Skip to content

Commit

Permalink
rename functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MetinSa committed Aug 5, 2024
1 parent 2172946 commit 081106d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions zodipy/bodies.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
MEAN_DIST_TO_L2 = 0.009896235034000056


def get_interp_obstimes(t0: float, t1: float) -> time.Time:
def arrange_obstimes(t0: float, t1: float) -> time.Time:
"""Return a subset of the obstimes used to interpolate in body positions."""
dt = (1 * units.hour).to_value(units.day)
return time.Time(np.arange(t0, t1 + dt, dt), format="mjd")


def get_interpolated_bodypos(
def get_interp_bodypos(
body: str,
obstimes: npt.NDArray[np.float64],
interp_obstimes: time.Time,
Expand Down Expand Up @@ -62,7 +62,7 @@ def get_earthpos_inst(
).flatten()


def get_obspos_from_str(
def get_obspos_from_body(
body: str,
obstime: time.Time,
interp_obstimes: time.Time | None,
Expand Down Expand Up @@ -91,7 +91,7 @@ def get_obspos_from_str(
msg = "interp_obstimes must be provided when obstime is an array."
raise ValueError(msg)

return get_interpolated_bodypos(
return get_interp_bodypos(
body=body,
obstimes=obstime.mjd,
interp_obstimes=interp_obstimes,
Expand Down
2 changes: 1 addition & 1 deletion zodipy/line_of_sight.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_sphere_intersection(
return np.maximum(q, c / q)


def get_line_of_sight_range_dicts(
def get_line_of_sight_range(
components: Iterable[ComponentLabel],
unit_vectors: npt.NDArray[np.float64],
obs_pos: npt.NDArray[np.float64],
Expand Down
16 changes: 8 additions & 8 deletions zodipy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

from zodipy.blackbody import tabulate_blackbody_emission
from zodipy.bodies import (
arrange_obstimes,
get_earthpos_inst,
get_interp_obstimes,
get_interpolated_bodypos,
get_obspos_from_str,
get_interp_bodypos,
get_obspos_from_body,
)
from zodipy.component import ComponentLabel
from zodipy.line_of_sight import (
get_line_of_sight_range_dicts,
get_line_of_sight_range,
integrate_leggauss,
)
from zodipy.model_registry import model_registry
Expand Down Expand Up @@ -177,7 +177,7 @@ def evaluate(
if skycoord.obstime.size == 1:
interp_obstimes = None
else:
interp_obstimes = get_interp_obstimes(skycoord.obstime[0].mjd, skycoord.obstime[-1].mjd)
interp_obstimes = arrange_obstimes(skycoord.obstime[0].mjd, skycoord.obstime[-1].mjd)

dist_coords_to_cores = skycoord.size > nprocesses and nprocesses > 1
if dist_coords_to_cores:
Expand Down Expand Up @@ -212,15 +212,15 @@ def _evaluate(
if interp_obstimes is None:
earth_xyz = get_earthpos_inst(skycoord.obstime, self._ephemeris)
else:
earth_xyz = get_interpolated_bodypos(
earth_xyz = get_interp_bodypos(
body="earth",
obstimes=skycoord.obstime.mjd,
interp_obstimes=interp_obstimes,
ephemeris=self._ephemeris,
)

if isinstance(obspos, str):
obs_xyz = get_obspos_from_str(
obs_xyz = get_obspos_from_body(
body=obspos,
obstime=skycoord.obstime,
interp_obstimes=interp_obstimes,
Expand Down Expand Up @@ -250,7 +250,7 @@ def _evaluate(
if skycoord.isscalar:
skycoord_xyz = skycoord.cartesian.xyz.value[:, np.newaxis]

start, stop = get_line_of_sight_range_dicts(
start, stop = get_line_of_sight_range(
components=self._ipd_model.comps.keys(),
unit_vectors=skycoord_xyz,
obs_pos=obs_xyz,
Expand Down

0 comments on commit 081106d

Please sign in to comment.