Adds fitter#258
Conversation
Adds fitter and instrument_response
samaloney
left a comment
There was a problem hiding this comment.
This is great, nice to see it finally working!
The biggest things I see missing are docstrings and test, as this is a core part of the package we need to though testing e.g hight level testfit non-spectral data/model, fit spectral data model with out SRM, fits spectral data model with SRM and also more basic unit tests.
On a similar topic an gallery example showing a some of the basic fits you can and some narrarive documentation on the fitter/fitting (this could wait for a separate PR)
| def _set_abledo_angle(self): | ||
|
|
||
| if 'Albedo' in self.model.submodel_names: | ||
|
|
||
| print(len(self._spectrum_object.meta['ph_axis'])) | ||
|
|
||
| replacement_albedo = Albedo(energy_edges=self._spectrum_object.meta['ph_axis'], | ||
| theta=self._spectrum_object.meta['angle']) | ||
| replacement_albedo.theta.fixed = True | ||
|
|
||
| self._model = self._model.replace_submodel('Albedo',replacement_albedo) |
There was a problem hiding this comment.
I think this should be derived from the Spectrum object e.g. spec.observer_location and spec.flare_location which would be SkyCoords
|
|
||
| self._model = self._model.replace_submodel('Albedo',replacement_albedo) | ||
|
|
||
| def _set_observer_distance(self): |
There was a problem hiding this comment.
Derived from spec.observer_location
|
|
||
| mask = self._fit_mask | ||
|
|
||
| self._spectrum_object = self._spectrum_object[mask[0]:mask[-1]+1] |
There was a problem hiding this comment.
What about using the mask / or subscripting the final data before it goes into the fitter? Also what about the SRM?
There was a problem hiding this comment.
The SRM is clipped just below this
| data_spec_units=u.dimensionless_unscaled, | ||
| conversion_factor=1*u.dimensionless_unscaled, |
There was a problem hiding this comment.
Eventually these should probably live the the SRM object (an NDCude with 2 spectral axes in input or photon and one output, count or data)
There was a problem hiding this comment.
This shouldn't show up here needs to merge or rabase main
Adds the fitter object
This PR adds the fitter object which intakes the NDcube spectrum object and can perform fitting in count space. This includes the addition of a plotter for fit results.
Tasks:
instrument_response.py