sblunt/orbitize

AttributeError: 'NoneType' object has no attribute 'to_standard_basis' when trying to plot orbits from a loaded posterior from hdf5 file

Closed this issue · 3 comments

When loading a posterior saved via the results.save_results(savefile) method, using:

from orbitize import results
loaded_results = results.Results() # Create blank results object for loading
loaded_results.load_results(hdf5_filename) 

and then attempting to plot an orbit using loaded_results.plot_orbits(), I get the following error/traceback


AttributeError Traceback (most recent call last)
1 # epochs = outtable['epoch']
----> 2 orb_fig = loaded_results.plot_orbits(
3 object_to_plot = 1, # Plot orbits for the first (and only, in this case) companion
4 num_orbits_to_plot= 500, # Will plot 100 randomly selected orbits of this companion
5 start_mjd=Time(2011., format='decimalyear').mjd, # Minimum MJD for colorbar (here we choose first data epoch)

~/orbitize/orbitize/results.py in plot_orbits(self, object_to_plot, start_mjd, num_orbits_to_plot, num_epochs_to_plot, square_plot, show_colorbar, cmap, sep_pa_color, sep_pa_end_year, cbar_param, mod180, rv_time_series, plot_astrometry, plot_astrometry_insts, plot_astrometry_insts_leg, fig, astr_colors, astr_symbols, no_cbar)
544 orb_ind = choose[i]
545 param_set = np.copy(self.post[orb_ind])
--> 546 standard_post.append(self.basis.to_standard_basis(param_set))
547 else: # For OFTI, posteriors are already converted
548 for i in np.arange(num_orbits_to_plot):

AttributeError: 'NoneType' object has no attribute 'to_standard_basis'

The hdf5 file was generated on version '2.0b1' on a linux machine, whatever is on pip currently is what I installed. I'm attempting to read the posterior and plot it on a mac.

Is there a quick fix for something like this?

Hey William, thanks for the bug report! I wasn't able to reproduce this error on my machine-- can you verify two things to help me figure it out?

  1. Run the quick start tutorial using v2.0b1, save that result, then try to load it in your current installation. Does that work?
  2. Is your current installation up to date (i.e. v2.0), or are you still using v2.0b1?

It looks like I wasn't up-to-date, ugh, sorry about that. now that I updated, I can't reproduce this particular bug either. I'm getting something new, but I'll open a separate issue for that since it appears unrelated.

No worries at all, thanks for posting anyway! It's really good to have a searchable index of solutions for problems like this! :)