-
Notifications
You must be signed in to change notification settings - Fork 0
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
Skip time slices for which the transmission calculation fails #993
Conversation
18f7160
to
55d580b
Compare
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
55d580b
to
6b95399
Compare
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.
the errorTolerance
should go inside the sample transmission schema. In file common.json
:
"sample": {
"transmission": {
"type": "object",
"properties": {
"runNumber": {
"$ref": "common.json#/definitions/runNumberOptionalTypes",
"description": "The run number(s) for the transmission sample. More than one run number can be specified by passing a list or by passing a string containing the run numbers separated by commas.",
"examples": ["12345", 12345]
},
"value": {
"$ref": "common.json#/definitions/transmissionValueTypes"
}
"errorTolerance": {
"$ref": "common.json#/definitions/transmissionValueTypes",
"description": "maximum allowed absolute value of the error in the calculated transmission"
"default": 0.01,
}
}
}
This problem arises when slicing and since we're slicing just the sample, the problems arises when slicing the sample-transmission run (which also happens to be the sample run)
@jmborr Should we only check the transmission error when time slicing the sample transmission run? That is, we don't care about this sanity check otherwise? |
I can't think of any scenario when the transmission will have a big error. If we're not slicing, then the transmission run will have zillion events. I'd go "cheap" and check only the slicing case. If you want to be generous and it's not too much extra work, I'd check the sample-transmission (not the other cases like the background-transmission or empty transmission) for the non-slicing case. It's up to you. |
Sounds good. I will probably err on the side of not upsetting users with new error messages and check only the slicing case. |
…he transmission calculation fails
6f2fb82
to
fea6355
Compare
Fine by me. Let me know when the PR is ready to be reviewed |
@jmborr This is ready for a second pass. |
Description of work:
Bio-SANS has an option
"useTimeSliceTransmission"
where the transmission correction will be calculated separately for each time slice using the time sliced sample run rather than a separate sample transmission run. Currently, the whole reduction can fail if one time slice (usually the last smaller slice) has insufficient statistics and the transmission calculation results in NaNs. The Bio-SANS IS wants the reduction to proceed without the slice for which the transmission calculation failed.This PR changes the
RuntimeError
in the transmission calculation to a custom errorTransmissionNanError
. A new sanity check is added for the relative size of the transmission error compared to the transmission value and a custom errorTransmissionErrorToleranceError
is thrown if the value is larger than the sample transmission parameter"errorTolerance"
. When"useTimeSliceTransmission"
is used, a time slice will be skipped ifTransmissionNanError
orTransmissionErrorToleranceError
is thrown."errorTolerance"
with default value 0.01"useTimeSliceTransmission"
, skip slices with relative transmission error higher than the tolerance or when all transmission values are NaNCheck all that apply:
Added integration testsReferences:
Manual test for the reviewer
Check list for the reviewer
Execution of tests requiring the /SNS and /HFIR filesystems
It is strongly encouraged that the reviewer runs the following tests in their local machine
because these tests are not run by the GitLab CI. It is assumed that the reviewer has the /SNS and /HFIR filesystems
remotely mounted in their machine.
In the above code snippet, substitute
<MERGE_REQUEST_NUMBER>
for the actual merge request number. Also substitute<my_drtsans_dev_environment>
with the name of the conda environment you use for development. It is critical thatyou have installed the repo in this conda environment in editable mode with
pip install -e .
orconda develop .