Skip to content

Commit

Permalink
inverse tags and make tests works
Browse files Browse the repository at this point in the history
  • Loading branch information
FusRoman committed Nov 27, 2023
1 parent 804dc98 commit 4ff7a4f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions bin/utils_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,11 @@ def assig_tags(orb_df, traj_orb_df, start_tags):
... })
>>> new_orb, new_traj = assig_tags(orb, traj, 0)
>>> orb_test = pd.read_parquet("fink_fat/test/utils_cli_test_orb.parquet")
>>> traj_test = pd.read_parquet("fink_fat/test/utils_cli_test_traj.parquet")
>>> orb_test = pd.read_parquet("fink_fat/test/utils_cli_test_orb.parquet").reset_index(drop=True)
>>> traj_test = pd.read_parquet("fink_fat/test/utils_cli_test_traj.parquet").reset_index(drop=True)
>>> assert_frame_equal(orb_test, new_orb)
>>> assert_frame_equal(traj_test, new_traj)
>>> assert_frame_equal(orb_test, new_orb.reset_index(drop=True))
>>> assert_frame_equal(traj_test, new_traj.reset_index(drop=True))
"""
orb_df = orb_df.sort_values("ref_epoch")

Expand Down
10 changes: 5 additions & 5 deletions fink_fat/others/id_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def int_to_tags(traj_id, jd):
Examples
--------
>>> int_to_tags(15, 2460135.98)
'FF10072023aaaaaap'
'FF20230710aaaaaap'
>>> int_to_tags(27, 2460135.98)
'FF10072023aaaaabb'
'FF20230710aaaaabb'
>>> int_to_tags(652, 2460135.98)
'FF10072023aaaaazc'
'FF20230710aaaaazc'
"""
res_tag = ""
for _ in range(7):
Expand All @@ -43,7 +43,7 @@ def int_to_tags(traj_id, jd):
traj_id = q

discovery = Time(jd, format="jd").datetime
return "FF{:02d}{:02d}{}{}".format(
return "FF{:04d}{:02d}{:02d}{}".format(
discovery.year, discovery.month, discovery.day, res_tag[::-1]
)

Expand All @@ -70,7 +70,7 @@ def generate_tags(begin, end, jd):
Examples
--------
>>> generate_tags(3, 6, [2460135.42, 2460137.57, 2460148.72])
['FF09072023aaaaaad', 'FF12072023aaaaaae', 'FF23072023aaaaaaf']
['FF20230709aaaaaad', 'FF20230712aaaaaae', 'FF20230723aaaaaaf']
"""
return [int_to_tags(i, date) for date, i in zip(jd, np.arange(begin, end))]

Expand Down
Binary file modified fink_fat/test/cli_test/fink_fat_out_test/mpc/orbital.parquet
Binary file not shown.
Binary file not shown.
Binary file modified fink_fat/test/utils_cli_test_orb.parquet
Binary file not shown.
Binary file modified fink_fat/test/utils_cli_test_traj.parquet
Binary file not shown.

0 comments on commit 4ff7a4f

Please sign in to comment.