Update mktrace from gfit to Astropy fitting#174
Conversation
Remove dependence on deprecated stsci.tools.gfit Gaussian fitting; replace with Astropy fitting. Allow for scipy API change for scipy.signal.boxcar to scipy.signal.windows.boxcar. Changed Gaussian fitting initial guess to peak. Aggregate Astropy fitting warnings (with ierr > 4 into a single warning for each call of Trace.gFitTrace(). Set data types to Float as they are created rather than after, avoiding conversions.
|
Early checks show differences in It appears that We should probably construct a test suite across flux levels and modes in order to compare results before merging this change. |
|
Validation work is ongoing. I compiled a test suite and have been measuring the scale of the resulting changes. |
… in the middle of the fit region. Increased maxiter to 250. Simplified scipy imports. Updated user warning stacklevel to be more useful.
|
|
||
| # Bias 1D Gaussian fit toward the center of the range: | ||
| window = hann(specimage.shape[0], sym=True) | ||
| window /= window.sum() |
There was a problem hiding this comment.
Could this cause problems for E1 data?
There was a problem hiding this comment.
I think it should be agnostic to Y-position unless it falls off the detector/subarray dimensions.
I did find some bad cases caused by the weights on the edges being zero, so changed the windowing slightly in the next commit.
There was a problem hiding this comment.
Oh, I think I understand...
The window it's fitting each column in is 41 pixels tall (as set by the subim_size = 40 parameter).
…. Perform a global initial guess for the trace amplitude (scalar median) and peak position (3σ-clipped linear fit); default to scalar median peak position when this fails.
|
Trace comparison: trace_results_5.pdf Quick view of data for reference: |
|
@stscirij - The current code produces 4 output FITS files with 1D images. I'm considering merging these into a binary FITS table of a single product. Do you know of any dependencies on |





Version 3.0.0. Builds onto PR #37.