jacopo-chevallard / PyP-BEAGLE

4 stars 1 forks source link

TypeError: 'AxesSubplot' object has no attribute '__getitem__' #28

Closed MarcoCast79 closed 6 years ago

MarcoCast79 commented 7 years ago

Hi,

I fitted a spectrum and wanted to create the marginal plot with pyp_beagle 0.5.6 with a simple call:

pyp_beagle -r /home/marco/BEAGLE/BEAGLE-general/results/fit_allparam_speconly/ --plot-marginal

but I get the following error:

Traceback (most recent call last): File "/home/marco/anaconda2/bin/pyp_beagle", line 11, in sys.exit(main()) File "/home/marco/anaconda2/lib/python2.7/site-packages/pyp_beagle/command_line.py", line 228, in main my_spectrum.plot_marginal(ID, file_names[i]) File "/home/marco/anaconda2/lib/python2.7/site-packages/pyp_beagle/beagle_spectra.py", line 400, in plotmarginal axs = axs[0,:] TypeError: 'AxesSubplot' object has no attribute 'getitem'

With pyp_beagle 0.4 I had no problems and the marginal plot was created (but there was no autoscale of the spectrum plot)

I have no problems with the triangle plot.

Do I have to upgrade something? Is there something wrong with my configuration? Thanks!

jacopo-chevallard commented 7 years ago

Which version of matplotlib are you using?

MarcoCast79 commented 7 years ago

I'm using matplotlib 2.0.0

jacopo-chevallard commented 6 years ago

@MarcoCast79 the fix in https://github.com/jacopo-chevallard/PyP-BEAGLE/issues/29 didn't solve this issue for you?

MarcoCast79 commented 6 years ago

actually not, I'm getting a different error though

likely I'm doing some mistake myself, here is the command following Alba's comment:

pyp_beagle -r /node4/data1/beagle/BEAGLE-general/results/fit_VANDELS_CDFS006520_allparam_speconly/ -p fit_VANDELS_CDFS006520_allparam_speconly.param --verbose -d --plot-marginal --wl-units ang --wl-range 3845 3915 4075 4125 4325 4385 4845 4880 4940 5030 5860 5895 6525 6620 6700 6750 --wl-rest --log-flux --show-residual --plot-line-labels --draw-steps

and here is the error:

ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ylim: [inf, -inf] ERROR: ValueError: Axis limits cannot be NaN or Inf [matplotlib.axes._base] ERROR:astropy:ValueError: Axis limits cannot be NaN or Inf Traceback (most recent call last): File "/usr/local/bin/pyp_beagle", line 9, in load_entry_point('pyp-beagle==0.5.6', 'console_scripts', 'pyp_beagle')() File "/usr/local/lib/python2.7/dist-packages/pyp_beagle/command_line.py", line 228, in main my_spectrum.plot_marginal(ID, file_names[i]) File "/usr/local/lib/python2.7/dist-packages/pyp_beagle/beagle_spectra.py", line 655, in plot_marginal ax.set_ylim(ylim) File "/home/beagle/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 3225, in set_ylim bottom = self._validate_converted_limits(bottom, self.convert_yunits) File "/home/beagle/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2836, in _validate_converted_limits raise ValueError("Axis limits cannot be NaN or Inf") ValueError: Axis limits cannot be NaN or Inf

@MarcoCast79 the fix in https://github.com/jacopo-chevallard/PyP-BEAGLE/issues/29 didn't solve this issue for you?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jacopo-chevallard/PyP-BEAGLE/issues/28#issuecomment-349645668

--


Marco Castellano, PhD Postdoctoral Research Associate INAF - Osservatorio Astronomico di Roma marco.castellano@oa-roma.inaf.it Skype: marco_castellano79 Tel: +39 06 94286473


“I don’t like competition very much, and I think the essence of science—what really makes it so much fun—is to do what others aren’t doing, rather than doing what everyone else in the pack is flocking to". Yoshinori Ohsumi, Nobel Prize 2016

jacopo-chevallard commented 6 years ago

I think you must have some negative fluxes somewhere, and so when you try to plot in log scale you get Inf

Try to rerun the command without the —log-flux option

jacopo-chevallard commented 6 years ago

The script doesn't run with a single range of wl (you still get the TypeError: 'AxesSubplot' object has no attribute 'getitem'), you should modify the code to solve this bug!