GeminiDRSoftware / DRAGONS

Data Reduction for Astronomy from Gemini Observatory North and South
Other
27 stars 16 forks source link

Improve robustness of reduction by checking compatibility of all inputs #436

Open chris-simpson opened 1 year ago

chris-simpson commented 1 year ago

Many primitives require some commonality between the input AD objects but do not always check for them. For example, when stacking frames to make a flatfield they should all be taken with the same filter, and all inputs to a stackDarks() primitive should have the same exposure time.

Rather than repeat a few lines of boilerplate code in every primitive, a more elegant solution is to invoke one or more decorators for such primitives (and recipes?) that does this checking. The syntax might be

  1. @require_all_same("filter_name") to ensure len(set(ad.filter_name() for ad in adinputs)) == 1
  2. @require_all_tagged("BIAS") to ensure all("BIAS" in ad.tags for ad in adinputs)

where the argument can also be a list. It may be necessary to pass kwargs to the descriptors so the API needs designing and it also needs to be confirmed that this decorator appears in the correct location in the hierarchy of decorators we have so that the correct list of AD objects is examined when using streams, for example.