Skip to content
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

fix incorrect use of polyfit #2105

Merged
merged 1 commit into from Aug 29, 2023
Merged

fix incorrect use of polyfit #2105

merged 1 commit into from Aug 29, 2023

Conversation

segasai
Copy link
Contributor

@segasai segasai commented Aug 29, 2023

Hi,

while investigating trace_shifts I noticed that there is a couple places in desispec that use np.polyfit weights assuming those weigths are inverse variances, while they should be inverse errors:

c = np.polyfit(fy,fdx,deg,w=1/fex**2)

c = np.polyfit(x[jj],tflux[i,jj]/mflux[jj],1,w=mflux[jj]**2*tivar[i,jj])

cf. docs
https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html

The patch fixes that. (I am assuming that the patch should be pretty safe)

@julienguy
Copy link
Contributor

Wow, good catch. I should never use those built-in minimization (without reading the doc carefully!).

@julienguy julienguy merged commit b98b567 into main Aug 29, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants