def run(self, rinput): _logger.info('starting bias reduction') iinfo = gather_info_frames(rinput.obresult.frames) if iinfo: mode = iinfo[0]['readmode'] if mode.lower() not in EMIR_BIAS_MODES: msg = 'readmode %s, is not a bias mode' % mode _logger.error(msg) raise RecipeError(msg) flow = lambda x: x hdulist = basic_processing_with_combination(rinput, flow, method=median, errors=False) pdata = hdulist[0].data # update hdu header with # reduction keywords hdr = hdulist[0].header self.set_base_headers(hdr) hdr['CCDMEAN'] = pdata.mean() _logger.info('bias reduction ended') result = self.create_result(biasframe=DataFrame(hdulist)) return result
def run(self, rinput): _logger.info('starting dark reduction') flow = self.init_filters(rinput) iinfo = gather_info_frames(rinput.obresult.frames) ref_exptime = 0.0 for el in iinfo[1:]: if abs(el['texp'] - ref_exptime) > 1e-4: _logger.error('image with wrong exposure time') raise RecipeError('image with wrong exposure time') hdulist = basic_processing_with_combination(rinput, flow, method=median, errors=True) pdata = hdulist[0].data # update hdu header with # reduction keywords hdr = hdulist[0].header self.set_base_headers(hdr) hdr['CCDMEAN'] = pdata.mean() _logger.info('dark reduction ended') result = self.create_result(darkframe=hdulist) return result
def run(self, rinput): results = [] self.logger.info('starting multiflat flat reduction') # Uncomment this line # to revert to non-ramp # flow = self.init_filters(rinput) saturation = 45000.0 iinfo = gather_info_frames(rinput.obresult.frames) image_groups = {} self.logger.info('group images by filter') for idx, info in enumerate(iinfo): filt = info['filter'] if filt not in image_groups: self.logger.debug('new filter %s', filt) image_groups[filt] = [] img = rinput.obresult.frames[idx] self.logger.debug('image %s in group %s', img, filt) image_groups[filt].append(img) for filt, frames in image_groups.items(): self.logger.info('processing filter %s', filt) # Uncomment this line and comment the following # to revert to non-ramp # res = self.run_per_filter(frames, flow) try: res = self.run_per_filter_ramp(frames, saturation=saturation) results.append(res) except ValueError: self.logger.info('filter %s cannot be processed', filt) self.logger.info('end multiflat flat reduction') result = self.create_result(twflatframes=results) return result