NextAstro logo NextAstroDocumentation Open Hub

Python examples

Observe through multiple filters

The complete source is included below.

python -m nextastro_obs_client.examples.colour_sequence --ra 12.5 --dec -30 --target "Student field" --filters B V R --seconds 5 --count 2

Acquires the same requested exposure through each named filter. Filters must exist on the selected camera. This does not normalize stellar colours or build a colour composite; different throughput and detector response remain observable.

Student extension: Add per-filter exposure times, then use differential photometry to compare count rates.

Python source

"""Acquire a selected filter sequence at one target."""
from nextastro_obs_client.examples._common import parser, point, execute


def run(obs, camera, args):
    point(obs, args)
    for filt in args.filters:
        for image in camera.expose(seconds=args.seconds, filter=filt, count=args.count, target_name=args.target):
            print(filt, image.path)


def main(argv=None):
    p = parser("Colour sequence")
    p.add_argument("--ra", type=float, required=True)
    p.add_argument("--dec", type=float, required=True)
    p.add_argument("--target", required=True)
    p.add_argument("--filters", nargs="+", required=True)
    p.add_argument("--seconds", type=float, required=True)
    p.add_argument("--count", type=int, default=1)
    return execute(p, run, argv)


if __name__ == "__main__":
    main()

Shared argument and session helpers: Example support code.