def send(self, k, data, to='All'): """ Broadcast data to one or all applications """ if k[-5:]!='.fits': k+='.fits' if isinstance(data, mytables.Table): data.write(k, append=False, clobber=True) else: mytables.Table(data).write(k, append=False, clobber=True) self.tables[k] = { 'name':k, 'url': 'file://' + os.getcwd() + '/' + k, 'data': mytables.load(k) } return self._broadcastTable(k)
def get(self, k): """ get table """ if k in self.tables: cTab = self.tables[k] if cTab['data'] == None: u = urllib.urlretrieve(cTab['url']) cTab['data'] = data = mytables.load(u[0]) return data else: return cTab['data'] if k in self.images: cTab = self.images[k] if cTab['data'] == None: cTab['data'] = data = mytables.pyfits.getdata(cTab['image-id']) return data else: return cTab['data']