Skip to content

Commit

Permalink
minor changes to analysis rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
ntellis committed Jan 15, 2025
1 parent 8f0a531 commit ed5ac6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/adam_impact_study/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def compute_warning_time(
)

# Drop duplicates and keep the first instance
filtered_results = filtered_results.drop_duplicates(subset=["orbit_id"], keep="first")
filtered_results = filtered_results.drop_duplicates(
subset=["orbit_id"], keep="first"
)

# import pdb; pdsb.set_trace()
# Convert last observation time to an MJD
Expand Down Expand Up @@ -444,12 +446,12 @@ def plot_ip_over_time(
plt.close()


def collect_orbit_window_results(
run_dir: str, orbit_id: str
) -> WindowResult:
def collect_orbit_window_results(run_dir: str, orbit_id: str) -> WindowResult:
paths = get_study_paths(run_dir, orbit_id)
orbit_dir = paths["orbit_base_dir"]
window_result_files = glob.glob(f"{orbit_dir}/windows/*/impact_results_{orbit_id}.parquet")
window_result_files = sorted(
glob.glob(f"{orbit_dir}/windows/*/window_result.parquet")
)
window_results = WindowResult.empty()
for f in window_result_files:
window_results = qv.concatenate([window_results, WindowResult.from_parquet(f)])
Expand All @@ -474,7 +476,6 @@ def summarize_impact_study_object_results(
impactor_orbits, impact_results, discovery_dates
)

import pdb; pdb.set_trace()
mean_impact_time = Timestamp.from_mjd(
[pc.mean(impact_results.mean_impact_time.mjd())],
impact_results.mean_impact_time.scale,
Expand All @@ -489,15 +490,13 @@ def summarize_impact_study_object_results(
observation_cadence = compute_observation_cadence(observations)

return ImpactorResultSummary.from_kwargs(
orbit_id=[orbit_id],
object_id=impact_results[0].object_id,
orbit=impactor_orbits,
mean_impact_time=mean_impact_time,
windows=[len(impact_results)],
nights=[pc.max(impact_results.observation_nights)],
observations=[pc.max(impact_results.observation_count)],
singletons=[pc.sum(observation_cadence.singletons)],
tracklets=[pc.sum(observation_cadence.tracklets)],
observed=[len(observations) > 0],
discovery_time=discovery_dates.discovery_date,
warning_time=warning_times.warning_time,
realization_time=realization_times.realization_time,
Expand Down
3 changes: 1 addition & 2 deletions src/adam_impact_study/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ class WindowResult(qv.Table):


class ImpactorResultSummary(qv.Table):
orbit_id = qv.LargeStringColumn()
object_id = qv.LargeStringColumn(nullable=True)
orbit = ImpactorOrbits.as_column()
# This is a mean of means of the impact time from each window
mean_impact_time = Timestamp.as_column()
# Number of distinct orbit fitting windows
Expand Down

0 comments on commit ed5ac6d

Please sign in to comment.