orbitize icon indicating copy to clipboard operation
orbitize copied to clipboard

Add documentation about fitting planetary RVs

Open sblunt opened this issue 2 years ago • 6 comments

We should document better and add a tutorial about fitting planetary RVs. In particular, should emphasize that pl RV data is assumed to be relative to the barycenter in the current implementation.

sblunt avatar Feb 17 '23 21:02 sblunt

^^ wrong! RV is relative to the star. More reason to make this clear in the documentation.

sblunt avatar Mar 01 '23 23:03 sblunt

Does the sampler.results.plot_orbits() support plotting the planet/companion RVs? I have issues with plotting it with version 2.1.3 (I have no issues with plotting the orbit if I don't include companion RVs)

>>> orbit_plot = betaPic_sampler.results.plot_orbits(start_mjd=betaPic_sampler.system.data_table['epoch'][0], rv_time_series=True)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/var/folders/n5/99sz4kvx3dd1wmcsjdsj9xh00000gn/T/ipykernel_26636/4025753964.py in <module>
----> 1 orbit_plot = betaPic_sampler.results.plot_orbits(start_mjd=betaPic_sampler.system.data_table['epoch'][0], rv_time_series=True)

~/anaconda3/lib/python3.7/site-packages/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_errorbars, fig)
    336             plot_astrometry=plot_astrometry,
    337             plot_astrometry_insts=plot_astrometry_insts,
--> 338             plot_errorbars=plot_errorbars, fig=fig
    339         )
    340 

~/anaconda3/lib/python3.7/site-packages/orbitize/plot.py in plot_orbits(results, 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_errorbars, fig)
    562 
    563             plt.sca(ax1)
--> 564             plt.errorbar(Time(astr_epochs,format='mjd').decimalyear,sep_data,yerr=serr,ms=5, linestyle='',marker='o',c='purple',zorder=2, capsize=2)
    565             plt.sca(ax2)
    566             plt.errorbar(Time(astr_epochs,format='mjd').decimalyear,pa_data,yerr=perr,ms=5, linestyle='',marker='o',c='purple',zorder=2, capsize=2)

~/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py in errorbar(x, y, yerr, xerr, fmt, ecolor, elinewidth, capsize, barsabove, lolims, uplims, xlolims, xuplims, errorevery, capthick, data, **kwargs)
   2522         lolims=lolims, uplims=uplims, xlolims=xlolims,
   2523         xuplims=xuplims, errorevery=errorevery, capthick=capthick,
-> 2524         **({"data": data} if data is not None else {}), **kwargs)
   2525 
   2526 

~/anaconda3/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1412     def inner(ax, *args, data=None, **kwargs):
   1413         if data is None:
-> 1414             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1415 
   1416         bound = new_sig.bind(ax, *args, **kwargs)

~/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_axes.py in errorbar(self, x, y, yerr, xerr, fmt, ecolor, elinewidth, capsize, barsabove, lolims, uplims, xlolims, xuplims, errorevery, capthick, **kwargs)
   3333         x, y = np.atleast_1d(x, y)  # Make sure all the args are iterable.
   3334         if len(x) != len(y):
-> 3335             raise ValueError("'x' and 'y' must have the same size")
   3336 
   3337         if isinstance(errorevery, Integral):

ValueError: 'x' and 'y' must have the same size

<Figure size 1400x600 with 0 Axes>

chihchunhsu avatar Jul 15 '23 00:07 chihchunhsu

@chihchunhsu can you check if the most recent updates to orbitize fix this? we just merged in a bugfix for this onto the main branch

semaphoreP avatar Jul 19 '23 16:07 semaphoreP

I pulled the most recent version 2.2.2 but the issue still persists, unfortunately.

chihchunhsu avatar Jul 19 '23 18:07 chihchunhsu

Is this the most recent version on pip, or did you directly pull the most recent changes on the main branch? We have yet to formally release this version.

semaphoreP avatar Jul 19 '23 18:07 semaphoreP

Ah right. Actually I used the pip version, and it is fixed with the version on github! Thanks for the catch!

chihchunhsu avatar Jul 19 '23 18:07 chihchunhsu