diff --git a/docs/astropy_samp/advanced_embed_samp_hub.rst b/docs/astropy_samp/advanced_embed_samp_hub.rst index 1d78189c2..55a53972e 100644 --- a/docs/astropy_samp/advanced_embed_samp_hub.rst +++ b/docs/astropy_samp/advanced_embed_samp_hub.rst @@ -11,14 +11,14 @@ Overview If you wish to embed a SAMP hub in your Python Graphical User Interface (GUI) tool, you will need to start the hub programmatically using:: - from astropy.samp import SAMPHubServer + from pyvo.astropy_samp import SAMPHubServer hub = SAMPHubServer() hub.start() This launches the hub in a thread and is non-blocking. If you are not interested in connections from web SAMP clients, then you can use:: - from astropy.samp import SAMPHubServer + from pyvo.astropy_samp import SAMPHubServer hub = SAMPHubServer(web_profile=False) hub.start() @@ -31,7 +31,7 @@ likely want to open a GUI dialog instead. To do this, you will need to define a class that handles the dialog, and then pass an **instance** of the class to |SAMPHubServer| (not the class itself). -This class should inherit from `astropy.samp.WebProfileDialog` and add the +This class should inherit from `pyvo.astropy_samp.WebProfileDialog` and add the following: 1) A GUI timer callback that periodically calls @@ -71,8 +71,8 @@ SAMP connections and opens the appropriate dialog:: import tkinter as tk import tkinter.messagebox as tkMessageBox - from astropy.samp import SAMPHubServer - from astropy.samp.hub import WebProfileDialog + from pyvo.astropy_samp import SAMPHubServer + from pyvo.astropy_samp.hub import WebProfileDialog MESSAGE = """ A Web application which declares to be diff --git a/docs/astropy_samp/example_clients.rst b/docs/astropy_samp/example_clients.rst index d3f07dd32..6c3ddfaee 100644 --- a/docs/astropy_samp/example_clients.rst +++ b/docs/astropy_samp/example_clients.rst @@ -21,7 +21,7 @@ First, start up a SAMP hub as described in :doc:`example_hub`. Next, we create two clients and connect them to the hub:: - >>> from astropy import samp + >>> from pyvo import astropy_samp as samp >>> client1 = samp.SAMPIntegratedClient(name="Client 1", description="Test Client 1", ... metadata = {"client1.version":"0.01"}) >>> client2 = samp.SAMPIntegratedClient(name="Client 2", description="Test Client 2", diff --git a/docs/astropy_samp/example_hub.rst b/docs/astropy_samp/example_hub.rst index dfd7e6c16..d6fdd964e 100644 --- a/docs/astropy_samp/example_hub.rst +++ b/docs/astropy_samp/example_hub.rst @@ -14,14 +14,14 @@ Using an Existing Hub You can start up another application that includes a hub, such as `TOPCAT `_, -`SAO Ds9 `_, or +`SAO DS9 `_, or `Aladin Desktop `_. Using the Command-Line Hub Utility ================================== You can make use of the ``samp_hub`` command-line utility, which is included in -``astropy``:: +``pyvo``:: $ samp_hub @@ -37,7 +37,7 @@ Starting a Hub Programmatically (Advanced) You can start up a hub by creating a |SAMPHubServer| instance and starting it, either from the interactive Python prompt, or from a Python script:: - >>> from astropy.samp import SAMPHubServer + >>> from pyvo.astropy_samp import SAMPHubServer >>> hub = SAMPHubServer() >>> hub.start() diff --git a/docs/astropy_samp/example_table_image.rst b/docs/astropy_samp/example_table_image.rst index bb562ef66..a2e59fc8d 100644 --- a/docs/astropy_samp/example_table_image.rst +++ b/docs/astropy_samp/example_table_image.rst @@ -18,7 +18,7 @@ In the following examples, we make use of: TOPCAT and Aladin will run a SAMP Hub if none is found, so for the following examples you can either start up one of these applications first, or you can -start up the `astropy.samp` hub. You can start this using the following +start up the `pyvo.astropy_samp` hub. You can start this using the following command:: $ samp_hub @@ -30,7 +30,7 @@ The easiest way to send a VO table to TOPCAT is to make use of the |SAMPIntegratedClient| class. Once TOPCAT is open, first instantiate a |SAMPIntegratedClient| instance and then connect to the hub:: - >>> from astropy.samp import SAMPIntegratedClient + >>> from pyvo.astropy_samp import SAMPIntegratedClient >>> client = SAMPIntegratedClient() >>> client.connect() @@ -59,7 +59,7 @@ and the details of the table that we set above):: Finally, we can broadcast this to all clients that are listening for ``table.load.votable`` messages using -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all`:: +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.notify_all`:: >>> client.notify_all(message) @@ -67,7 +67,7 @@ The above message will actually be broadcast to all applications connected via SAMP. For example, if we open `SAO DS9 `_ in addition to TOPCAT, and we run the above command, both applications will load the table. We can use the -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.get_registered_clients` method to +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.get_registered_clients` method to find all of the clients connected to the hub:: >>> client.get_registered_clients() @@ -88,7 +88,7 @@ These IDs do not mean much, but we can find out more using:: We can see that ``c1`` is the TOPCAT client. We can now resend the data, but this time only to TOPCAT, using the -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify` method:: +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.notify` method:: >>> client.notify('c1', message) @@ -103,7 +103,7 @@ To receive a table from TOPCAT, we have to set up a client that listens for messages from the hub. As before, we instantiate a |SAMPIntegratedClient| instance and connect to the hub:: - >>> from astropy.samp import SAMPIntegratedClient + >>> from pyvo.astropy_samp import SAMPIntegratedClient >>> client = SAMPIntegratedClient() >>> client.connect() @@ -128,9 +128,9 @@ And we instantiate it: >>> r = Receiver(client) We can now use the -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.bind_receive_call` +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.bind_receive_call` and -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.bind_receive_notification` +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.bind_receive_notification` methods to tell our receiver to listen to all ``table.load.votable`` messages:: >>> client.bind_receive_call("table.load.votable", r.receive_call) @@ -178,7 +178,7 @@ reads the table once it has:: import time - from astropy.samp import SAMPIntegratedClient + from pyvo.astropy_samp import SAMPIntegratedClient from astropy.table import Table # Instantiate the client and connect to the hub @@ -236,7 +236,7 @@ make use of the |SAMPIntegratedClient| class. Once Aladin or DS9 are open, first instantiate a |SAMPIntegratedClient| instance and then connect to the hub as before:: - >>> from astropy.samp import SAMPIntegratedClient + >>> from pyvo.astropy_samp import SAMPIntegratedClient >>> client = SAMPIntegratedClient() >>> client.connect() @@ -264,10 +264,10 @@ Finally, we can broadcast this to all clients that are listening for >>> client.notify_all(message) As for `Sending a Table to TOPCAT and DS9`_, the -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify_all` +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.notify_all` method will broadcast the image to all listening clients, and for tables it is possible to instead use the -:meth:`~astropy.samp.integrated_client.SAMPIntegratedClient.notify` method +:meth:`~pyvo.astropy_samp.integrated_client.SAMPIntegratedClient.notify` method to send it to a specific client. Once finished, we should make sure we disconnect from the hub:: diff --git a/docs/astropy_samp/index.rst b/docs/astropy_samp/index.rst index a077f10d3..1037f3f63 100644 --- a/docs/astropy_samp/index.rst +++ b/docs/astropy_samp/index.rst @@ -4,11 +4,13 @@ .. _vo-samp: -************************************************************* -SAMP (Simple Application Messaging Protocol) (`astropy.samp`) -************************************************************* +******************************************** +SAMP (Simple Application Messaging Protocol) +******************************************** -`astropy.samp` is a Python implementation of the SAMP messaging system. +.. note:: `astropy.samp` is now `pyvo.astropy_samp`. + +`pyvo.astropy_samp` is a Python implementation of the SAMP messaging system. Simple Application Messaging Protocol (SAMP) is an inter-process communication system that allows different client programs, usually running on the same @@ -19,7 +21,7 @@ desktop astronomy tools, including `TOPCAT `_, `SAO DS9 `_, and `Aladin `_. -So by using the classes in `astropy.samp`, Python code can interact with +So by using the classes in `pyvo.astropy_samp`, Python code can interact with other running desktop clients, for instance displaying a named FITS file in DS9, prompting Aladin to recenter on a given sky position, or receiving a message identifying the row when a user highlights a plotted point in TOPCAT. @@ -29,14 +31,14 @@ local host, and then various client programs can connect to it. Once connected, these clients can send messages to each other via the hub. The details are described in the `SAMP standard `_. -`astropy.samp` provides classes both to set up such a hub process, and to +`pyvo.astropy_samp` provides classes both to set up such a hub process, and to help implement a client that can send and receive messages. It also provides a stand-alone program ``samp_hub`` which can run a persistent hub in its own process. Note that setting up the hub from Python is not always necessary, since various other SAMP-aware applications may start up a hub independently; in most cases, only one running hub is used during a SAMP session. -The following classes are available in `astropy.samp`: +The following classes are available in `pyvo.astropy_samp`: * |SAMPHubServer|, which is used to instantiate a hub server that clients can then connect to. @@ -47,7 +49,7 @@ The following classes are available in `astropy.samp`: * |SAMPIntegratedClient|, which is the same as |SAMPClient| except that it has a self-contained |SAMPHubProxy| to provide a simpler user interface. -`astropy.samp` is a full implementation of `SAMP V1.3 +`pyvo.astropy_samp` is a full implementation of `SAMP V1.3 `_. As well as the Standard Profile, it supports the Web Profile, which means that it can be used to also communicate with web SAMP clients; see the `sampjs @@ -55,8 +57,8 @@ communicate with web SAMP clients; see the `sampjs .. _IVOA Simple Application Messaging Protocol: http://www.ivoa.net/documents/latest/SAMP.html -Using `astropy.samp` -==================== +Using `pyvo.astropy_samp` +========================= .. toctree:: :maxdepth: 2 @@ -66,15 +68,10 @@ Using `astropy.samp` example_clients advanced_embed_samp_hub -.. note that if this section gets too long, it should be moved to a separate - doc page - see the top of performance.inc.rst for the instructions on how to do - that -.. include:: performance.inc.rst - Reference/API ============= -.. automodapi:: astropy.samp +.. automodapi:: pyvo.astropy_samp Acknowledgments =============== diff --git a/docs/astropy_samp/performance.inc.rst b/docs/astropy_samp/performance.inc.rst deleted file mode 100644 index baef1348f..000000000 --- a/docs/astropy_samp/performance.inc.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. note that if this is changed from the default approach of using an *include* - (in index.rst) to a separate performance page, the header needs to be changed - from === to ***, the filename extension needs to be changed from .inc.rst to - .rst, and a link needs to be added in the subpackage toctree - -.. _astropy-samp-performance: - -.. Performance Tips -.. ================ -.. -.. Here we provide some tips and tricks for how to optimize performance of code -.. using `astropy.samp`. diff --git a/docs/astropy_samp/references.txt b/docs/astropy_samp/references.txt index 3ed35c793..4a94c6af4 100644 --- a/docs/astropy_samp/references.txt +++ b/docs/astropy_samp/references.txt @@ -1,5 +1,5 @@ -.. |SAMPClient| replace:: :class:`~astropy.samp.SAMPClient` -.. |SAMPIntegratedClient| replace:: :class:`~astropy.samp.SAMPIntegratedClient` -.. |SAMPHubServer| replace:: :class:`~astropy.samp.SAMPHubServer` -.. |SAMPHubProxy| replace:: :class:`~astropy.samp.SAMPHubProxy` -.. |SAMPMsgReplierWrapper| replace:: :class:`~astropy.samp.SAMPMsgReplierWrapper` +.. |SAMPClient| replace:: :class:`~pyvo.astropy_samp.SAMPClient` +.. |SAMPIntegratedClient| replace:: :class:`~pyvo.astropy_samp.SAMPIntegratedClient` +.. |SAMPHubServer| replace:: :class:`~pyvo.astropy_samp.SAMPHubServer` +.. |SAMPHubProxy| replace:: :class:`~pyvo.astropy_samp.SAMPHubProxy` +.. |SAMPMsgReplierWrapper| replace:: :class:`~pyvo.astropy_samp.SAMPMsgReplierWrapper`