Getting Started with Filter Development

The devkit is designed to be used in NOAO’s DataLab Jupyter environment. Sign up for DataLab, then log in to the Jupyter server.

Once logged in to DataLab, create a new notebook using the “Python 3 (ANTARES)” kernel and paste in the following code:

import antares.dev_kit as dk

You’re now ready to create and test ANTARES filter stages.

Let’s make a simple filter and run it on an alert from the test dataset:

def my_filter(locus_data):
    This filter does nothing except print the magpsf
    value of ZTF alerts.
    props = locus_data.get_properties()
    alert_id = props['alert_id']
    magpsf = props.get('ztf_magpsf')
    if magpsf is None:
        print(f'Alert {alert_id} has no magpsf value.')
    print(f'Alert {alert_id} magpsf: {magpsf}')

# Fetch 1 random alert ID from the test dataset
alert_id = dk.get_alert_ids(1)[0]

# Execute the `my_filter` on the alert
dk.run_stage(alert_id, my_filter)

Next Steps

Next, read:

For examples, also check out the Filters which are currently running in the ANTARES Pipeline.