def test_continuum_imaging_pipeline(self): continuum_imaging_graph = \ create_continuum_imaging_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, c_deconvolve_graph=create_deconvolve_facet_graph, c_invert_graph=create_invert_wstack_graph, c_residual_graph=create_residual_wstack_graph, vis_slices=self.vis_slices, facets=2, niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=0, gain=0.1) if self.compute: clean, residual, restored = continuum_imaging_graph.compute() export_image_to_fits( clean, '%s/test_pipelines_continuum_imaging_pipeline_clean.fits' % (self.results_dir)) export_image_to_fits( residual[0], '%s/test_pipelines_continuum_imaging_pipeline_residual.fits' % (self.results_dir)) export_image_to_fits( restored, '%s/test_pipelines_continuum_imaging_pipeline_restored.fits' % (self.results_dir)) qa = qa_image(restored) assert numpy.abs(qa.data['max'] - 100.0) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 5.0) < 5.0, str(qa)
def test_ical_pipeline(self): self.actualSetUp(add_errors=True, block=True) controls = create_calibration_controls() controls['T']['first_selfcal'] = 2 controls['G']['first_selfcal'] = 3 controls['B']['first_selfcal'] = 4 controls['T']['timescale'] = 'auto' controls['G']['timescale'] = 'auto' controls['B']['timescale'] = 1e5 ical_graph = \ create_ical_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, context='wstack', do_selfcal=1, global_solution=False, algorithm='mmclean', vis_slices=51, facets=1, niter=1000, fractional_threshold=0.1, nmoments=3, nchan=self.freqwin, threshold=2.0, nmajor=6, gain=0.1) if self.compute: clean, residual, restored = ical_graph.compute() export_image_to_fits( clean[0], '%s/test_pipelines_ical_pipeline_clean.fits' % self.dir) export_image_to_fits( residual[0][0], '%s/test_pipelines_ical_pipeline_residual.fits' % self.dir) export_image_to_fits( restored[0], '%s/test_pipelines_ical_pipeline_restored.fits' % self.dir) qa = qa_image(restored[0]) assert numpy.abs(qa.data['max'] - 116.86978265) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 0.323425377573) < 5.0, str(qa)
def _invert_base(self, context='2d', extra='', flux_max=100.0, flux_min=-0.2, flux_tolerance=5.0): dirty_graph = create_invert_graph(self.vis_graph_list, self.model_graph, context=context, dopsf=False, normalize=True, **self.params) if self.compute: dirty = dirty_graph[0].compute() export_image_to_fits( dirty[0], '%s/test_imaging_delayed_invert_%s%s_dirty.fits' % ( self.dir, context, extra, )) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - flux_max) < flux_tolerance, str(qa) assert numpy.abs(qa.data['min'] - flux_min) < flux_tolerance, str(qa)
def test_continuum_imaging_pipeline(self): \ # Note that the image is poor because we set the number of wstack's to be smaller than # recommended. Setting it to e.g. 51 gives a better image but at the cost of longer run time. self.actualSetUp(add_errors=False, block=True) continuum_imaging_graph = \ create_continuum_imaging_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, algorithm='mmclean', nmoments=3, nchan=self.freqwin, context='wstack', niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=0, gain=0.1, vis_slices=11) if self.compute: clean, residual, restored = continuum_imaging_graph.compute() export_image_to_fits( clean[0], '%s/test_pipelines_continuum_imaging_pipeline_clean.fits' % self.dir) export_image_to_fits( residual[0][0], '%s/test_pipelines_continuum_imaging_pipeline_residual.fits' % self.dir) export_image_to_fits( restored[0], '%s/test_pipelines_continuum_imaging_pipeline_restored.fits' % self.dir) qa = qa_image(restored[0]) assert numpy.abs(qa.data['max'] - 116.86978265) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 0.323425377573) < 5.0, str(qa)
def test_continuum_imaging_pipeline(self): self.actualSetUp(add_errors=False, block=True) continuum_imaging_graph = \ create_continuum_imaging_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, algorithm='mmclean', nmoments=3, nchan=self.freqwin, context='wstack', niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=0, gain=0.1, vis_slices=51) if self.compute: clean, residual, restored = continuum_imaging_graph.compute() export_image_to_fits( clean[0], '%s/test_pipelines_continuum_imaging_pipeline_clean.fits' % self.dir) export_image_to_fits( residual[0][0], '%s/test_pipelines_continuum_imaging_pipeline_residual.fits' % self.dir) export_image_to_fits( restored[0], '%s/test_pipelines_continuum_imaging_pipeline_restored.fits' % self.dir) qa = qa_image(restored[0]) assert numpy.abs(qa.data['max'] - 116.86978265) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 0.323425377573) < 5.0, str(qa)
def test_residual_image_bag(self): context = 'wstack' vis_slices = {'wstack': 101} dirty_bag = invert_bag(self.vis_bag, self.empty_model_bag, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) psf_bag = invert_bag(self.vis_bag, self.empty_model_bag, dopsf=True, context=context, normalize=True, vis_slices=vis_slices[context]) dirty_bag = reify(dirty_bag) psf_bag = reify(psf_bag) model_bag = deconvolve_bag(dirty_bag, psf_bag, self.empty_model_bag, niter=1000, gain=0.1, algorithm='msclean', threshold=0.01, window_shape=None) residual_bag = residual_image_bag(self.vis_bag, model_bag, context=context, vis_slices=vis_slices[context]) final = residual_bag.compute()[0]['image'][0] export_image_to_fits( final, '%s/test_bags_%s_residual.fits' % (self.dir, context)) qa = qa_image(final, context=context) assert qa.data['max'] < 15.0, str(qa)
def test_deconvolve_bag(self): context = 'wstack' vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} dirty_bag = invert_bag(self.vis_bag, self.model_bag, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) psf_bag = invert_bag(self.vis_bag, self.model_bag, dopsf=True, context=context, normalize=True, vis_slices=vis_slices[context]) dirty_bag = reify(dirty_bag) psf_bag = reify(psf_bag) model_bag = deconvolve_bag(dirty_bag, psf_bag, self.empty_model_bag, niter=1000, gain=0.7, algorithm='msclean', threshold=0.01, window_shape=None) model = model_bag.compute()[0]['image'] qa = qa_image(model, context=context) export_image_to_fits( model, '%s/test_bags_%s_deconvolve.fits' % (self.dir, context)) assert numpy.abs(qa.data['max'] - 60.5) < 0.1, str(qa)
def test_deconvolve_bag(self): context = 'wstack' vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} dirty_bag = invert_bag(self.vis_bag, self.model, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) psf_bag = invert_bag(self.vis_bag, self.model, dopsf=True, context=context, normalize=True, vis_slices=vis_slices[context]) model_bag = deconvolve_bag(dirty_bag, psf_bag, niter=1000, gain=0.7, algorithm='msclean', threshold=0.01, window_shape=None) model = list(model_bag)[0] qa = qa_image(model, context=context) export_image_to_fits( model, '%s/test_bag_%s_deconvolve.fits' % (self.results_dir, context)) assert numpy.abs(qa.data['max'] - 60.5293158864) < 1.0e-7, str(qa)
def test_residual_image_bag(self): context = 'wstack' vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} dirty_bag = invert_bag(self.vis_bag, self.model, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) psf_bag = invert_bag(self.vis_bag, self.model, dopsf=True, context=context, normalize=True, vis_slices=vis_slices[context]) model_bag = deconvolve_bag(dirty_bag, psf_bag, niter=1000, gain=0.1, algorithm='msclean', threshold=0.01, window_shape=None) residual_bag = residual_image_bag(self.vis_bag, model_bag, context=context, vis_slices=vis_slices[context]) final = list(residual_bag)[0][0] export_image_to_fits( final, '%s/test_bag_%s_residual.fits' % (self.results_dir, context)) qa = qa_image(final, context=context) assert qa.data['max'] < 15.0, str(qa)
def test_deconvolution_channel_graph(self): self.vis_graph_list = self.setupVis(freqwin=8) self.model_graph = delayed(self.get_LSM)(self.vis_graph_list[self.nvis // 2], frequency=self.frequency) model_graph = delayed(self.get_LSM)(self.vis_graph_list[self.nvis // 2], flux=0.0) dirty_graph = create_invert_wstack_graph(self.vis_graph_list, model_graph, dopsf=False, vis_slices=self.vis_slices) psf_model_graph = delayed(self.get_LSM)(self.vis_graph_list[self.nvis // 2], flux=0.0) psf_graph = create_invert_wstack_graph(self.vis_graph_list, psf_model_graph, vis_slices=self.vis_slices, dopsf=True) channel_images = 4 clean_graph = create_deconvolve_channel_graph(dirty_graph, psf_graph, model_graph, algorithm='hogbom', niter=1000, fractional_threshold=0.02, threshold=2.0, gain=0.1, subimages=channel_images) if self.compute: result = clean_graph.compute() export_image_to_fits(result, '%s/test_imaging_deconvolution_channels%d.clean.fits' % (self.results_dir, channel_images)) qa = qa_image(result) assert numpy.abs(qa.data['max'] - 100.1) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 1.8) < 1.0, str(qa)
def test_ical_pipeline_global(self): self.setupVis(add_errors=True) ical_graph = \ create_ical_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, c_deconvolve_graph=create_deconvolve_facet_graph, c_predict_graph=create_predict_wstack_graph, c_invert_graph=create_invert_wstack_graph, c_residual_graph=create_residual_wstack_graph, c_selfcal_graph=create_selfcal_graph_list, global_solution=True, vis_slices=self.vis_slices, facets=2, niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=5, gain=0.1, first_selfcal=1) if self.compute: clean, residual, restored = ical_graph.compute() export_image_to_fits( clean, '%s/test_pipelines_ical_pipeline_global_clean.fits' % (self.results_dir)) export_image_to_fits( residual[0], '%s/test_pipelines_ical_pipeline_global_residual.fits' % (self.results_dir)) export_image_to_fits( restored, '%s/test_pipelines_ical_pipeline_global_restored.fits' % (self.results_dir)) qa = qa_image(restored) assert numpy.abs(qa.data['max'] - 100.0) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 5.0) < 5.0, str(qa)
def test_predict_bag(self): errors = {'2d': 28.0, 'timeslice': 30.0, 'wstack': 2.3} vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} for context in ['wstack', 'timeslice']: model_vis_bag = predict_bag(self.vis_bag, self.model_bag, context, vis_slices=vis_slices[context]) model_vis_bag = reify(model_vis_bag) error_vis_bag = self.vis_bag.map(predict_record_subtract, model_vis_bag) error_vis_bag = reify(error_vis_bag) error_image_bag = invert_bag(error_vis_bag, self.model_bag, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) result = error_image_bag.compute() error_image = result[0]['image'][0] export_image_to_fits( error_image, '%s/test_bags_%s_predict_error_image.fits' % (self.dir, context)) qa = qa_image(error_image, context='error image for %s' % context) assert qa.data['max'] < errors[context], str(qa)
def test_create_image_from_array(self): m31model_by_array = create_image_from_array(self.m31image.data, wcs=None) m31model_by_array = create_image_from_array(self.m31image.data, self.m31image.wcs) add_image(self.m31image, m31model_by_array) add_image(self.m31image, m31model_by_array, docheckwcs=True) assert m31model_by_array.shape == self.m31image.shape log.debug(export_image_to_fits(self.m31image, fitsfile='%s/test_model.fits' % (self.dir))) log.debug(qa_image(m31model_by_array, context='test_create_from_image'))
def test_residual_image_bag_model(self): cvis_bag = self.vis_bag.map(coalesce_visibility) context = 'wstack' vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} residual_bag = residual_image_bag(cvis_bag, self.model_bag, context=context, vis_slices=vis_slices[context]) final = list(residual_bag)[0][0] export_image_to_fits(final, '%s/test_bag_%s_residual_image_bag.fits' % (self.results_dir, context)) qa = qa_image(final, context=context) assert qa.data['max'] < 2.3, str(qa)
def qa_image_bag(im, context=''): """ Print qa on images, use this in a sequence of bag operations Can be used in bag.map() as a passthru :param im: :return: """ s = qa_image(im, context=context) log.info(s) return im
def test_gleam_model_graph(self): vis_graph_list = create_simulate_vis_graph( frequency=self.frequency, channel_bandwidth=self.channel_bandwidth) model_list = create_gleam_model_graph( vis_graph_list[0], frequency=self.frequency, channel_bandwidth=self.channel_bandwidth, npixel=256) if self.compute: qa = qa_image(model_list.compute()) assert qa.data['max'] > 0.0
def test_invert_facet_graph(self): dirty_graph = create_invert_facet_graph(self.vis_graph_list, self.model_graph, dopsf=False, normalize=True, facets=4) if self.compute: dirty = dirty_graph.compute() export_image_to_fits(dirty[0], '%s/test_imaging_invert_facet_dirty.fits' % (self.results_dir)) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - 101.7) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 3.5) < 1.0, str(qa)
def test_invert_bag(self): peaks = {'2d': 65.2997439062, 'timeslice': 99.6183393299, 'wstack': 100.702701119} vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} for context in ['wstack', '2d', 'timeslice']: dirty_bag = invert_bag(self.vis_bag, self.empty_model, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) dirty_bag.visualize('test_invert_bag.svg') result=dirty_bag.compute() dirty, sumwt = list(dirty_bag)[0] export_image_to_fits(dirty, '%s/test_bag_%s_dirty.fits' % (self.results_dir, context)) qa = qa_image(dirty, context=context) assert numpy.abs(qa.data['max'] - peaks[context]) < 1.0e-2, str(qa)
def test_residual_image_bag_model(self): context = 'wstack' vis_slices = {'wstack': 101} residual_bag = residual_image_bag(self.vis_bag, self.model_bag, context=context, vis_slices=vis_slices[context]) final = residual_bag.compute()[0]['image'][0] export_image_to_fits( final, '%s/test_bags_%s_residual_image_bag.fits' % (self.dir, context)) qa = qa_image(final, context=context) assert qa.data['max'] < 2.3, str(qa)
def test_sagecal_solve_delayed(self): self.actualSetup() sagecal_graph = create_sagecal_solve_graph(self.vis, self.components, niter=30, gain=0.25, tol=1e-8) sagecal_graph.visualize("%s/sagecal.svg" % self.dir) thetas, residual_vis = sagecal_graph.compute() residual_vis = convert_blockvisibility_to_visibility(residual_vis) residual_vis, _, _ = weight_visibility(residual_vis, self.beam) dirty, sumwt = invert_function(residual_vis, self.beam, context='2d') export_image_to_fits(dirty, "%s/test_sagecal-delayed-final_residual.fits" % self.dir) qa = qa_image(dirty) assert qa.data['rms'] < 4e-3, qa
def test_invert_wstack_graph_wprojection(self): dirty_graph = create_invert_wstack_graph(self.vis_graph_list, self.model_graph, dopsf=False, normalize=True, vis_slices=self.vis_slices//10, wstep=4.0, facets=2, kernel='wprojection') if self.compute: dirty = dirty_graph.compute() export_image_to_fits(dirty[0], '%s/test_imaging_invert_wstack_wprojection_dirty.fits' % (self.results_dir)) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - 101.7) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 3.5) < 1.0, str(qa)
def test_residual_wstack_graph_wprojection(self): self.model_graph = delayed(self.get_LSM)(self.vis_graph_list[self.nvis // 2], flux=100.0) dirty_graph = create_residual_wstack_graph(self.vis_graph_list, self.model_graph, kernel='wprojection', vis_slices=11, wstep=10.0) if self.compute: dirty = dirty_graph.compute() export_image_to_fits(dirty[0], '%s/test_imaging_residual_wprojection.fits' % (self.results_dir)) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - 101.7) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 3.5) < 1.0, str(qa)
def test_invert_wstack_graph(self): dirty_graph = create_invert_wstack_graph(self.vis_graph_list, self.model_graph, dopsf=False, normalize=True, vis_slices=self.vis_slices) dirty = dirty_graph.compute() export_image_to_fits( dirty[0], '%s/test_imaging_dask_invert_dirty.fits' % (self.results_dir)) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - 104.0) < 1.0 assert numpy.abs(qa.data['min'] + 5.0) < 1.0
def test_continuum_imaging_pipeline(self): continuum_imaging_graph = \ create_continuum_imaging_pipeline_graph(self.vis_graph_list, model_graph=self.model_graph, context='wstack', niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=0, gain=0.1) if self.compute: clean, residual, restored = continuum_imaging_graph.compute() export_image_to_fits(clean[0], '%s/test_pipelines_continuum_imaging_pipeline_clean.fits' % self.dir) export_image_to_fits(residual[0], '%s/test_pipelines_continuum_imaging_pipeline_residual.fits' % self.dir) export_image_to_fits(restored, '%s/test_pipelines_continuum_imaging_pipeline_restored.fits' % self.dir) qa = qa_image(restored) assert numpy.abs(qa.data['max'] - 100.0) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 5.0) < 5.0, str(qa)
def test_sagecal_solve(self): self.actualSetup() thetas, residual_vis = sagecal_solve(self.vis, self.components, niter=30, gain=0.25, tol=1e-8) residual_vis = convert_blockvisibility_to_visibility(residual_vis) residual_vis, _, _ = weight_visibility(residual_vis, self.beam) dirty, sumwt = invert_function(residual_vis, self.beam, context='2d') export_image_to_fits(dirty, "%s/test_sagecal-final_residual.fits" % self.dir) # for i, theta in enumerate(thetas): # print('Component %d, original flux = %s, recovered flux = %s, gain residual = %s' % # (i, str(self.components[i].flux[0, 0]), str(theta[0].flux[0, 0]), # str(numpy.max(theta[1].residual)))) # qa = qa_image(dirty) assert qa.data['rms'] < 4e-3, qa
def test_residual_facet_wstack_graph(self): self.model_graph = delayed(self.get_LSM)(self.vis_graph_list[self.nvis // 2], flux=100.0) dirty_graph = create_residual_facet_wstack_graph(self.vis_graph_list, self.model_graph, facets=4, vis_slices=self.vis_slices) if self.compute: dirty = dirty_graph.compute() export_image_to_fits(dirty[0], '%s/test_imaging_residual_wstack_slices%d.fits' % (self.results_dir, self.vis_slices)) qa = qa_image(dirty[0]) assert numpy.abs(qa.data['max'] - 101.7) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 3.5) < 1.0, str(qa)
def test_predict_bag(self): cvis_bag = self.vis_bag.map(coalesce_visibility) errors = {'2d': 28.0, 'timeslice': 30.0, 'wstack': 2.3} vis_slices = {'2d': None, 'timeslice': 'auto', 'wstack': 101} for context in ['timeslice', 'wstack']: model_vis_bag = predict_bag(cvis_bag, self.model_bag, context, vis_slices=vis_slices[context])\ .map(decoalesce_visibility, self.vis_bag) model_vis_bag = bag.from_sequence(model_vis_bag.compute()) error_vis_bag = self.vis_bag.map(subtract_visibility, model_vis_bag).compute() error_vis_bag = bag.from_sequence(error_vis_bag) error_image_bag = invert_bag(error_vis_bag, self.model_bag, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) result = list(error_image_bag)[0] error_image = result[0] export_image_to_fits(error_image, '%s/test_bag_%s_predict_error_image.fits' % (self.results_dir, context)) qa = qa_image(error_image, context='error image for %s' % context) assert qa.data['max'] < errors[context], str(qa)
def test_continuum_imaging_pipeline(self): self.vis_slices = 51 self.context = 'wstack_single' continuum_imaging_bag = \ continuum_imaging_pipeline_bag(self.vis_bag, model_bag=self.model_bag, context=self.context, vis_slices=self.vis_slices, niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=0, gain=0.1) if self.compute: clean, residual, restored = continuum_imaging_bag.compute() clean = clean.compute()[0]['image'] export_image_to_fits( clean, '%s/test_pipelines_continuum_imaging_bag_clean.fits' % (self.dir)) qa = qa_image(clean) assert numpy.abs(qa.data['max'] - 100.0) < 5.0, str(qa) assert numpy.abs(qa.data['min'] + 5.0) < 5.0, str(qa)
def test_ical_pipeline(self): self.vis_slices = 51 self.context = 'wstack_single' self.setupVis(add_errors=True) ical_bag = \ ical_pipeline_bag(self.vis_bag, model_bag=self.model_bag, context=self.context, vis_slices=self.vis_slices, niter=1000, fractional_threshold=0.1, threshold=2.0, nmajor=5, gain=0.1, first_selfcal=1, global_solution=False) if self.compute: clean, residual, restored = ical_bag.compute() clean = clean.compute()[0]['image'] export_image_to_fits( clean, '%s/test_pipelines_ical_bag_clean.fits' % (self.dir)) qa = qa_image(clean) assert numpy.abs(qa.data['max'] - 92) < 5.0, str(qa) assert numpy.abs(qa.data['min']) < 5.0, str(qa)
def test_restore_bag(self): peaks = {'wstack': 98.8113067286} vis_slices = {'wstack': 101} context = 'wstack' dirty_bag = invert_bag(self.vis_bag, self.model_bag, dopsf=False, context=context, normalize=True, vis_slices=vis_slices[context]) psf_bag = invert_bag(self.vis_bag, self.model_bag, dopsf=True, context=context, normalize=True, vis_slices=vis_slices[context]) dirty_bag = reify(dirty_bag) psf_bag = reify(psf_bag) model_bag = deconvolve_bag(dirty_bag, psf_bag, self.empty_model_bag, niter=1000, gain=0.7, algorithm='msclean', threshold=0.01, window_shape=None) model_bag = reify(model_bag) res_image_bag = residual_image_bag(self.vis_bag, model_bag, context=context, vis_slices=vis_slices[context]) res_image_bag = reify(res_image_bag) residual = res_image_bag.compute()[0]['image'][0] export_image_to_fits( residual, '%s/test_bags_%s_residual.fits' % (self.dir, context)) final_bag = restore_bag(model_bag, psf_bag, res_image_bag) final = final_bag.compute()[0] qa = qa_image(final, context=context) export_image_to_fits( final, '%s/test_bags_%s_restored.fits' % (self.dir, context)) assert numpy.abs(qa.data['max'] - peaks[context]) < 0.1, str(qa)