Skip to content

Commit

Permalink
Merge branch 'release/3.0.x' of github.com:GeminiDRSoftware/DRAGONS i…
Browse files Browse the repository at this point in the history
…nto release/3.0.x
  • Loading branch information
Oliver committed May 18, 2022
2 parents fdd595b + fd2b6de commit bb24961
Show file tree
Hide file tree
Showing 5 changed files with 388 additions and 144 deletions.
3 changes: 3 additions & 0 deletions geminidr/core/parameters_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class associateSkyConfig(config.Config):
max_skies = config.RangeField("Maximum number of sky frames to associate",
int, None, min=1, optional=True)
use_all = config.Field("Use all frames as skies?", bool, False)
sky = config.ListField("Sky-only frames stored on disk", (AstroData, str),
None, optional=True, single=True)


class correctBackgroundToReferenceConfig(config.Config):
suffix = config.Field("Filename suffix", str, "_backgroundCorrected", optional=True)
Expand Down
50 changes: 26 additions & 24 deletions geminidr/core/primitives_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ def associateSky(self, adinputs=None, **params):
minimum separation (in arcseconds) required to use an image as sky
max_skies: int/None
maximum number of skies to associate to each input frame
min_skies: int/None
minimum number of skies to associate to each input frame
sky: str/list
name(s) of sky frame(s) to associate to each input
time: float
Expand Down Expand Up @@ -918,6 +920,29 @@ def strip_fits(s):
else:
missing.append(sky_filename)

# Analyze the spatial clustering of exposures and attempt to sort them
# into dither groups around common nod positions.
groups = gt.group_exposures(adinputs, self.inst_lookups, frac_FOV=frac_FOV)
ngroups = len(groups)
log.fullinfo("Identified {} group(s) of exposures".format(ngroups))

# Loop over the nod groups identified above, record which group each
# exposure belongs to, propagate any already-known classification(s)
# to other members of the same group and determine whether everything
# is finally on source and/or sky:
for num, group in enumerate(groups):
adlist = group.list()
for ad in adlist:
ad.phu['EXPGROUP'] = num

# If any of these is already an OBJECT, then they all are:
if objects.intersection(adlist):
objects.update(adlist)

# And ditto for SKY:
if skies.intersection(adlist):
skies.update(adlist)

for ad in adinputs:
# Mark unguided exposures as skies
if ad.wavefront_sensor() is None:
Expand All @@ -931,7 +956,7 @@ def strip_fits(s):
log.warning("{} manually flagged as OBJECT but it's "
"unguided!".format(ad.filename))
elif ad not in skies:
log.fullinfo("Treating {} as SKY since it's unguided".
log.stdinfo("Treating {} as SKY since it's unguided".
format(ad.filename))
skies.add(ad)
# (else can't determine guiding state reliably so ignore it)
Expand All @@ -943,29 +968,6 @@ def strip_fits(s):
for name in missing:
log.warning(" {}".format(name))

# Analyze the spatial clustering of exposures and attempt to sort them
# into dither groups around common nod positions.
groups = gt.group_exposures(adinputs, self.inst_lookups, frac_FOV=frac_FOV)
ngroups = len(groups)
log.fullinfo("Identified {} group(s) of exposures".format(ngroups))

# Loop over the nod groups identified above, record which group each
# exposure belongs to, propagate any already-known classification(s)
# to other members of the same group and determine whether everything
# is finally on source and/or sky:
for num, group in enumerate(groups):
adlist = group.list()
for ad in adlist:
ad.phu['EXPGROUP'] = num

# If any of these is already an OBJECT, then they all are:
if objects.intersection(adlist):
objects.update(adlist)

# And ditto for SKY:
if skies.intersection(adlist):
skies.update(adlist)

# If one set is empty, try to fill it. Put unassigned inputs in the
# empty set. If all inputs are assigned, put them all in the empty set.
if objects and not skies:
Expand Down
Loading

0 comments on commit bb24961

Please sign in to comment.