Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ODA
api clients
oda_integral_wrapper
Commits
3db19153
Commit
3db19153
authored
May 25, 2021
by
Carlo Ferrigno
Browse files
v. 13.17
Correct bug for case of new sources not present when summing mosaics.
parent
3acc8df3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
11 deletions
+27
-11
oda_integral_wrapper/wrapper.py
oda_integral_wrapper/wrapper.py
+26
-10
setup.py
setup.py
+1
-1
No files found.
oda_integral_wrapper/wrapper.py
View file @
3db19153
...
@@ -198,7 +198,7 @@ class INTEGRALwrapper(object):
...
@@ -198,7 +198,7 @@ class INTEGRALwrapper(object):
for
dd
in
self
.
all_data
:
for
dd
in
self
.
all_data
:
tab
=
dd
.
dispatcher_catalog_1
.
table
tab
=
dd
.
dispatcher_catalog_1
.
table
if
len
(
tab
)
>
0
:
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
:
if
np
.
sum
(
ind
)
>
0
:
sources
.
append
(
tab
[
ind
])
sources
.
append
(
tab
[
ind
])
...
@@ -207,7 +207,12 @@ class INTEGRALwrapper(object):
...
@@ -207,7 +207,12 @@ class INTEGRALwrapper(object):
ss
.
replace_column
(
'ERR_RAD'
,
ss
.
columns
[
'ERR_RAD'
].
astype
(
np
.
float64
))
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
# 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
]
new_sources_list
=
[
dd
.
dispatcher_catalog_1
.
table
[
dd
.
dispatcher_catalog_1
.
table
[
'ISGRI_FLAG'
]
==
0
]
for
dd
in
self
.
all_data
]
for
dd
in
self
.
all_data
]
...
@@ -228,18 +233,25 @@ class INTEGRALwrapper(object):
...
@@ -228,18 +233,25 @@ class INTEGRALwrapper(object):
self
.
__log
.
debug
(
new_sources_list
)
self
.
__log
.
debug
(
new_sources_list
)
self
.
__log
.
debug
(
stacked_table_known
)
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'
)
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
:
if
idx_f
is
None
:
self
.
__log
.
info
(
"No duplicates in final catalog"
)
self
.
__log
.
info
(
"No duplicates in final catalog"
)
else
:
else
:
self
.
__log
.
info
(
"Removing %d duplicates"
%
len
(
idx_f
))
self
.
__log
.
info
(
"Removing %d duplicates"
%
len
(
idx_f
))
stacked_table
.
remove_rows
(
idx_s
)
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
]
+
\
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
[
oda_api
.
data_products
.
NumpyDataUnit
.
from_fits_hdu
(
hh
)
for
hh
in
summed_mosaic
.
to_hdu_list
()[
1
:]
summed_mosaic
.
to_hdu_list
()[
1
:]
...
@@ -248,6 +260,7 @@ class INTEGRALwrapper(object):
...
@@ -248,6 +260,7 @@ class INTEGRALwrapper(object):
self
.
summed_data
=
summed_data
self
.
summed_data
=
summed_data
self
.
compute_fluxes
()
self
.
compute_fluxes
()
self
.
display_sources
()
self
.
display_sources
()
return
summed_data
return
summed_data
def
display_sources
(
self
):
def
display_sources
(
self
):
...
@@ -266,6 +279,9 @@ class INTEGRALwrapper(object):
...
@@ -266,6 +279,9 @@ class INTEGRALwrapper(object):
raise
RuntimeWarning
(
'No summed mosaic, no computation of fluxes'
)
raise
RuntimeWarning
(
'No summed mosaic, no computation of fluxes'
)
stacked_table
=
self
.
summed_data
.
dispatcher_catalog_1
.
table
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
)
cat_for_image
=
INTEGRALwrapper
.
get_source_list_from_table
(
stacked_table
)
import
oda_integral_wrapper.fitimage
as
fitimage
import
oda_integral_wrapper.fitimage
as
fitimage
# import importlib
# import importlib
...
...
setup.py
View file @
3db19153
...
@@ -15,7 +15,7 @@ include_package_data=True
...
@@ -15,7 +15,7 @@ include_package_data=True
scripts_list
=
glob
.
glob
(
'./bin/*'
)
scripts_list
=
glob
.
glob
(
'./bin/*'
)
setup
(
name
=
'oda_integral_wrapper'
,
setup
(
name
=
'oda_integral_wrapper'
,
version
=
"1.3.1
6
"
,
version
=
"1.3.1
7
"
,
description
=
'wrapper for INTEGRAL analysis using the API plugin for CDCI online data analysis'
,
description
=
'wrapper for INTEGRAL analysis using the API plugin for CDCI online data analysis'
,
author
=
'Carlo Ferrigno'
,
author
=
'Carlo Ferrigno'
,
author_email
=
'carlo.ferrigno@unige.ch'
,
author_email
=
'carlo.ferrigno@unige.ch'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment