Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
FusRoman committed Dec 8, 2023
1 parent eacc8a7 commit cb8f242
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
9 changes: 8 additions & 1 deletion fink_fat/command_line/cli_main/fitroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,14 @@ def fitroid_associations(
if "updated" not in trajectory_df:
trajectory_df["updated"] = "N"
trajectory_df, fit_roid_df, trajectory_orb, orbits = trcand_to_orbit(
config, trajectory_df, trajectory_orb, fit_roid_df, orbits, last_night, logger, True
config,
trajectory_df,
trajectory_orb,
fit_roid_df,
orbits,
last_night,
logger,
True,
)

nb_tr_before_tw = len(fit_roid_df)
Expand Down
18 changes: 10 additions & 8 deletions fink_fat/roid_fitting/roid_fit_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,21 @@ def fitroid_prediction(fit_pdf: pd.DataFrame, jd: list) -> pd.DataFrame:
1 2 246.074463 -22.402872
1 2 245.343992 -22.438328
"""
pred_list = np.hstack([
predictions(*args, jd)
for args in zip(
fit_pdf["trajectory_id"], fit_pdf["xp"], fit_pdf["yp"], fit_pdf["zp"]
)
])
eq_coord = uf.xyz_to_equ(pred_list[1, :], pred_list[2,:], pred_list[3, :])
pred_list = np.hstack(
[
predictions(*args, jd)
for args in zip(
fit_pdf["trajectory_id"], fit_pdf["xp"], fit_pdf["yp"], fit_pdf["zp"]
)
]
)
eq_coord = uf.xyz_to_equ(pred_list[1, :], pred_list[2, :], pred_list[3, :])

pdf_prediction = pd.DataFrame(
{
"trajectory_id": pred_list[0, :],
"ra": eq_coord.ra.deg,
"dec": eq_coord.dec.deg
"dec": eq_coord.dec.deg,
}
)

Expand Down
8 changes: 6 additions & 2 deletions fink_fat/streaming_associations/fink_fat_associations.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ def fink_fat_association(
orbit_error,
)
time_calc = time.time() - t_before
print(f"nb alert: {nb_alert}\nstream orbit associations: {time_calc:.5f}s\n{nb_alert/time_calc} alert/sec")
print(
f"nb alert: {nb_alert}\nstream orbit associations: {time_calc:.5f}s\n{nb_alert/time_calc} alert/sec"
)

t_before = time.time()
# associates the alerts with the kalman filters
Expand All @@ -333,7 +335,9 @@ def fink_fat_association(
)
print(f"stream polyfit associations: {time.time() - t_before:.5f}")
time_calc = time.time() - t_before
print(f"nb alert: {nb_alert}\nstream orbit associations: {time_calc:.5f}s\n{nb_alert/time_calc} alert/sec")
print(
f"nb alert: {nb_alert}\nstream orbit associations: {time_calc:.5f}s\n{nb_alert/time_calc} alert/sec"
)

return flags, estimator_id, ffdistnr

Expand Down
3 changes: 2 additions & 1 deletion fink_fat/streaming_associations/fitroid_assoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ def fitroid_window(pred_pdf: pd.DataFrame, coord_alerts: SkyCoord) -> pd.DataFra
def ang2pix(NSIDE: int, ra: pd.Series, dec: pd.Series):
return hp.ang2pix(NSIDE, dec2theta(dec), ra2phi(ra))


def fit_filter(fit_pdf, alert_ra, alert_dec):
NSIDE=4
NSIDE = 4
fit_pdf_pix = ang2pix(NSIDE, fit_pdf["ra_1"].values, fit_pdf["dec_1"].values)
alert_pix = ang2pix(NSIDE, alert_ra, alert_dec)
return fit_pdf[np.isin(fit_pdf_pix, alert_pix)]
Expand Down
8 changes: 5 additions & 3 deletions fink_fat/streaming_associations/orbit_assoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pyspark import SparkFiles

from astropy.time import Time
from astropy.coordinates import SkyCoord, search_around_sky
from astropy.coordinates import SkyCoord
import astropy.units as u

import sbpy.data as sso_py
Expand Down Expand Up @@ -187,8 +187,10 @@ def orbit_window(
& (orbit_pdf["ref_epoch"] >= (min_night_jd - orbit_tw))
]

NSIDE=4
orbit_pix = ang2pix(NSIDE, last_orbits["last_ra"].values, last_orbits["last_dec"].values)
NSIDE = 4
orbit_pix = ang2pix(
NSIDE, last_orbits["last_ra"].values, last_orbits["last_dec"].values
)
alert_pix = ang2pix(NSIDE, coord_alerts.ra, coord_alerts.dec)
return last_orbits[np.isin(orbit_pix, alert_pix)]

Expand Down

0 comments on commit cb8f242

Please sign in to comment.