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

Add weighted averages + bootstrapped errors #16

Merged
merged 7 commits into from
Mar 24, 2023

Conversation

dirkscholte
Copy link
Member

Hi,

This pull request includes a few different additions to the stacking code. I think it should take care of issues #10 and #11 .

Weighted averages:
I have included ivar and irms weighted averages per wavelength bin. On top of that it is also possible to up of down weight specific (as in one weight per spectrum) spectra using the weight argument in the main stacking function. These two weights can be used in conjunction where total_weight = wl_weight * spec_weight.

Bootstrap errors:
Errors using bootstrap sampling. The default setting is bootstrap_samples=1000. For each bootstrap we are sampling with replacement a bootstrap sample of equal length as the original sample. The bootstrap sampling can be run in parallel using the n_workers argument.

Currently the stacking code will return a stacked spectrum when for the wl range covered by at least 1 spectrum but we might want to change this to a slightly more sane criterium at some point.

Stacking example with bootstrapped errors:
image

Add MW foreground correction to the main stacking function:
I have now added the MW foreground correction to the main stacking function.

Let me know if you think there are any changes that should be made before we integrate this into the main branch! 🙂

@dirkscholte
Copy link
Member Author

The measurement error should now be included in the bootstrap errors.

@biprateep biprateep merged commit f3e3d58 into desihub:master Mar 24, 2023
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.

2 participants