handler = VSOHandler(client, start, end, timestamp, cadence, layers) return handler # The next cell connects to an active Hub (see http://docs.astropy.org/en/stable/vo/samp/example_table_image.html) # In[ ]: client = SAMPIntegratedClient() client.connect() r = Receiver(client) client.bind_receive_call("jhv.vso.load", r.receive_call) client.bind_receive_notification("jhv.vso.load", r.receive_notification) # ### Downloading the data # When a message is sent over SAMP, run the following to create a new Handler with the parameters given over SAMP. # # A Handler object named handler will be created which offers several utility methods to create a VSOQuery and download the data. # * __handler.createQuerySingleResult()__ # Creates a VSO-Query to only retrieve the currently show images in JHelioviewer for each active Layer # * __handler.createQuery()__ # Creates a VSO-Query for the complete timespan visible in JHelioviewer # * __handler.showQuery()__ # Can be used to check the query result before downloading the actual data # * __handler.downloadData()__ # Downloads the data found by the current query # * __handler.showData(figsize)__ # Downloads and shows the data by the current query
def receive_notification(self, private_key, sender_id, mtype, params, extra): self.params = params self.sender = sender_id self.received = True def reset(self): self.received = False # Instantiate the receiver r = Receiver(client) # Listen for any instructions to load a table client.bind_receive_call("table.load.votable", r.receive_call) client.bind_receive_notification("table.load.votable", r.receive_notification) # We now run the loop to wait for the message in a try/finally block so that if # the program is interrupted e.g. by control-C, the client terminates # gracefully. print("Starting websocket...") websocket.enableTrace(True) ws = websocket.create_connection("ws://{}:{}/ws".format(host, port)) print("Connecting to http://{}".format(host)) webbrowser.open("http://{}:{}".format(host, port)) print("Session started")