def get(self, paramlist=None): """ :param paramlist: command parameters (documented in the ds9 ref manual) :rtype: returned data or info (as a string) Once a DS9 object has been initialized, use 'get' to retrieve data from ds9 by specifying the standard xpa paramlist:: >>> d.get("file") '/home/eric/python/ds9/test.fits' >>> d.get("fits height") '15' >>> d.get("fits width") '15' >>> d.get("fits bitpix") '32' Note that all access points return data as python strings. """ self._selftest() x = xpa.xpaget(self.id, paramlist, 1) if len(x) > 0: if not paramlist in self._nostrip: x[0] = x[0].strip() return x[0] else: return x
def get(self, paramlist=None, decode=None): """ :param paramlist: command parameters (documented in the ds9 ref manual) :param decode: decode the output; if ``None`` decodes the output if ``paramlist`` is not present in the list ``ds9Globals['bin_cmd']`` :rtype: returned data or info (as a string or byte string) Once a DS9 object has been initialized, use 'get' to retrieve data from ds9 by specifying the standard xpa paramlist:: >>> d.get("file") '/home/eric/python/ds9/test.fits' >>> d.get("fits height") '15' >>> d.get("fits width") '15' >>> d.get("fits bitpix") '32' Note that all access points return data as python strings. """ self._selftest() # convert to byte string in python3 x = xpa.xpaget(string_to_bytes(self.id), string_to_bytes(paramlist), 1) if decode is None: decode = paramlist not in ds9Globals['bin_cmd'] if decode: x = bytes_to_string(x) if len(x) > 0: if paramlist not in self._nostrip: x[0] = x[0].strip() return x[0] else: return x