Skip to content

Commit

Permalink
small fix on the 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FusRoman committed Nov 20, 2023
1 parent 9f47ad9 commit 572b591
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
4 changes: 0 additions & 4 deletions fink_fat/associations/association_kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ def single_alerts_associations(
nb_repeat = np.repeat(traj_size.values, traj_counts_duplicates.values)
tr_id_repeat = np.repeat(cluster_df["trajectory_id"].values, nb_repeat)

traj_duplicate["trajectory_id"] = tr_id_repeat
nb_repeat = np.repeat(traj_size.values, traj_counts_duplicates.values)
tr_id_repeat = np.repeat(cluster_df["trajectory_id"].values, nb_repeat)

traj_duplicate["trajectory_id"] = tr_id_repeat
new_traj = pd.concat([traj_duplicate, cluster_df.drop("estimator_id", axis=1)])
return new_traj, new_kalman
Expand Down
5 changes: 5 additions & 0 deletions fink_fat/command_line/orbit_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ def trcand_to_orbit(
logger.info(
f"number of trajectories send to the orbit fitting: {nb_traj_to_orb}"
)

if nb_traj_to_orb == 0:
# no trajectory updated during this night to send to orbit fitting
return trajectory_df, trparams_df, trajectory_orb, orbits

new_orbits = switch_local_cluster(config, traj_to_orb)
new_orbits = new_orbits[new_orbits["a"] != -1.0]
if verbose:
Expand Down
26 changes: 13 additions & 13 deletions fink_fat/seeding/dbscan_seeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,19 @@ def intra_night_seeding(
night_observation["trajectory_id"] = clustering.labels_

# remove bad seeds containing observations in the same exposure time
test_jd_0 = (
night_observation.sort_values("jd")
.groupby("trajectory_id")
.agg(is_same_exp=("jd", lambda x: np.any(np.diff(x) == 0.0)))
.reset_index()
)
test_jd_0 = test_jd_0[test_jd_0["trajectory_id"] != -1.0]
jd_0_traj_id = test_jd_0[test_jd_0["is_same_exp"]]["trajectory_id"]

with pd.option_context("mode.chained_assignment", None):
night_observation.loc[
night_observation["trajectory_id"].isin(jd_0_traj_id), "trajectory_id"
] = -1.0
# test_jd_0 = (
# night_observation.sort_values("jd")
# .groupby("trajectory_id")
# .agg(is_same_exp=("jd", lambda x: np.any(np.diff(x) == 0.0)))
# .reset_index()
# )
# test_jd_0 = test_jd_0[test_jd_0["trajectory_id"] != -1.0]
# jd_0_traj_id = test_jd_0[test_jd_0["is_same_exp"]]["trajectory_id"]

# with pd.option_context("mode.chained_assignment", None):
# night_observation.loc[
# night_observation["trajectory_id"].isin(jd_0_traj_id), "trajectory_id"
# ] = -1.0

return night_observation

Expand Down

0 comments on commit 572b591

Please sign in to comment.