@@ -386,9 +386,12 @@ def find_healpixel_matches(
386386 propagation_targets = propagation_targets .sort_by (["time.days" , "time.nanos" ])
387387 ephems = ephems .sort_by (["coordinates.time.days" , "coordinates.time.nanos" ])
388388
389+ propagation_target_times = propagation_targets .time .rescale ("utc" )
390+ ephem_times = ephems .coordinates .time .rescale ("utc" )
391+
389392 # quickly check to make sure times are equal
390393 assert pc .all (
391- propagation_targets . time . equals (ephems . coordinates . time , precision = "ms" )
394+ propagation_target_times . equals (ephem_times , precision = "ms" )
392395 ).as_py (), "Propagation targets and ephemeris must have matching times"
393396
394397 # Calculate the healpixels for the ephemeris
@@ -521,21 +524,15 @@ def check_window(
521524 times = propagation_targets .time
522525
523526 # First make sure our orbit it n-body propagated to the window center
524- orbit = orbit .set_column ( " coordinates.time" , orbit . coordinates . time . rescale ("utc" ) )
525- if not (pc .all (orbit . coordinates . time .equals (window .time , precision = "ms" )).as_py ()):
527+ time_utc = orbit .coordinates .time . rescale ("utc" )
528+ if not (pc .all (time_utc .equals (window .time , precision = "ms" )).as_py ()):
526529 propagator = propagator_class ()
527530 orbit = propagator .propagate_orbits (orbit , window .time )
528531
529532 # create our observers from the individual frame times
530533 observers = Observers .from_code (obscode , times )
531534 ## first propagate with 2_body
532535 propagated_orbits = propagate_2body (orbit , times )
533- # hotfix: rescale the times back from propagated_orbits
534- # this behavior should be fixed in adam_core, to always return
535- # the timescale of the submitted times
536- propagated_orbits = propagated_orbits .set_column (
537- "coordinates.time" , propagated_orbits .coordinates .time .rescale ("utc" )
538- )
539536
540537 # generate ephemeris
541538 ephems = generate_ephemeris_2body (propagated_orbits , observers )
@@ -753,8 +750,6 @@ def _check_windows(
753750 f"_check_windows orbit: { orbit .orbit_id [0 ].as_py ()} windows: { len (windows )} obscode: { windows .obscode .unique ().to_pylist ()} "
754751 )
755752
756- # Using the propagated orbits, check each window. Propagate the orbit from the center of
757- # window using 2-body to find any HealpixFrames where a detection could have occured
758753 precovery_candidates = PrecoveryCandidates .empty ()
759754 frame_candidates = FrameCandidates .empty ()
760755
@@ -766,6 +761,11 @@ def _check_windows(
766761 check_window_remote .remote (
767762 self .directory ,
768763 window ,
764+ # Note: There is no speed benefit to pre-propagating
765+ # the orbit to the window center here, since we do
766+ # the n-body propagation inside the worker and the
767+ # delay to start the job offsets any advantage
768+ # from prepropagation.
769769 orbit ,
770770 tolerance ,
771771 propagator_class ,
@@ -797,13 +797,12 @@ def _check_windows(
797797 [frame_candidates , frame_candidates_window ]
798798 )
799799 else :
800- # When we are running as a single process,
801- # it makes sense to do the n-body propagation once
802- # and step along the windows
803- # In multiprocessing it makes more sense to
804- # duplicate the n-body propagation inside the check_window
805800 propagator = propagator_class ()
806801 for window in windows :
802+ # For single process, we propagate the orbit
803+ # to the window center in a loop to avoid
804+ # duplicating the n-body propagation inside
805+ # check_window
807806 orbit = propagator .propagate_orbits (orbit , window .time )
808807 candidates_window , frame_candidates_window = check_window (
809808 self .directory ,
0 commit comments