astrolabsoftware / fink-filters

Define your filters to create your alert stream in Fink!
https://fink-broker.readthedocs.io/en/latest/science/filters
Apache License 2.0
1 stars 7 forks source link

Ad/multiple_models #184

Closed Knispel2 closed 3 months ago

Knispel2 commented 5 months ago

Added the option to upload notifications to https://anomaly.fink-portal.org/.

It could be used like this, for example:

MODELS = ['', '_gamma', '_delta', '_epsilon', '_theta', '_omega'] # '' corresponds to the model for a telegram channel

df = df.withColumn('lc_features', extract_features_ad(*ad_args)))
for model in MODELS:
    df = df.withColumn(f'anomaly_score{model}', anomaly_score('lc_features', F.lit(model))))

for model in MODELS:
    df_proc = df.select(
        'objectId', 'candidate.ra',
        'candidate.dec', 'candidate.rb',
        f'anomaly_score{model}', "timestamp")
    if model == '':
        df_out = anomaly_notification_(df_proc, threshold=10,
           send_to_tg=True, channel_id=...,
           send_to_slack=True, channel_name=...)
    else:
        df_out = anomaly_notification_(df_proc, send_to_tg=False, send_to_slack=False, send_to_anomaly_base=True, model=model)

If model=='', notifications are only uploaded to the telegram and slack channels. Notifications from other models can be uploaded to both messengers and anomaly base.