Skip to content

Error when trying to plot the residual for a full spectroscopic fit #40

@eclake

Description

@eclake

Two errors when using --show-residual for plotting the marginal for a full spectroscopic fit

First error:

Traceback (most recent call last):
  File "/mnt/globalNS/tmp/curtis/bin/pyp_beagle", line 8, in <module>
    sys.exit(main())
  File "/mnt/globalNS/tmp/curtis/lib/python2.7/site-packages/pyp_beagle/command_line.py", line 247, in main
    my_spectrum.plot_marginal(ID, file_names[i])
  File "/mnt/globalNS/tmp/curtis/lib/python2.7/site-packages/pyp_beagle/beagle_spectra.py", line 419, in plot_marginal
    axs = axs_[0,:]
IndexError: too many indices for array

Which I managed to fix by changing these lines to read

        if self.show_residual:
            print axs_.shape
            axs = axs_[0]
        else:
            axs = axs_

        if self.show_residual:
            residual_axs = axs_[1]

instead.

When I was trying to add the residual to the output spectrum marginal plot, I got the following error

(2,)
/mnt/globalNS/tmp/curtis/lib/python2.7/site-packages/matplotlib/cbook/deprecation.py:107: MatplotlibDeprecationWarning: Passing one of 'on', 'true', 'off', 'false' as a boolean is deprecated; use an actual boolean (True/False) instead.
  warnings.warn(message, mplDeprecation, stacklevel=1)
Traceback (most recent call last):
  File "/mnt/globalNS/tmp/curtis/bin/pyp_beagle", line 8, in <module>
    sys.exit(main())
  File "/mnt/globalNS/tmp/curtis/lib/python2.7/site-packages/pyp_beagle/command_line.py", line 247, in main
    my_spectrum.plot_marginal(ID, file_names[i])
  File "/mnt/globalNS/tmp/curtis/lib/python2.7/site-packages/pyp_beagle/beagle_spectra.py", line 691, in plot_marginal
    residual = (data_flux_-median_flux)/data_flux_
ValueError: operands could not be broadcast together with shapes (33,) (940,)

If I changed these lines to read

            data_flux_ = data_flux[np.isclose(data_wl, model_wl, rtol=1e-6, atol=0.0, equal_nan=False)]
            data_mask_ = data_mask[np.isclose(data_wl, model_wl, rtol=1e-6, atol=0.0, equal_nan=False)]
            data_flux_err_ = data_flux_err[np.isclose(data_wl, model_wl, rtol=1e-6, atol=0.0, equal_nan=False)]

instead, it worked.

The example I was running pyp-beagle on is on neogal at /mnt/globalNS/tmp/curtis/BEAGLE_workdir/results/NIRCam_NIRSpec_data_challenge_1/fit_R100_photom_poly_1_7340_test/

Happy to put together a pull request for these fixes if they look right!

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions