astro.services.samp package

Submodules

astro.services.samp.DotExport module

Creating a dot/graphiz image from an ‘export’ dictionary.

class astro.services.samp.DotExport.DotExport

Bases: object

debug = 1
fnbase = 'collection'
fontsizenodes = 12.0
get_id(obj)

Returns the id of an object.

get_properties_by_name(obj, propname, exact=False)
get_property_value(obj, propname, exact=False, default=None)
graph(objprop)
graph_from_object(obj)

Creates the graph from an object

graph_from_property(prop)

Creates the graph from a property. It is more logical to have a property then an object. A property describes what role an object has.

otherobjects = None
parse_dot()
parse_object(obj, level=0)
parse_sourcecollection(obj, level=0)
print_info()
processparameters = None
scclasses = ['SourceCollection', 'SelectAttributes', 'SelectSources', 'FilterSources', 'RenameAttributes', 'RelabelSources', 'ConcatenateAttributes', 'ConcatenateSources', 'SourceListWrapper', 'External', 'Pass', 'AttributeCalculator']
sourcecollections = None
sourcelists = None
write_dot()

astro.services.samp.Samp module

class astro.services.samp.Samp.Samp(register=True, start_hub=False)

Bases: astro.services.samp.SampProxy.SampProxy

Samp class for Astro-WISE, used in combination with the SampProxy class.

broadcast(obj)

Broadcast an object over SAMP.

broadcastCatalog(obj, filename=None, tableid=None, name=None)

Broadcast a Catalog (such as PhotSrcCatalog).

broadcastFrame(frame)

Broadcast a frame as a FITS image.

broadcastSourceCollection(sc, filename=None, tableid=None, name=None)

Broadcast a SourceCollection.

broadcastSourceCollection_in_parts(sourcecollection)

Experimental code to broadcast a SourceCollection in parts. Used with Query Driven Visualization it Orange.

broadcastSourceList(sl, filename=None, tableid=None, name=None)

Broadcast a SourceList, the SL is converted to a VOTable first.

broadcastTableConverter(tc, filename=None, tableid=None, name=None)

Broadcast a TableConverter object.

catalog_derive(senderid, messageid, message)
catalog_derive_otf(senderid, messageid, message)

Derive a new catalog from the given SourceCollection.

This function uses the OnTheFly to create the new dependency graph.

catalog_derive_sct(senderid, messageid, message)

Derive a new catalog from the given SourceCollection.

This function uses the SourceCollectionTree to create the new dependency graph. At some point this function should be replaced by catalog_derive_otf() which uses the OnTheFly classes.

TODO MT L: [SAMP] Move some of this into the SCT.

catalog_pull(senderid, messageid, message)

Derive a new catalog from the given SourceCollection and send it over SAMP. The new catalog is only made() if the .auto_make_on_pull is set.

debug = 0
highlightSource(tableid, slid, sid)

Highlights a source in other SAMP applications.

highlight_sourcecollection(sc=None)

Highlight a SourceCollection.

highlightedSource(tableid=None)

Returns the latest highlighted sources from table tableid.

The default is to use the tableid from the last highlight message.

message(message, level=1)

Overloaded from base SampProxy to relay messages to the Message class.

metadata = {'author.affiliation': 'Kapteyn Astronomical Institute, Groningen', 'author.email': 'buddel@astro.rug.nl', 'author.name': 'Hugo Buddelmeijer', 'home.page': 'http://www.astro-wise.org', 'samp.description.html': '<p>Astro-WISE</p>', 'samp.description.text': 'Astro-WISE.', 'samp.documentation.url': 'http://www.astro-wise.org', 'samp.icon.url': 'http://www.astro-wise.org/pics/logo-samp-astrowise.png', 'samp.name': 'Astro-WISE'}
object_action(senderid, messageid, message)

Performs an action of an object. Possible actions are given by the get_export() function of the object.

Most actions are handled by the object itself through its action() function. Some are handled by the Samp instance.

Currently only applicable for SourceCollections in the managed tree.

object_change(senderid, messageid, message)

Change a property of a transient object. Eligable properties are given by the get_export() function of the object.

Most changes are handled by the object itself through its change() function. Some are handled by the Samp instance.

Currently only applicable for SourceCollections in the managed tree.

object_highlight(senderid, messageid, message)

Highlight a specific object.

Currently only applicable to SourceCollections.

object_info(senderid, messageid, message)

Sends information about an object.

The information is provided by the get_export() function of the object.

Currently only implemented for SourceCollection.

python_execute(senderid, messageid, message)

Executes a Python command over Samp. Disabled by default.

run()
sampid_from_slidsid(tableid, slid, sid)

Converts a SLID-SID combination to a SAMP row identifier.

