-
Notifications
You must be signed in to change notification settings - Fork 22
Lo pointing set and map background rates update #2653
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
Draft
ahotasu
wants to merge
7
commits into
IMAP-Science-Operations-Center:dev
Choose a base branch
from
ahotasu:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e4bdb0b
Lo pointing set and map background rates update #2647
ahotasu 8a5f818
Fixed issue with lines being too long
ahotasu 69d0591
Fixed cut and paste error; re-ran to completion
ahotasu d866bb6
Removed trailing whitespace from lines
ahotasu 831f693
Learned how to use pre-commit and applied fixes.
ahotasu 78f1b05
Merge branch 'IMAP-Science-Operations-Center:dev' into dev
ahotasu 0ee79df
Merge branch 'IMAP-Science-Operations-Center:dev' into dev
ahotasu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1307,6 +1307,25 @@ def calculate_flux_corrections(dataset: xr.Dataset, flux_factors: Path) -> xr.Da | |
| """ | ||
| logger.info("Applying flux corrections") | ||
|
|
||
| bg_logarithmic_stability_factor = 0.04 | ||
|
|
||
| # Add in the background intensity to ensure that logarithms behave | ||
| # properly in the flux corrector when intensities are zero or very low. | ||
| dataset["ena_intensity"] += ( | ||
| dataset["bg_intensity"] * bg_logarithmic_stability_factor | ||
| ) | ||
| dataset["bg_intensity"] += dataset["bg_intensity"] * bg_logarithmic_stability_factor | ||
|
|
||
| # Commensurately, adjust the uncertainties to account for this addition | ||
| dataset["ena_intensity_stat_uncert"] = np.sqrt( | ||
| (dataset["ena_intensity_stat_uncert"]) ** 2 | ||
| + (dataset["bg_intensity"] * bg_logarithmic_stability_factor) ** 2 | ||
| ) | ||
| dataset["bg_intensity_sys_err"] = np.sqrt( | ||
| (dataset["bg_intensity_sys_err"]) ** 2 | ||
| + (dataset["bg_intensity"] * bg_logarithmic_stability_factor) ** 2 | ||
| ) | ||
|
Comment on lines
+1324
to
+1327
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no systematic error here it looks like: |
||
|
|
||
| # Flux correction | ||
| corrector = PowerLawFluxCorrector(flux_factors) | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is really confusing to me. I thought that a critical idea in the Lo algorithm is that the backgrounds do not get subtracted. So coming into this function,
ena_intensity = signal_intensity + bg_intensity. Then this factor of the background is added in on top which meansena_intensity = signal_intensity + bg_intensity + stability_factor * bg_intensity. That doesn't make sense to me. I know that this is what Nathan wants but I am really struggling to understand why. To me this seems like it is purely an problem with the crappy intput data being used for validation and this fix actually degrades the output product.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.
I completely agree with this comment, and that is why I'm hesitant to throw this in there at the last second.
I think this is actually really bad because it adds in 4% uncertainty, but then doesn't remove that later on, so could be very misleading in terms of what is going on, and this is only before flux corrections, but if someone is looking at a sputtering/bootstrap map, then those wouldn't be corrected. It seems like this is a recipe for confusion.