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

Panel pedestal does not work? #108

Closed
dagewa opened this issue Oct 16, 2019 · 3 comments
Closed

Panel pedestal does not work? #108

dagewa opened this issue Oct 16, 2019 · 3 comments
Assignees

Comments

@dagewa
Copy link
Member

dagewa commented Oct 16, 2019

I've just come across the panel pedestal attribute. This seems to be a fairly recent innovation (this year at least: f96a16d) but as far as I can tell it does not work.

The "pedestal" should be subtracted as a dark image here:

dxtbx/imageset.h

Lines 680 to 685 in d95a922

// Apply dark
if (p.size() > 0) {
for (std::size_t j = 0; j < r.size(); ++j) {
c[j] = c[j] - p[j];
}
}

however, even if panel.pedestal is set to something non-zero, this block is never called because p.size() == 0.

@dagewa
Copy link
Member Author

dagewa commented Oct 16, 2019

Perhaps this is at fault

dxtbx/imageset.h

Lines 770 to 772 in d95a922

} else if (std::abs(pedestal[i]) > 1e-7) {
need_pedestal_map = false;
break;

Should be need_pedestal_map = true;?

@dagewa
Copy link
Member Author

dagewa commented Oct 16, 2019

I note also that the format classes that use a pedestal (typically FormatSMV etc.) don't use this mechanism and instead subtract a pedestal from get_raw_data, which is wrong

@dagewa
Copy link
Member Author

dagewa commented Oct 16, 2019

Another point: the code here only allows for strictly positive pedestal maps. But for some detectors in electron diffraction there may be negative bias in the images. I would therefore like to add a uniform positive value to the images, with the value chosen by the user. The panel.pedestal attribute would appear to be the way to do that, by supplying a negative pedestal value.

The alternative, modifying the behaviour of get_raw_data under the control of an environment variable is fairly horrible.

@dagewa dagewa self-assigned this Oct 16, 2019
dagewa added a commit that referenced this issue Oct 16, 2019
There is no need for two boolean flags. Each panel's pedestal must
be checked (so cannot break the loop) and if any pedestal is
significantly non-zero then a full pedestal map must be created.
This also now allows for negative pedestal maps. Fixes #108
@dagewa dagewa closed this as completed in 29d9c31 Oct 21, 2019
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

No branches or pull requests

1 participant