Hi! This is an error I came across recently while running orbitize on one of our lab mac machines. I tried to save a result to disk using the save_results method, but got this error/traceback.
hdf5_filename='test.hdf5'
import os
if os.path.isfile(hdf5_filename):
os.remove(hdf5_filename)
my_driver.sampler.results.save_results(hdf5_filename)
TypeError Traceback (most recent call last)
in
5 if os.path.isfile(hdf5_filename):
6 os.remove(hdf5_filename)
----> 7 my_driver.sampler.results.save_results(hdf5_filename)
/anaconda3/lib/python3.7/site-packages/orbitize/results.py in save_results(self, filename)
145 if self.labels is not None:
146 hf['col_names'] = np.array(self.labels).astype('S')
--> 147 hf.attrs['parameter_labels'] = self.labels # Rob: added this to account for the RV labels
148 if self.num_secondary_bodies is not None:
149 hf.attrs['num_secondary_bodies'] = self.num_secondary_bodies
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
/anaconda3/lib/python3.7/site-packages/h5py/_hl/attrs.py in __setitem__(self, name, value)
93 use the methods create() and modify().
94 """
---> 95 self.create(name, data=value, dtype=base.guess_dtype(value))
96
97 @with_phil
/anaconda3/lib/python3.7/site-packages/h5py/_hl/attrs.py in create(self, name, data, shape, dtype)
169 # Make HDF5 datatype and dataspace for the H5A calls
170 if use_htype is None:
--> 171 htype = h5t.py_create(original_dtype, logical=True)
172 htype2 = h5t.py_create(original_dtype) # Must be bit-for-bit representation rather than logical
173 else:
h5py/h5t.pyx in h5py.h5t.py_create()
h5py/h5t.pyx in h5py.h5t.py_create()
h5py/h5t.pyx in h5py.h5t.py_create()
TypeError: No conversion path for dtype: dtype('
My fix doesn't appear to actually work because when the labels are called again in plot_corner() after being loaded with load_results() there is another error "TypeError: startswith first arg must be bytes or a tuple of bytes, not str"
So I'm not sure how to approach this problem. Currently seeing if it also appears on my windows machine or if it just happens to the lab mac I was working on. Sorry for the false lead on a fix!
Sorry for the spam, but tried on my windows machine and saving/loading/plot_cornering worked fine. Might be a mac specific bug, or a 'this old and tired lab machine' specific bug. Not urgent if it doesn't appear elsewhere, as I can run from my windows machine for now.
Hey William, thanks for the bug report! Can you try printing out self.labels right before the line your code fails at? It looks like self.labels has something that's not a string for some reason. If you are able to post the code that generates the file you'd like to save, that would be helpful too.
Hi Sarah! Sorry to bother, but I updated that lab computer to a clean install of the newest version and didn't encounter the same problem. It might have been something that was edited on that local install >.< thanks again for the help.
Hi! This is an error I came across recently while running orbitize on one of our lab mac machines. I tried to save a result to disk using the save_results method, but got this error/traceback.
hdf5_filename='test.hdf5' import os if os.path.isfile(hdf5_filename): os.remove(hdf5_filename) my_driver.sampler.results.save_results(hdf5_filename)
TypeError Traceback (most recent call last)
My fix doesn't appear to actually work because when the labels are called again in plot_corner() after being loaded with load_results() there is another error "TypeError: startswith first arg must be bytes or a tuple of bytes, not str"
So I'm not sure how to approach this problem. Currently seeing if it also appears on my windows machine or if it just happens to the lab mac I was working on. Sorry for the false lead on a fix!
Sorry for the spam, but tried on my windows machine and saving/loading/plot_cornering worked fine. Might be a mac specific bug, or a 'this old and tired lab machine' specific bug. Not urgent if it doesn't appear elsewhere, as I can run from my windows machine for now.
Hey William, thanks for the bug report! Can you try printing out self.labels right before the line your code fails at? It looks like self.labels has something that's not a string for some reason. If you are able to post the code that generates the file you'd like to save, that would be helpful too.
Hi Sarah! Sorry to bother, but I updated that lab computer to a clean install of the newest version and didn't encounter the same problem. It might have been something that was edited on that local install >.< thanks again for the help.
Don't be sorry! Thanks for the update. I'll close this issue then, but feel free to reopen if it becomes a problem again.