VTDA-Group / superphot-plus

Superphot+, upgraded version of Superphot that uses nested sampling
MIT License
10 stars 0 forks source link

plot_sampling_lc_fit calls flux_model with wrong number of arguments #80

Closed hombit closed 1 year ago

hombit commented 1 year ago

While testing and fixing the tutorial notebook in #78 I've found that plot_sampling_lc_fit is outdated:

TypeError                                 Traceback (most recent call last)
Cell In[13], line 5
      2 from IPython import display
      4 for method in ["dynesty", "NUTS", "svi"]:
----> 5     plot_lc_fit(test_sn, OUTPUT_DIR, OUTPUT_DIR, OUTPUT_DIR, method)
      7 display.Image(os.path.join(OUTPUT_DIR, test_sn + "_dynesty.png"))

File ~/superphot-plus/src/superphot_plus/plotting.py:837, in plot_lc_fit(ztf_name, data_dir, fit_dir, out_dir, sampling_method)
    833 lightcurve = Lightcurve.from_file(data_fn)
    835 eq_wt_samples = get_posterior_samples(ztf_name, fit_dir, sampling_method)
--> 837 plot_sampling_lc_fit(
    838     ztf_name,
    839     out_dir,
    840     lightcurve.times,
    841     lightcurve.fluxes,
    842     lightcurve.flux_errors,
    843     lightcurve.bands,
    844     eq_wt_samples,
    845 )

File ~/superphot-plus/src/superphot_plus/plotting.py:903, in plot_sampling_lc_fit(ztf_name, out_dir, tdata, fdata, ferrdata, bdata, eq_wt_samples, sampling_method)
    898 trange_fine = np.linspace(np.amin(tdata), np.amax(tdata), num=500)
    900 for sample in eq_wt_samples[:30]:
    901     plt.plot(
    902         trange_fine,
--> 903         flux_model(sample, trange_fine, ["g"] * len(trange_fine)),
    904         c="g",
    905         lw=1,
    906         alpha=0.1,
    907     )
    908     plt.plot(
    909         trange_fine,
    910         flux_model(sample, trange_fine, ["r"] * len(trange_fine)),
   (...)
    913         alpha=0.1,
    914     )
    916 plt.xlabel("MJD")

TypeError: flux_model() missing 2 required positional arguments: 'ordered_bands' and 'ref_band'
jeremykubica commented 1 year ago

This looks like it was fixed in #87