Python examples
Explore signal and saturation
The complete source is included below.
python -m nextastro_obs_client.examples.exposure_ladder --ra 12.5 --dec -30 --target "Student field" --filter V --seconds 1 2 5 10 --saturation 50000
Writes exposure_ladder.csv with requested/actual seconds, mean, median, population standard deviation and optional saturated-pixel counts. Statistics explicitly read raw images in student Python. The supplied saturation value is a student-chosen diagnostic, not a quality cutoff. Sky variation, stars and offsets can affect the response.
Student extension: Measure a fixed region, subtract a bias level and fit count rate against actual exposure.
Python source
"""Measure the signal response across explicitly chosen exposures."""
from nextastro_obs_client.examples._common import parser, target_arguments, point, execute, write_rows
def run(obs, camera, args):
point(obs, args)
rows = []
for seconds in args.seconds:
for image in camera.expose(seconds=seconds, filter=args.filter, target_name=args.target):
stats = image.statistics(saturation=args.saturation)
rows.append(dict(requested_seconds=seconds, actual_seconds=image.seconds, mean=stats.mean,
median=stats.median, stddev=stats.stddev, saturated_pixels=stats.saturated_pixels, path=str(image.path)))
write_rows(args.output, rows)
return rows
def main(argv=None):
p = parser("Exposure ladder")
target_arguments(p)
p.add_argument("--seconds", type=float, nargs="+", required=True)
p.add_argument("--saturation", type=float, default=None, help="Optional diagnostic threshold in raw ADU")
p.add_argument("--output", default="exposure_ladder.csv")
return execute(p, run, argv)
if __name__ == "__main__":
main()
Shared argument and session helpers: Example support code.