forked from ggreco77/GWsky
/
aladinSAMP.py
51 lines (32 loc) · 1.18 KB
/
aladinSAMP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def send_file( infile ):
"""
Sending a file (image or table) to Aladin Sky Atlas using the SAMPIntegratedClient class.
http://docs.astropy.org/en/stable/vo/samp/example_table_image.html
"""
from astropy.vo.samp import SAMPIntegratedClient
client = SAMPIntegratedClient()
client.connect()
params = {}
import urlparse
import os.path
params[ "url" ] = urlparse.urljoin( 'file:',
os.path.abspath( infile ) )
message = {}
message[ "samp.mtype" ] = "image.load.fits"
message[ "samp.params" ] = params
client.notify_all( message )
client.disconnect()
def send_script( script ):
"""
Sending a script to Aladin Sky Atlas using the SAMPIntegratedClient class.
http://docs.astropy.org/en/stable/vo/samp/example_table_image.html
"""
from astropy.vo.samp import SAMPIntegratedClient
client = SAMPIntegratedClient()
client.connect()
params = {}
message = {}
message[ "samp.mtype" ] = "script.aladin.send"
message[ "samp.params" ] = { "script" : script }
client.notify_all( message )
client.disconnect()