astrofrog / astrofrog/sedfitter
ValueError: operands could not be broadcast together with shapes (4,) (200710,31,7)
- Dominant language
- Python
- Stars
- 21
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
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)
in ()
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)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the documented example using the example files, then inspect sedfitter/fit.py at the call to fitter.fit and sedfitter/models.py around line 372. Trace the shapes of log_flux and model_fluxes before the residual calculation. Done means the documented example completes without the broadcasting error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100