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

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)
SampProxy.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.
SampProxy.debug = 0
SampProxy.disconnect()
SampProxy.echo(senderid, messageid, message)

Prints the message.

SampProxy.fixReceiverID(receiverid)
SampProxy.getClients()
SampProxy.getLockFile()

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

SampProxy.getMetaData(receiverid)
SampProxy.getNumberOfTables()
SampProxy.getRegisteredClients()
SampProxy.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

SampProxy.getTable(tableid)
SampProxy.highlight(tableid, row)

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

SampProxy.highlighted(tableid=None)

returns the latest highlighted sources from table tableid

SampProxy.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

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

Handler for calls from the SAMP Hub.

SampProxy.receiveNotification(secret, senderid, message)

Handler for notifications from the SAMP Hub.

SampProxy.receiveResponse(secret, responderid, messagetag, response)

Handler for responses from the SAMP Hub.

SampProxy.register(force=False)

Registers with the HUB.

TODO: Integrate this functionality with connect()?

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

Converts the data to a samp version

SampProxy.select(tableid, rowlist)

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

SampProxy.selected(tableid=None)

returns the latest highlighted sources from table tableid

SampProxy.settingsHub = None
SampProxy.showed(tableid=None)

Deprecated, use selected().

SampProxy.shown(tableid=None)

Deprecated, use selected().

SampProxy.simple(sender, message, args)

Returns information.

SampProxy.startHub()

Starts a new Hub. Not implemented.

SampProxy.subscriptions = {'samp.app.event.subscriptions': <function SampProxy.echo at 0x7f61fdef7378>, 'coord.pointAt.sky': <function SampProxy.echo at 0x7f61fdef7378>, 'table.select.rowList': <function SampProxy.table_select_rowList at 0x7f61fdef7f28>, 'samp.msg.progress': <function SampProxy.echo at 0x7f61fdef7378>, 'samp.app.event.shutdown': <function SampProxy.echo at 0x7f61fdef7378>, 'table.highlight.row': <function SampProxy.table_highlight_row at 0x7f61fdef7ea0>, 'image.load.fits': <function SampProxy.echo at 0x7f61fdef7378>, 'samp.app.ping': <function SampProxy.echo at 0x7f61fdef7378>, 'samp.app.status': <function SampProxy.echo at 0x7f61fdef7378>, 'table.load.fits': <function SampProxy.table_load_fits at 0x7f61fdee50d0>, 'samp.app.event.metadata': <function SampProxy.echo at 0x7f61fdef7378>, 'table.load.votable': <function SampProxy.table_load_votable at 0x7f61fdee5048>, 'samp.app.event.register': <function SampProxy.echo at 0x7f61fdef7378>, 'samp.app.event.unregister': <function SampProxy.echo at 0x7f61fdef7378>}
SampProxy.table_highlight_row(senderid, messageid, message)
SampProxy.table_load_fits(senderid, messageid, message)
SampProxy.table_load_votable(senderid, messageid, message)
SampProxy.table_select_rowList(senderid, messageid, message)
SampProxy.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