Esempio n. 1
0
class AladinViaSAMP(object):
    def __init__(self):
        self._client = SAMPIntegratedClient()

    def send_file(self, infile=str()):
        """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
        """

        self._client.connect()

        params = {}
        params["url"] = urlparse.urljoin('file:', os.path.abspath(infile))
        message = {}
        message["samp.mtype"] = "image.load.fits"
        message["samp.params"] = params

        self._client.notify_all(message)
        self._client.disconnect()

    def send_script_command(self, script=str()):
        """Sending a script to Aladin Sky Atlas using the SAMPIntegratedClient class.
           http://docs.astropy.org/en/stable/vo/samp/example_table_image.html
         """

        self._client.connect()

        params = {}
        message = {}
        message["samp.mtype"] = "script.aladin.send"
        message["samp.params"] = {"script": script}

        self._client.notify_all(message)
        self._client.disconnect()
Esempio n. 2
0
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()
Esempio n. 3
0
def SAMP_send_fits(filename,longname):
    client = SAMPIntegratedClient()
    client.connect()
    params = {}
    params["url"] = 'file://'+os.getcwd()+'/'+filename
    params["name"] = longname
    message = {}
    message["samp.mtype"] = "image.load.fits"
    message["samp.params"] = params
    client.notify_all(message)
    client.disconnect()
Esempio n. 4
0
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()
Esempio n. 5
0
class AladinViaSAMP(object):

    def __init__(self):
        self._client = SAMPIntegratedClient()
        
    def send_file(self, infile=str()):
        """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
        """   
     
        self._client.connect()

        params = {}       
        params[ "url" ] = urlparse.urljoin( 'file:',
				 os.path.abspath( infile ) )
        message = {}
        message[ "samp.mtype" ] = "image.load.fits"
        message[ "samp.params" ] = params
     
        self._client.notify_all(message)
        self._client.disconnect()

    def send_script_command(self, script=str()):
        """Sending a script to Aladin Sky Atlas using the SAMPIntegratedClient class.
           http://docs.astropy.org/en/stable/vo/samp/example_table_image.html
         """

        self._client.connect()

        params = {}
        message = {} 
        message[ "samp.mtype" ] = "script.aladin.send"
        message[ "samp.params" ] = { "script" : script }  

        self._client.notify_all(message)
        self._client.disconnect()