sblunt / orbitize

Orbit-fitting for directly imaged objects
https://orbitize.info
Other
74 stars 43 forks source link

Epochs of data gets shuffled in plot_orbits in some cases of mixed quant_type #314

Closed gotten closed 2 years ago

gotten commented 2 years ago

Related to #311

When plotting the datapoints with plot_orbits the Epochs of the input data overplotted in the plots are shuffled depending on the mix and order of the quant_types in the input file. The data is in all cases correctly read from the input file and correctly processed by the MCMC code but the logic to plot it in some cases of mixed radec and seppa shuffles their order with respect to the data epoch array.

Inside the plotting code plot.py (line 336-363) the seppa values are retained in SEP_DATA and PA_DATA, while radec values are converted to seppa. These are then not replaced at their positions, but appended to the SEP_DATA and PA_DATA array, which shuffles their order with respect to the order used in data['epoch']. A solution would be to apply the same operations to the Epoch and Instruments. In any case the epoch and instruments fed into the plots need to match the data. (did not check if RV etc. has a similar issue)

This bug will not occur if the order of the input file is SEPPA data first and RADEC last.

Running the latest 'main' branch pulled from github.

Here are two plots with data directly overplotted from the input files as well. The green datapoint is in RADEC and first in the order of the input file. The other data is in SEPPA. The clean plot (purple stars on top of squares) only has SEPPA as quant_type in the input file.

hd95086_orbit_mcmc_1647279446 hd95086_orbit_mcmc_1647281548

sblunt commented 2 years ago

Addressed in PR #318.