hpparvi / MuSCAT2_transit_pipeline

MuSCAT2 transit analysis pipeline
GNU General Public License v3.0
5 stars 0 forks source link

ta.plot_fit() fails when single band is only available #17

Closed jpdeleon closed 5 years ago

jpdeleon commented 5 years ago

Hi Hannu,

We have one TOI dataset that has only g-band data available. After optimization, ta.plot_fit('de') failed because the figure axes expect single index instead of a tuple, it seems. May be a work around is to flatten the axes when there is only a single band to plot. Same error occurs for other plotting methods such as ta.plot_final_fit()

--------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-19-99f3968dcbc5> in <module>
----> 1 fig = ta.plot_fit('de');

~/github/MuSCAT2_transit_pipeline/muscat2ta/tfopanalysis.py in plot_fit(self, model, figsize, save, plot_priors)
    295 
    296     def plot_fit(self, model: str = 'de', figsize: tuple = (13, 8), save=False, plot_priors=True):
--> 297         fig, axs = self.lpf.plot_light_curves(model=model, figsize=figsize)
    298         npb = self.lpf.npb
    299         if plot_priors:

~/github/MuSCAT2_transit_pipeline/muscat2ta/m2lpf.py in plot_light_curves(self, model, figsize, fig, gridspec, ylim_transit, ylim_residuals, bin_width)
    653         for i, sl in enumerate(self.lcslices):
    654             t = self.timea[sl]
--> 655             axs[1, i].plot(t, self.ofluxa[sl], '.', alpha=0.5)
    656             axs[1, i].plot(t, fm[0][sl], 'k', lw=2)
    657             axs[2, i].plot(t, self.ofluxa[sl] / bl[0][sl], '.', alpha=0.5)

IndexError: too many indices for array
hpparvi commented 5 years ago

Fixed.