-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds accessor for the 3D fit parameters in CubeViz #263
Conversation
Codecov Report
@@ Coverage Diff @@
## master #263 +/- ##
==========================================
- Coverage 64.78% 64.45% -0.34%
==========================================
Files 44 45 +1
Lines 2272 2307 +35
==========================================
+ Hits 1472 1487 +15
- Misses 800 820 +20
Continue to review full report at Codecov.
|
The accessor 'cubeviz.fitted3d' delivers a dictionary of parameter planes fitted over the cube. However, I am having trouble with the initial 1D model fitting on the collapsed data, which yields the following error message, which may be ValueError Traceback (most recent call last) ~/Desktop/jdat/jdaviz/jdaviz/configs/default/plugins/model_fitting/model_fitting.py in vue_model_fitting(self, *args, **kwargs) ~/Desktop/jdat/jdaviz/jdaviz/configs/default/plugins/model_fitting/fitting_backend.py in fit_model_to_spectrum(spectrum, component_list, expression, run_fitter) ~/Desktop/jdat/jdaviz/jdaviz/configs/default/plugins/model_fitting/fitting_backend.py in _fit_1D(initial_model, spectrum, run_fitter) ~/miniconda3/envs/jdaviz16/lib/python3.8/site-packages/specutils/fitting/fitmodels.py in fit_lines(spectrum, model, fitter, exclude_regions, weights, window, **kwargs) ~/miniconda3/envs/jdaviz16/lib/python3.8/site-packages/specutils/fitting/fitmodels.py in _fit_lines(spectrum, model, fitter, exclude_regions, weights, window, ignore_units, **kwargs) ~/miniconda3/envs/jdaviz16/lib/python3.8/site-packages/specutils/fitting/fitmodels.py in _add_units_to_model(model_in, model_orig, spectrum) ValueError: The parameter 'slope' with unit '1e-17 erg / (Angstrom cm2 m s)' is not convertible to either the current flux unit '1e-17 erg / (Angstrom cm2 s)' or spectral axis unit 'm'. |
Tried again to fit a small subset with a Constant plus Gaussian, but get a different error on the model fitting, TypeError Traceback (most recent call last) ~/Desktop/jdat/jdaviz/jdaviz/configs/default/plugins/model_fitting/model_fitting.py in vue_model_fitting(self, *args, **kwargs) ~/Desktop/jdat/jdaviz/jdaviz/configs/default/plugins/model_fitting/model_fitting.py in _update_parameters_from_fit(self) TypeError: 'QuantityModel' object is not subscriptable |
I just fixed the compound model bug in #276 - that was something that was discussed in passing earlier in the year and fell off the radar, glad you mentioned it so I could fix it before release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessor successfully returns a dictionary of 2D image arrays with associated units, one for each fit parameter. The models are currently misfit, because the model fitting machinery does not reference the collapse method, but this is being fixed in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I was able to retrieve the fitted parameter arrays with the fitted3d
property.
This implements the second simplest solution as proposed in #241 : a raw attribute in the helper, but with individual parameters accessed by name .
This makes the 3D fitter usable in a notebook.
The
Cube_fit
notebook in the concepts directory exercises this functionality.