Skip to content

Instantly share code, notes, and snippets.

@saimn
Created July 4, 2017 14:40
Show Gist options
  • Save saimn/c4d5865e590be2ab348cbc31f30d3005 to your computer and use it in GitHub Desktop.
Save saimn/c4d5865e590be2ab348cbc31f30d3005 to your computer and use it in GitHub Desktop.
pyavm traceback
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-24-80ea1cd1ef6b> in <module>()
5 make_nans_transparent=True, embed_avm_tags=True,
6 vmin_r=vmin, vmin_g=vmin, vmin_b=vmin, vmax_r=vmax, vmax_g=vmax, vmax_b=vmax,
----> 7 stretch_r='sqrt', stretch_g='sqrt', stretch_b='sqrt')
8
9 rgb_name = IMAGE.replace('IMAGE', 'IMAGE_RGB').replace('.fits', '.jpg')
~/miniconda3/lib/python3.6/site-packages/aplpy/rgb.py in make_rgb_image(data, output, indices, vmin_r, vmax_r, pmin_r, pmax_r, stretch_r, vmid_r, exponent_r, vmin_g, vmax_g, pmin_g, pmax_g, stretch_g, vmid_g, exponent_g, vmin_b, vmax_b, pmin_b, pmax_b, stretch_b, vmid_b, exponent_b, make_nans_transparent, embed_avm_tags)
227 if output.lower().endswith(('.jpg', '.jpeg', '.png')):
228 avm = AVM.from_header(header)
--> 229 avm.embed(output, output)
230 else:
231 warnings.warn("AVM tags will not be embedded in RGB image, as only JPEG and PNG files are supported")
~/miniconda3/lib/python3.6/site-packages/pyavm/avm.py in embed(self, filename_in, filename_out, verify)
724
725 # Embed XMP packet into file
--> 726 embed_xmp(filename_in, filename_out, self.to_xmp())
727
728 # Verify file if needed
~/miniconda3/lib/python3.6/site-packages/pyavm/avm.py in to_xmp(self)
713 """
714 packet = b'<?xpacket begin="\xef\xbb\xbf" id="W5M0MpCehiHzreSzNTczkc9d"?>\n'
--> 715 packet += self.to_xml()
716 packet += b'<?xpacket end="w"?>'
717
~/miniconda3/lib/python3.6/site-packages/pyavm/avm.py in to_xml(self)
700 # Need to create a StringIO object to write to
701 s = StringIO()
--> 702 tree.write(s, encoding='utf-8')
703
704 # Rewind and read the contents
~/miniconda3/lib/python3.6/xml/etree/ElementTree.py in write(self, file_or_filename, encoding, xml_declaration, default_namespace, method, short_empty_elements)
774 serialize = _serialize[method]
775 serialize(write, self._root, qnames, namespaces,
--> 776 short_empty_elements=short_empty_elements)
777
778 def write_c14n(self, file):
~/miniconda3/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
87 if type is None:
88 try:
---> 89 next(self.gen)
90 except StopIteration:
91 return
~/miniconda3/lib/python3.6/xml/etree/ElementTree.py in _get_writer(file_or_filename, encoding)
833 # destroyed
834 stack.callback(file.detach)
--> 835 yield file.write
836
837 def _namespaces(elem, default_namespace=None):
~/miniconda3/lib/python3.6/contextlib.py in __exit__(self, *exc_details)
378 # set-up context
379 fixed_ctx = exc_details[1].__context__
--> 380 raise exc_details[1]
381 except BaseException:
382 exc_details[1].__context__ = fixed_ctx
~/miniconda3/lib/python3.6/contextlib.py in __exit__(self, *exc_details)
363 cb = self._exit_callbacks.pop()
364 try:
--> 365 if cb(*exc_details):
366 suppressed_exc = True
367 pending_raise = False
~/miniconda3/lib/python3.6/contextlib.py in _exit_wrapper(exc_type, exc, tb)
312 """
313 def _exit_wrapper(exc_type, exc, tb):
--> 314 callback(*args, **kwds)
315 # We changed the signature, so using @wraps is not appropriate, but
316 # setting __wrapped__ may still help with introspection
TypeError: string argument expected, got 'bytes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment