astrofrog / sedfitter

Python version of the SED fitter from Robitaille et al., 2007, ApJS 169 328
http://sedfitter.readthedocs.org
BSD 2-Clause "Simplified" License
20 stars 22 forks source link

ValueError: operands could not be broadcast together with shapes (4,) (200710,31,7) #65

Open cress1234 opened 5 years ago

cress1234 commented 5 years ago

Using the example exactly as in the documentation with the example files (none of my own input data), I get this error. It is flagging this line

>residual = log_flux - model_fluxes

Here is the whole error message:

ValueError                                Traceback (most recent call last)
<ipython-input-3-8bf1c972f8ac> in <module>()
     14 
     15 # Run the fitting
---> 16 fit('sedlist.txt', filters, apertures, model_dir,'output.fitinfo',extinction_law=extinction,n_data_min=2,distance_range=[1., 2.] * u.kpc,av_range=[0., 40.])

~\Anaconda3\lib\site-packages\sedfitter\fit.py in fit(data, filter_names, apertures, model_dir, output, n_data_min, extinction_law, av_range, distance_range, output_format, output_convolved, remove_resolved)
    235         if s.n_data >= n_data_min:
    236 
--> 237             info = fitter.fit(s)
    238 
    239             if not output_convolved:

~\Anaconda3\lib\site-packages\sedfitter\fit.py in fit(self, source)
    116 
    117         info = self.models.fit(source, self.av_law, self.sc_law,
--> 118                                self.av_range[0], self.av_range[1])
    119 
    120         info.meta.model_dir = self.model_dir

~\Anaconda3\lib\site-packages\sedfitter\models.py in fit(self, source, av_law, sc_law, av_min, av_max, output_convolved)
    370 
    371             # Use optimal scaling to fit the Av
--> 372             residual = log_flux - model_fluxes
    373             av_best = f.optimal_scaling(residual, weight, av_law)
    374 

ValueError: operands could not be broadcast together with shapes (4,) (200710,31,7) 
jsmonzon commented 5 years ago

Same error pops up for me when I try following the example. What are we doing wrong?

mattpovich commented 5 years ago

Double-check that the lengths (shapes) of your filter= and aperture= variables match the format of your fitter data file.

On Thu, Jul 11, 2019 at 3:53 PM Jose Sebastian Monzon notifications@github.com<mailto:notifications@github.com> wrote:

Same error pops up for me when I try following the example. What are we doing wrong?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/astrofrog/sedfitter/issues/65?email_source=notifications&email_token=AJ5N6IFVKGWQPSELQ6FLAITP662VRA5CNFSM4HBW2YEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZYGLMY#issuecomment-510682547, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJ5N6ICFB52Z6VYUBYBIRPLP662VRANCNFSM4HBW2YEA.

--


Matthew S. Povich Assistant Professor Director, BUILD Associate Director, CAMPARE Department of Physics and Astronomy College of Science Building 8, Rm 216 Cal Poly Pomona http://www.cpp.edu/~mspovich/ mspovich@cpp.edumailto:mspovich@cpp.edu Office: (909) 869-3608 Mobile: (617) 306-0411

jsmonzon commented 5 years ago

Thanks for the tip!