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

Create dot/graphiz image from a SourceCollection export.

debug = 1
dot_from_sourcecollection(obj)

Create dot string from Sourcecollection Export.

fnbase = 'collection'
fontsizenodes = 12.0
static get_id(obj)

Returns the id of an object.

static get_properties_by_name(obj, propname, exact=False)
get_property_value(obj, propname, exact=False, default=None)

Get property value.

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()

Generate an svg

parse_object(obj, level=0)

Parse an object.

parse_sourcecollection(obj, level=0)

Parse SourceCollection.

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.DotExport.main()

Create test export.

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.

static 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 = False
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 = {'coord.pointAt.sky': <function SampProxy.echo at 0x7fba23746488>, 'image.load.fits': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.event.metadata': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.event.register': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.event.shutdown': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.event.subscriptions': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.event.unregister': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.ping': <function SampProxy.echo at 0x7fba23746488>, 'samp.app.status': <function SampProxy.echo at 0x7fba23746488>, 'samp.msg.progress': <function SampProxy.echo at 0x7fba23746488>, 'table.highlight.row': <function SampProxy.table_highlight_row at 0x7fba23747048>, 'table.load.fits': <function SampProxy.table_load_fits at 0x7fba237471e0>, 'table.load.votable': <function SampProxy.table_load_votable at 0x7fba23747158>, 'table.select.rowList': <function SampProxy.table_select_rowList at 0x7fba237470d0>}
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