selectSources(tableid, slids, sids)

Selects sources in other SAMP applications.

selectedSource(tableid=None)
selectedSources(tableid=None)

Returns the latest selected sources from table tableid.

The default is to use the tableid from the last select message.

set_highlighted_sourcecollection(sc=None)

Deprecated, use highlight_sourcecollection().

set_highlightedsc(sc=None)

Deprecated, use highlight_sourcecollection().

slidsid_from_sampid(tableid, sampid)

Converts a SAMP row identifier to a SLID-SID combination.

start_hub()

Starts a SAMP HUB by starting TOPCAT.

subscriptions = {'catalog.derive': <function Samp.catalog_derive at 0x7f93176b6840>, 'catalog.pull': <function Samp.catalog_pull at 0x7f93176b67b8>, 'coord.pointAt.sky': <function SampProxy.echo at 0x7f93176b4b70>, 'image.load.fits': <function SampProxy.echo at 0x7f93176b4b70>, 'object.action': <function Samp.object_action at 0x7f93176b6a60>, 'object.change': <function Samp.object_change at 0x7f93176b69d8>, 'object.highlight': <function Samp.object_highlight at 0x7f93176b6b70>, 'object.info': <function Samp.object_info at 0x7f93176b6ae8>, 'samp.app.event.metadata': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.register': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.shutdown': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.subscriptions': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.unregister': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.ping': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.status': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.msg.progress': <function SampProxy.echo at 0x7f93176b4b70>, 'table.highlight.row': <function SampProxy.table_highlight_row at 0x7f93176b5730>, 'table.load.fits': <function SampProxy.table_load_fits at 0x7f93176b58c8>, 'table.load.votable': <function SampProxy.table_load_votable at 0x7f93176b5840>, 'table.select.rowList': <function SampProxy.table_select_rowList at 0x7f93176b57b8>, 'target.catalog.derive': <function Samp.catalog_derive at 0x7f93176b6840>, 'target.catalog.pull': <function Samp.catalog_pull at 0x7f93176b67b8>, 'target.object.action': <function Samp.object_action at 0x7f93176b6a60>, 'target.object.change': <function Samp.object_change at 0x7f93176b69d8>, 'target.object.highlight': <function Samp.object_highlight at 0x7f93176b6b70>, 'target.object.info': <function Samp.object_info at 0x7f93176b6ae8>}
table_load_votable(senderid, messageid, message)

This function is called when table.load.votable message is called.

It is overloaded from SampProxy in order to catch messages from the dbviewer.

tempFileDir = '/builds/omegacen/astro/docs/'

astro.services.samp.SampProxy module

class astro.services.samp.SampProxy.SampProxy(register=True)

Bases: astro.services.samp.ThreadXMLRPC.ThreadXMLRPC

A Python Samp Proxy.

broadcastFitsTable

Make sure that the specified filename is a correct uri.

broadcastImage

Make sure that the specified filename is a correct uri.

broadcastVOTable

Make sure that the specified filename is a correct uri.

call(receiverid, message)
callAll(message)

Send the message, and store it etc.

callAndWait(receiverid, message, timeout=20)
class checkFilename(f)

Bases: object

Make sure that the specified filename is a correct uri.

remove_special_characters(filename)
connect(force=False)

Connects to the Hub and returns the connection.

TODO: This function actually doesn’t do anything. Perhaps
register() and connect() should be integrated.
debug = 0
disconnect()
echo(senderid, messageid, message)

Prints the message.

fixReceiverID(receiverid)
getClients()
getLockFile()

Tries to find the SAMP lockfile. Stub function, not yet implemented properly.

getMetaData(receiverid)
getNumberOfTables()
getRegisteredClients()
getSettingsHub(lockfile='~/.samp', silent=False)

Determines the address of the hub from the user’s home directory. example ~/.samp file:

# SAMP Standard Profile lockfile written Thu Mar 12 11:08:03 CET 2009 samp.secret=d721c2f7bc9a109 samp.hub.xmlrpc.url=http://127.0.0.1:40604/xmlrpc samp.profile.version=1.1 hub.impl=org.astrogrid.samp.hub.BasicHubService hub.start.date=Thu Mar 12 11:08:03 CET 2009

getTable(tableid)
highlight(tableid, row)

Send the ‘table.highlight.row’ message. row should be an int, 0-indexed.

highlighted(tableid=None)

returns the latest highlighted sources from table tableid

hub

xmlrpclib.make_connection() is not thread safe since Python 2.7 Therefore we start a new connection every time.

http://stackoverflow.com/questions/9691938/qthreads-and-xmlrpc-client http://bugs.python.org/issue6907

infoRegistration = None
load_tables = True
metadata = {'author.affiliation': 'Kapteyn Astronomical Institute, Groningen', 'author.email': 'buddel@astro.rug.nl', 'author.name': 'Hugo Buddelmeijer', 'home.page': 'http://www.astro-wise.org', 'samp.description.html': '<p>Python client of SAMP standard profile.</p>', 'samp.description.text': 'Python client of SAMP standard profile.', 'samp.documentation.url': 'http://www.astro-wise.org', 'samp.icon.url': 'http://www.astro-wise.org/pics/logo-samp-proxy.png', 'samp.name': 'Python Samp Proxy', 'sampproxy.version': '0.1'}
notify(receiverid, message)
pointAtSky(ra, dec)
quit()
quitrpc()
receiveCall(secret, senderid, messageid, message)

Handler for calls from the SAMP Hub.

receiveNotification(secret, senderid, message)

Handler for notifications from the SAMP Hub.

receiveResponse(secret, responderid, messagetag, response)

Handler for responses from the SAMP Hub.

register(force=False)

Registers with the HUB.

TODO: Integrate this functionality with connect()?

registerFunctions()
reply(msgid, reply)
sampdata(data)

Converts the data to a samp version

select(tableid, rowlist)

Send the ‘table.select.rowList’ message. rowlist is a list of ints, 0-indexed.

selected(tableid=None)

returns the latest highlighted sources from table tableid

settingsHub = None
showed(tableid=None)

Deprecated, use selected().

shown(tableid=None)

Deprecated, use selected().

simple(sender, message, args)

Returns information.

startHub()

Starts a new Hub. Not implemented.

subscriptions = {'catalog.derive': <function Samp.catalog_derive at 0x7f93176b6840>, 'catalog.pull': <function Samp.catalog_pull at 0x7f93176b67b8>, 'coord.pointAt.sky': <function SampProxy.echo at 0x7f93176b4b70>, 'image.load.fits': <function SampProxy.echo at 0x7f93176b4b70>, 'object.action': <function Samp.object_action at 0x7f93176b6a60>, 'object.change': <function Samp.object_change at 0x7f93176b69d8>, 'object.highlight': <function Samp.object_highlight at 0x7f93176b6b70>, 'object.info': <function Samp.object_info at 0x7f93176b6ae8>, 'samp.app.event.metadata': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.register': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.shutdown': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.subscriptions': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.event.unregister': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.ping': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.app.status': <function SampProxy.echo at 0x7f93176b4b70>, 'samp.msg.progress': <function SampProxy.echo at 0x7f93176b4b70>, 'table.highlight.row': <function SampProxy.table_highlight_row at 0x7f93176b5730>, 'table.load.fits': <function SampProxy.table_load_fits at 0x7f93176b58c8>, 'table.load.votable': <function SampProxy.table_load_votable at 0x7f93176b5840>, 'table.select.rowList': <function SampProxy.table_select_rowList at 0x7f93176b57b8>, 'target.catalog.derive': <function Samp.catalog_derive at 0x7f93176b6840>, 'target.catalog.pull': <function Samp.catalog_pull at 0x7f93176b67b8>, 'target.object.action': <function Samp.object_action at 0x7f93176b6a60>, 'target.object.change': <function Samp.object_change at 0x7f93176b69d8>, 'target.object.highlight': <function Samp.object_highlight at 0x7f93176b6b70>, 'target.object.info': <function Samp.object_info at 0x7f93176b6ae8>}
table_highlight_row(senderid, messageid, message)
table_load_fits(senderid, messageid, message)
table_load_votable(senderid, messageid, message)
table_select_rowList(senderid, messageid, message)
unregister()

Unregister from the Hub.

astro.services.samp.SampProxy.TimeoutServerProxy(url, *args, **kwargs)
class astro.services.samp.SampProxy.TimeoutTransport(timeout, use_datetime=0)

Bases: xmlrpc.client.Transport

make_connection(host)

astro.services.samp.ThreadXMLRPC module

class astro.services.samp.ThreadXMLRPC.ThreadXMLRPC(port=9200, host=None, retries=100)

Bases: threading.Thread

Class that starts a threading XML-RPC server, in order to use in interactive python shell.

debug = 0
finished = False
message(message, level=1)
quit()

Stops the XML-RPC server, to be called from python

quitrpc()

Stops the XML-RPC server, to be called through XML-RPC

registerFunctions()

Registers functions, called from __init__, override this when inheriting from this class

register_function(function, name)

Wrapper for self.server.register_function to make it more transparent.

run()

Let the XML-RPC server handle requests until finished

server = None
serving = False
startServer(port, host, retries)

Starts the XML-RPC server, returns the portnumber used.

astro.services.samp.testexport module

Module contents