Skip to content

Commit

Permalink
Use the SkyRss or the Sky bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiopasra committed May 18, 2020
1 parent da71c41 commit cb44567
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 17 deletions.
7 changes: 5 additions & 2 deletions megaradrp/recipes/auxiliary/acquisitionlcb.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ def run(self, rinput):
isb = rinput.ignored_sky_bundles
if isb:
self.logger.info('sky bundles ignored: %s', isb)
final, origin, sky = self.run_sky_subtraction(reduced1d,
ignored_sky_bundles=isb)
final, origin, sky = self.run_sky_subtraction(
reduced1d,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=isb
)
self.logger.info('end sky subtraction')
else:
final = reduced1d
Expand Down
7 changes: 5 additions & 2 deletions megaradrp/recipes/auxiliary/acquisitionmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ def run(self, rinput):
isb = rinput.ignored_sky_bundles
if isb:
self.logger.info('sky bundles ignored: %s', isb)
final, origin, sky = self.run_sky_subtraction(reduced1d,
ignored_sky_bundles=isb)
final, origin, sky = self.run_sky_subtraction(
reduced1d,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=isb
)
self.logger.info('end sky subtraction')
else:
final = reduced1d
Expand Down
8 changes: 6 additions & 2 deletions megaradrp/recipes/calibration/lcbstdstar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2011-2019 Universidad Complutense de Madrid
# Copyright 2011-2020 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand Down Expand Up @@ -109,7 +109,11 @@ def run(self, rinput):
ins2 = rinput.obresult.profile
ins2.configure_with_image(rss_data)
self.logger.info('start sky subtraction')
final, origin, sky = self.run_sky_subtraction(rss_data, rinput.ignored_sky_bundles)
final, origin, sky = self.run_sky_subtraction(
rss_data,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=rinput.ignored_sky_bundles
)
self.logger.info('end sky subtraction')

# 1 + 6 for first ring
Expand Down
8 changes: 6 additions & 2 deletions megaradrp/recipes/calibration/mosstdstar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2011-2019 Universidad Complutense de Madrid
# Copyright 2011-2020 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand Down Expand Up @@ -101,7 +101,11 @@ def run(self, rinput):
reduced2d, rss_data = super(MOSStandardRecipe, self).base_run(rinput)

self.logger.info('start sky subtraction')
final, origin, sky = self.run_sky_subtraction(rss_data, rinput.ignored_sky_bundles)
final, origin, sky = self.run_sky_subtraction(
rss_data,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=rinput.ignored_sky_bundles
)
self.logger.info('end sky subtraction')

# 1 + 6 for first ring
Expand Down
26 changes: 19 additions & 7 deletions megaradrp/recipes/scientific/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2011-2019 Universidad Complutense de Madrid
# Copyright 2011-2020 Universidad Complutense de Madrid
#
# This file is part of Megara DRP
#
Expand Down Expand Up @@ -103,12 +103,6 @@ def run_reduction_1d(self, img, tracemap, wlcalib, fiberflat, twflat=None, offse
reduced_rss = flow2(img)
return reduced_rss

def run_sky_subtraction(self, img, ignored_sky_bundles=None):
return subtract_sky(img,
ignored_sky_bundles=ignored_sky_bundles,
logger=self.logger
)

def compute_dar(self, img):
import numpy.polynomial.polynomial as pol

Expand All @@ -118,3 +112,21 @@ def compute_dar(self, img):

def centroid(self, rssdata, fiberconf, c1, c2, point):
return compute_centroid(rssdata, fiberconf, c1, c2, point, logger=self.logger)

def run_sky_subtraction(self, img, sky_rss=None, ignored_sky_bundles=None):

if sky_rss is None:
self.logger.info('compute sky from SKY bundles')
if ignored_sky_bundles:
self.logger.info('sky bundles ignored: %s', ignored_sky_bundles)
return subtract_sky(img,
ignored_sky_bundles=ignored_sky_bundles,
logger=self.logger
)
else:
self.logger.info('use sky RSS image')
return subtract_sky(img,
self.datamodel,
ignored_sky_bundles=ignored_sky_bundles,
logger=self.logger
)
6 changes: 5 additions & 1 deletion megaradrp/recipes/scientific/lcb.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def run(self, rinput):
isb = rinput.ignored_sky_bundles
if isb:
self.logger.info('sky bundles ignored: %s', isb)
final, origin, sky = self.run_sky_subtraction(rss_data, ignored_sky_bundles=isb)
final, origin, sky = self.run_sky_subtraction(
rss_data,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=isb
)
self.logger.info('end sky subtraction')
# Flux calibration
if rinput.master_sensitivity is not None:
Expand Down
6 changes: 5 additions & 1 deletion megaradrp/recipes/scientific/mos.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def run(self, rinput):
isb = rinput.ignored_sky_bundles
if isb:
self.logger.info('sky bundles ignored: %s', isb)
final, origin, sky = self.run_sky_subtraction(rss_data, ignored_sky_bundles=isb)
final, origin, sky = self.run_sky_subtraction(
rss_data,
sky_rss=rinput.sky_rss,
ignored_sky_bundles=isb
)
self.logger.info('end sky subtraction')
# Flux calibration
if rinput.master_sensitivity is not None:
Expand Down

0 comments on commit cb44567

Please sign in to comment.