def test_process_bpm(): data = numpy.zeros((10, 10), dtype='float32') + 3.0 mask = numpy.zeros((10, 10), dtype='int32') mask[3,3] = 1 result = process_bpm_median(data, mask) assert result[3,3] == 3.0
def run(self, img): import numina.array.bpm as bpm imgid = self.get_imgid(img) _logger.debug('correcting bad pixel mask in %s', imgid) data = self.datamodel.get_data(img) newdata = bpm.process_bpm_median(data, self.bpm, hwin=2, wwin=2, fill=0) # newdata = array.fixpix(data, self.bpm) # FIXME: this breaks datamodel abstraction img['primary'].data = newdata hdr = img['primary'].header hdr['NUM-BPM'] = self.calibid hdr['history'] = 'BPM correction with {}'.format(self.calibid) hdr['history'] = 'BPM correction time {}'.format(datetime.datetime.utcnow().isoformat()) return img