-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
a54c3a8
commit c120ccc
Showing
20 changed files
with
1,212 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#open stack machine | ||
http://10.194.169.75 | ||
|
||
#Sentry | ||
invitation | ||
- `http://10.194.169.75:9000/accept/2/afddf62f254a471bb3d858d200a5c6dd19a96317f4444e27bad2fbea176da748/` | ||
|
||
monitor | ||
- `http://10.194.169.75:9000/sentry/python/` | ||
|
||
#logstash | ||
`http://openstack-compute01:5601/` | ||
|
||
## tunnels | ||
|
||
to logger | ||
- `ssh -t -L 5001:localhost:5001 nx ssh -t -L 5001:localhost:5001 tramacer@openstack-compute01` | ||
|
||
to monitor | ||
- `ssh -t -L 5601:localhost:5601 nx ssh -t -L 5601:localhost:5601 tramacer@openstack-compute01` | ||
|
||
## url from laptop | ||
`http://localhost:5601` | ||
|
||
|
||
|
||
|
||
#Setup On Mac | ||
|
||
- mount isdc using fuse | ||
|
||
PATH is the local_cache directory from conf_env.yml | ||
|
||
typically `PATH=/Users/orion/astro/Integral_Web_Analysis/TEST_DISPATCHER/ddosa_cache` | ||
|
||
- `mkdir PATH` | ||
|
||
- `sshfs tramacer@nx:/unsaved_data/neronov/data PATH` | ||
|
||
- tunnel to intgccn01 machine | ||
`ssh -t -L 32778:localhost:32778 nx ssh -t -L 32778:localhost:32778 tramacer@intggcn01.isdc.unige.ch` | ||
|
||
#Setup cidci machine | ||
- `cd /var/cdci/dispatcher` | ||
- `source conf/set_environment_dev_disp.sh` | ||
- cd to work dir `/var/cdci/dispatcher/online_analysis/XXX/workdir` | ||
- single thread: `run_osa_cdci_server.py -conf_file conf_env.yml` | ||
- multi thread: `run_osa_cdci_server.py -conf_file conf_env.yml -use_gunicorn ` | ||
|
||
#on every machine | ||
cp .secret-ddosa-client ~ | ||
|
||
|
||
#XSPEC python | ||
|
||
- login to cdciweb01 | ||
|
||
- run always on cdciweb01 machine! | ||
|
||
- bash | ||
- heainint | ||
|
||
## Xspec python install | ||
|
||
- include: python-config --cflags | ||
- lib: python-config --ldflags | ||
|
||
in heasoft-<ver>/Xspec/BUILD_DIR/hmakerc | ||
|
||
PYTHON_INC="-I/home/isdc/tramacer/anaconda2/include/python2.7" | ||
PYTHON_LIB="-lpython2.7" | ||
|
||
|
||
- cd /path/to/heasoft-<ver>/Xspec/src/XSUser/Python/xspec | ||
- hmake clean | ||
- hmake | ||
- hmake install | ||
|
||
|
||
#To run tests example in run_test directory: | ||
|
||
pytest ../tests/test_plugins.py::test_image -s -v | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
local_cache: isdc | ||
ddcache_root: unsaved_data/savchenk/data/reduced/ddcache | ||
dummy_cache: dummy_prods | ||
data_server_url: 127.0.0.1 | ||
data_server_port: 32778 | ||
dispatcher_url: 0.0.0.0 | ||
dispatcher_port: 5000 | ||
data_server: | ||
isgri: | ||
dispatcher_mnt_point: /Users/orion/astro/Integral_Web_Analysis/TEST_DISPATCHER/ddosa_cache | ||
data_server_cache: reduced/ddcache | ||
dummy_cache: dummy_prods | ||
data_server_url: intggcn01.isdc.unige.ch | ||
data_server_port: 32778 | ||
|
||
|
||
|
||
dispatcher: | ||
dispatcher_url: 0.0.0.0 | ||
dispatcher_port: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +0,0 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
|
||
|
||
from cdci_osa_plugin import OSA_ISGRI | ||
from cdci_osa_plugin import OSA_JEMX | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
|
||
|
||
from .my_instrument import my_instr_factory | ||
|
||
|
||
|
||
instr_factory_list=[my_instr_factory] |
7 changes: 7 additions & 0 deletions
7
cdci_data_analysis/plugins/dummy_instrument/data_server_conf.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
data_server: | ||
isgri: | ||
dispatcher_mnt_point: | ||
data_server_cache: reduced/ddcache | ||
dummy_cache: dummy_prods | ||
data_server_url: intggcn01.isdc.unige.ch | ||
data_server_port: 32778 |
104 changes: 104 additions & 0 deletions
104
cdci_data_analysis/plugins/dummy_instrument/data_server_dispatcher.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
|
||
import simple_logger | ||
import logging | ||
from cdci_data_analysis.analysis.job_manager import Job | ||
|
||
|
||
|
||
class AysnchExcept(Exception): | ||
pass | ||
|
||
class DataServerQuery(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
|
||
|
||
|
||
def test_connection(self): | ||
pass | ||
|
||
def test_has_input_products(self): | ||
pass | ||
|
||
|
||
def run_query(self, job, prompt_delegate=True): | ||
res = None | ||
try: | ||
# redirect_out('./') | ||
# with silence_stdout(): | ||
#simple_logger.logger.setLevel(logging.ERROR) | ||
|
||
if isinstance(job, Job): | ||
pass | ||
else: | ||
raise RuntimeError('job object not passed') | ||
|
||
print('--osa disp--') | ||
print('call_back_url', job.get_call_back_url()) | ||
print('*** prompt_delegate', prompt_delegate) | ||
|
||
#call to dataserver to get products | ||
|
||
print('--> url for call_back', job.get_call_back_url()) | ||
print("--> cached object in", res, res.ddcache_root_local) | ||
job.set_done() | ||
except Exception as e: | ||
|
||
job.set_failed() | ||
print("ERROR->") | ||
print(type(e), e) | ||
print("e", e) | ||
e.display() | ||
raise RuntimeWarning('ddosa connection or processing failed', e) | ||
|
||
except AysnchExcept as e: | ||
|
||
if isinstance(job, Job): | ||
print('--> url for call_back', job.get_call_back_url()) | ||
else: | ||
raise RuntimeError('job object not passed') | ||
|
||
return res | ||
|
||
|
||
|
||
|
195 changes: 195 additions & 0 deletions
195
cdci_data_analysis/plugins/dummy_instrument/image_query.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
from cdci_data_analysis.analysis.catalog import BasicCatalog | ||
from cdci_data_analysis.analysis.io_helper import FitsFile | ||
from cdci_data_analysis.analysis.products import ImageProduct, QueryProductList, QueryOutput, CatalogProduct | ||
from cdci_data_analysis.analysis.queries import ImageQuery | ||
from .data_server_dispatcher import DataServerQuery | ||
from .instr_catalog import MyInstrCatalog | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
|
||
|
||
class MyInstrImageProduct(ImageProduct): | ||
|
||
def __init__(self,name,file_name,skyima,out_dir=None,prod_prefix=None): | ||
header = skyima.header | ||
data = skyima.data | ||
super(MyInstrImageProduct, self).__init__(name,data=data,header=header,name_prefix=prod_prefix,file_dir=out_dir,file_name=file_name) | ||
#check if you need to copy! | ||
|
||
|
||
|
||
|
||
|
||
@classmethod | ||
def build_from_ddosa_skyima(cls,name,file_name,skyima,out_dir=None,prod_prefix=None): | ||
#skyima = pf.open(skyima) | ||
skyima = FitsFile(skyima).open() | ||
return cls(name,skyima=skyima[4],out_dir=out_dir,prod_prefix=prod_prefix,file_name=file_name) | ||
|
||
|
||
|
||
|
||
|
||
class MosaicQuery(ImageQuery): | ||
|
||
def __init__(self,name): | ||
|
||
super(MosaicQuery, self).__init__(name) | ||
|
||
|
||
def get_products(self,instrument,job,prompt_delegate,dump_json=False,use_dicosverer=False,config=None,out_dir=None,prod_prefix='query_spectrum'): | ||
scwlist_assumption, cat, extramodules, inject=DataServerQuery.get_osa_query_base(instrument) | ||
E1=instrument.get_par_by_name('E1_keV').value | ||
E2=instrument.get_par_by_name('E2_keV').value | ||
target, modules, assume=self.set_instr_dictionaries(extramodules,scwlist_assumption,E1,E2) | ||
q=DataServerQuery(config=config, target=target, modules=modules, assume=assume, inject=inject) | ||
|
||
#import sys | ||
#print ('ciccio',target,modules,assume,inject) | ||
|
||
res = q.run_query( job=job, prompt_delegate=prompt_delegate) | ||
|
||
if job.status != 'done': | ||
prod_list = QueryProductList(prod_list=[], job=job) | ||
return prod_list | ||
else: | ||
return self.build_product_list(job,res,out_dir,prod_prefix) | ||
|
||
|
||
def process_product(self, instrument, job, prod_list): | ||
|
||
query_image = prod_list.get_prod_by_name('mosaic_image') | ||
query_catalog = prod_list.get_prod_by_name('mosaic_catalog') | ||
detection_significance = instrument.get_par_by_name('detection_threshold').value | ||
|
||
if detection_significance is not None: | ||
query_catalog.catalog.selected = query_catalog.catalog._table['significance'] > float( | ||
detection_significance) | ||
|
||
print('--> query was ok') | ||
# file_path = Path(scratch_dir, 'query_mosaic.fits') | ||
query_image.write(overwrite=True) | ||
# file_path = Path(scratch_dir, 'query_catalog.fits') | ||
query_catalog.write(overwrite=True) | ||
|
||
html_fig = query_image.get_html_draw(catalog=query_catalog.catalog, | ||
vmin=instrument.get_par_by_name('image_scale_min').value, | ||
vmax=instrument.get_par_by_name('image_scale_max').value) | ||
|
||
query_out = QueryOutput() | ||
|
||
query_out.prod_dictionary['image'] = html_fig | ||
query_out.prod_dictionary['catalog'] = query_catalog.catalog.get_dictionary() | ||
# TODO: use query_image.file_path.path -> DONE AND PASSED | ||
# print ("########## TESTING TODO: use query_image.file_path.path ", query_image.file_path.path) | ||
query_out.prod_dictionary['file_name'] = str(query_image.file_path.name) | ||
|
||
query_out.prod_dictionary['session_id'] = job.session_id | ||
query_out.prod_dictionary['job_id'] = job.job_id | ||
|
||
query_out.prod_dictionary['download_file_name'] = 'image.gz' | ||
query_out.prod_dictionary['prod_process_maessage'] = '' | ||
|
||
return query_out | ||
|
||
|
||
def set_instr_dictionaries(self,extramodules,scwlist_assumption,E1,E2): | ||
raise RuntimeError('Must be specified for each instrument') | ||
|
||
|
||
class MyInstrMosaicQuery(MosaicQuery): | ||
def __init__(self,name ): | ||
super(MyInstrMosaicQuery, self).__init__(name) | ||
|
||
|
||
def get_dummy_products(self, instrument, config=None, **kwargs): | ||
pass | ||
|
||
|
||
def set_instr_dictionaries(self,extramodules,scwlist_assumption,E1,E2): | ||
target = "mosaic_jemx" | ||
modules = ["git://ddosa", "git://ddosadm", "git://ddjemx", 'git://rangequery'] + extramodules | ||
|
||
assume = ['ddjemx.JMXScWImageList(input_scwlist=%s)' % scwlist_assumption, | ||
'ddjemx.JEnergyBins(use_bins=[(%(E1)s,%(E2)s)])' % dict(E1=E1, E2=E2), | ||
'ddjemx.JEMX(use_num=2)'] | ||
|
||
return target, modules, assume | ||
|
||
def build_product_list(self, job, res, out_dir, prod_prefix): | ||
|
||
image = MyInstrMosaicQuery.build_from_ddosa_skyima('mosaic_image', 'jemx_query_mosaic.fits', res.skyima, | ||
out_dir=out_dir, prod_prefix=prod_prefix) | ||
osa_catalog = CatalogProduct('mosaic_catalog', catalog=MyInstrCatalog.build_from_ddosa_srclres(res.srclres), | ||
file_name='query_catalog.fits', name_prefix=prod_prefix, file_dir=out_dir) | ||
|
||
prod_list = QueryProductList(prod_list=[image, osa_catalog], job=job) | ||
|
||
return prod_list | ||
|
||
|
||
|
||
|
||
def get_dummy_products(self, instrument, config, out_dir='./'): | ||
|
||
dummy_cache = config.dummy_cache | ||
|
||
failed = False | ||
image = None | ||
catalog = None | ||
|
||
user_catalog = instrument.get_par_by_name('user_catalog').value | ||
|
||
image = ImageProduct.from_fits_file(in_file='%s/isgri_query_mosaic.fits' % dummy_cache, | ||
out_file_name='isgri_query_mosaic.fits', | ||
prod_name='mosaic_image', | ||
ext=0, | ||
file_dir=out_dir) | ||
|
||
catalog = CatalogProduct(name='mosaic_catalog', | ||
catalog=BasicCatalog.from_fits_file('%s/query_catalog.fits' % dummy_cache), | ||
file_name='query_catalog.fits', | ||
file_dir=out_dir) | ||
|
||
if user_catalog is not None: | ||
print('setting from user catalog', user_catalog, catalog) | ||
catalog.catalog = user_catalog | ||
|
||
prod_list = QueryProductList(prod_list=[image, catalog]) | ||
return prod_list |
112 changes: 112 additions & 0 deletions
112
cdci_data_analysis/plugins/dummy_instrument/instr_catalog.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
import numpy as np | ||
|
||
from cdci_data_analysis.analysis.io_helper import FitsFile | ||
from cdci_data_analysis.analysis.catalog import BasicCatalog | ||
|
||
|
||
|
||
class MyInstrCatalog(BasicCatalog): | ||
|
||
def __init__(self, | ||
src_names, | ||
lon, | ||
lat, | ||
significance, | ||
unit='deg', | ||
frame='FK5', | ||
NEW_SOURCE=None, | ||
ISGRI_FLAG=None, | ||
FLAG=None, | ||
ERR_RAD=None): | ||
|
||
super(MyInstrCatalog, self).__init__(src_names, | ||
lon, | ||
lat, | ||
significance, | ||
unit=unit, | ||
frame=frame,) | ||
|
||
|
||
|
||
self.add_column(data=NEW_SOURCE, name='NEW_SOURCE') | ||
self.add_column(data=ISGRI_FLAG, name='ISGRI_FLAG', dtype=np.int) | ||
self.add_column(data=FLAG, name='FLAG', dtype=np.int) | ||
self.add_column(data=ERR_RAD, name='ERR_RAD', dtype=np.float) | ||
|
||
@classmethod | ||
def build_from_dict_list(cls, distlist): | ||
frame = "FK5" | ||
|
||
get_key_column = lambda key, default=None: [de.get(key, default) for de in distlist] | ||
|
||
print(get_key_column('name'), cls) | ||
|
||
return cls(get_key_column('name'), | ||
get_key_column('ra'), | ||
get_key_column('dec'), | ||
significance=get_key_column('DETSIG', 0), | ||
frame="fk5", | ||
ISGRI_FLAG=get_key_column("ISGRI_FLAG", 1), | ||
NEW_SOURCE=get_key_column("NEW_SOURCE", 0), | ||
FLAG=get_key_column("FLAG", 1), | ||
ERR_RAD=get_key_column('err_rad', 0.01)) | ||
|
||
@classmethod | ||
def build_from_ddosa_srclres(cls, srclres,prod_prefix=None): | ||
#catalog = pf.open(srclres)[1] | ||
catalog=FitsFile(srclres).open()[1] | ||
|
||
print ('cat file',srclres) | ||
frame = catalog.header['RADECSYS'].lower() | ||
catalog=catalog.data | ||
return cls( [n.strip() for n in catalog['NAME']], | ||
catalog['RA_FIN'], | ||
catalog['DEC_FIN'], | ||
significance=catalog['DETSIG'], | ||
frame=frame, | ||
NEW_SOURCE=catalog['NEW_SOURCE'], | ||
ISGRI_FLAG=catalog['ISGRI_FLAG'], | ||
FLAG=catalog['FLAG'], | ||
ERR_RAD=catalog['ERR_RAD'] ) | ||
|
||
|
||
|
||
|
||
|
85 changes: 85 additions & 0 deletions
85
cdci_data_analysis/plugins/dummy_instrument/my_instrument.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
from cdci_data_analysis.plugins.dummy_instrument.image_query import MyInstrMosaicQuery | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
|
||
|
||
from cdci_data_analysis.analysis.instrument import Instrument | ||
from cdci_data_analysis.analysis.queries import * | ||
|
||
from .data_server_dispatcher import DataServerQuery | ||
from .image_query import MyInstrMosaicQuery | ||
|
||
def my_instr_factory(): | ||
src_query = SourceQuery('src_query') | ||
|
||
max_pointings = Integer(value=50, name='max_pointings') | ||
|
||
radius = Angle(value=5.0, units='deg', name='radius') | ||
E1_keV = SpectralBoundary(value=10., E_units='keV', name='E1_keV') | ||
E2_keV = SpectralBoundary(value=40., E_units='keV', name='E2_keV') | ||
spec_window = ParameterRange(E1_keV, E2_keV, 'spec_window') | ||
|
||
instr_query_pars = [radius, max_pointings, spec_window] | ||
|
||
instr_query = InstrumentQuery( | ||
name='my_instr_parameters', | ||
extra_parameters_list=instr_query_pars, | ||
input_prod_list_name='scw_list', | ||
input_prod_value=None, | ||
catalog=None, | ||
catalog_name='user_catalog') | ||
|
||
# | ||
#my_instr_image_query -> name given to this query | ||
image= MyInstrMosaicQuery('my_instr_image_query') | ||
|
||
# this dicts binds the product query name to the product name from frontend | ||
# eg my_instr_image is the parameter passed by the fronted to access the | ||
# the MyInstrMosaicQuery, and the dictionary will bing | ||
query_dictionary={} | ||
query_dictionary['my_instr_image'] = 'my_instr_image_query' | ||
|
||
return Instrument('OSA_MYINSTR', | ||
src_query=src_query, | ||
instrumet_query=instr_query, | ||
product_queries_list=[image], | ||
data_server_query_class=DataServerQuery, | ||
query_dictionary=query_dictionary, | ||
max_pointings=50) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
""" | ||
Overview | ||
-------- | ||
general info about this module | ||
Classes and Inheritance Structure | ||
---------------------------------------------- | ||
.. inheritance-diagram:: | ||
Summary | ||
--------- | ||
.. autosummary:: | ||
list of the module you want | ||
Module API | ||
---------- | ||
""" | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
from builtins import (bytes, str, open, super, range, | ||
zip, round, input, int, pow, object, map, zip) | ||
|
||
__author__ = "Andrea Tramacere" | ||
|
||
# Standard library | ||
# eg copy | ||
# absolute import rg:from copy import deepcopy | ||
|
||
# Dependencies | ||
# eg numpy | ||
# absolute import eg: import numpy as np | ||
|
||
# Project | ||
# relative import eg: from .mod import f | ||
import importlib | ||
|
||
plugin_list=['cdci_osa_plugin'] | ||
|
||
|
||
instrument_facotry_list=[] | ||
for plugin_name in plugin_list: | ||
e=importlib.import_module(plugin_name+'.exposer') | ||
instrument_facotry_list.extend(e.instr_factory_list) | ||
#for p in plugin.instr_factory_list: | ||
# print ('p',p) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,6 @@ flask | |
astropy | ||
pathlib | ||
gunicorn | ||
decorator | ||
decorator | ||
python-logstash | ||
raven |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters