Commit 3db19153 authored by Carlo Ferrigno's avatar Carlo Ferrigno
Browse files

v. 13.17

Correct bug for case of new sources not present when summing mosaics.
parent 3acc8df3
......@@ -198,7 +198,7 @@ class INTEGRALwrapper(object):
for dd in self.all_data:
tab = dd.dispatcher_catalog_1.table
if len(tab) > 0:
ind = np.logical_and( tab['significance'] >= detection_threshold, tab['ISGRI_FLAG'] > 0)
ind = np.logical_and(tab['significance'] >= detection_threshold, tab['ISGRI_FLAG'] > 0)
if np.sum(ind) > 0:
sources.append(tab[ind])
......@@ -207,7 +207,12 @@ class INTEGRALwrapper(object):
ss.replace_column('ERR_RAD', ss.columns['ERR_RAD'].astype(np.float64))
# We stack the table but take just the first occurrence of each source
stacked_table_known = table.unique(table.vstack(sources, join_type='exact'), keys='src_names')
if len(sources) > 0:
stacked_table_known = table.unique(table.vstack(sources, join_type='exact'), keys='src_names')
else:
stacked_table_known = None
self.__log.warning("No sources satisfy the criterion for filtering")
new_sources_list = [dd.dispatcher_catalog_1.table[dd.dispatcher_catalog_1.table['ISGRI_FLAG'] == 0]
for dd in self.all_data]
......@@ -228,18 +233,25 @@ class INTEGRALwrapper(object):
self.__log.debug(new_sources_list)
self.__log.debug(stacked_table_known)
stacked_table = table.unique(table.vstack(new_sources_list + [stacked_table_known], join_type='exact'),
if len(new_sources_list) > 0 and stacked_table_known is not None:
stacked_table = table.unique(table.vstack(new_sources_list + [stacked_table_known], join_type='exact'),
keys='src_names')
elif len(new_sources_list) == 0 and stacked_table_known is not None:
stacked_table = stacked_table_known
else:
stacked_table = None
idx_f, idx_s = find_duplicates(stacked_table)
if stacked_table is not None:
idx_f, idx_s = find_duplicates(stacked_table)
if idx_f is None:
self.__log.info("No duplicates in final catalog")
else:
self.__log.info("Removing %d duplicates" % len(idx_f))
stacked_table.remove_rows(idx_s)
if idx_f is None:
self.__log.info("No duplicates in final catalog")
else:
self.__log.info("Removing %d duplicates" % len(idx_f))
stacked_table.remove_rows(idx_s)
summed_data.dispatcher_catalog_1.table = stacked_table
summed_data.dispatcher_catalog_1.table = stacked_table
summed_data.mosaic_image_0_mosaic.data_unit = summed_data.mosaic_image_0_mosaic.data_unit[0:1] + \
[oda_api.data_products.NumpyDataUnit.from_fits_hdu(hh) for hh in
summed_mosaic.to_hdu_list()[1:]
......@@ -248,6 +260,7 @@ class INTEGRALwrapper(object):
self.summed_data=summed_data
self.compute_fluxes()
self.display_sources()
return summed_data
def display_sources(self):
......@@ -266,6 +279,9 @@ class INTEGRALwrapper(object):
raise RuntimeWarning('No summed mosaic, no computation of fluxes')
stacked_table = self.summed_data.dispatcher_catalog_1.table
if len(stacked_table) == 0:
self.__log.warning("No sources in the catalog, impossible to compute fluxes")
return
cat_for_image = INTEGRALwrapper.get_source_list_from_table(stacked_table)
import oda_integral_wrapper.fitimage as fitimage
# import importlib
......
......@@ -15,7 +15,7 @@ include_package_data=True
scripts_list = glob.glob('./bin/*')
setup(name='oda_integral_wrapper',
version="1.3.16",
version="1.3.17",
description='wrapper for INTEGRAL analysis using the API plugin for CDCI online data analysis',
author='Carlo Ferrigno',
author_email='carlo.ferrigno@unige.ch',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment