Feature #2207
closeddetermine debris on Gatan K2 counted frame image and correct it
0%
Description
Gatan K2 camera (and likely future counted mode dd camera or the sort fills the shadow of debris in the integrated image sent to Leginon with randon number in normal distribution. However, this is not done on the raw frames that it saves to disk. This makes it not possible to use the norm image obtained in Leginon Correction node to gain correct the frames properly since the images obtained in Correction node are integrated ones.
This feature determines the shadow dynamically from the first raw frame of the first image after condition changed (normally the start of processing).
Updated by Anchi Cheng almost 12 years ago
- Status changed from Assigned to In Code Review
- Assignee changed from Anchi Cheng to Ryan Hoffman
- Priority changed from Urgent to High
r17333 adds the feature in apDDprocess.py and activate the function in apK2process.py
This works only for counting mode. Linear mode images would be too noisy to predict the good threshold to give only debris shadow.
Assign to Kuanglei Tsai to test. He will probably the next person using K2 counted mode and need to align frames.
Kuang-Lei, just run the makeDDRawFrameStack.py script as usual with --align option when you collect your counted mode data. The committed aligned image should not show the "hair".
Updated by Ryan Hoffman almost 12 years ago
- Assignee changed from Ryan Hoffman to Anchi Cheng
The code looks mostly good. There are two minor issues I notice.
On line 521 (executed if correctFrameImage is called with stripe_correction=True), getStripeNormArray is called with length=512.
Are we sure we want to hard-code the length there? I'm not sure but it could be a leftover from the coding process.
On line 547, I'm confused shape=array.shape because when I make a numpy array and access the shape attribute, I get a type error, "'tuple' object is not callable."
It looks like getStripeNormArray() casts the variable 'length' as an integer (line 534.)
If length is an integer, and shape a tuple, than I doubt that '>' overloads properly to allow for the conditional on line 548. There's a clue that I'm wrong about length being an integer, though, because of the casting on line 550.
Updated by Anchi Cheng almost 12 years ago
- Assignee changed from Anchi Cheng to Ryan Hoffman
Ryan,
Thanks for your great effort in an excellent code review and sorry for not getting back to you earlier.
I should have explained that when you view diff for a particular file linked in the revision, the red code block is the code that is deleted in the revision, and therefore, no longer exists in the code. I should also mentioned that I deleted getStripeNormArray function because it never worked right. To be correct, I should have committed two revisions.
Regarding array.shape, I suspect that you did
array.shape()
not
array.shape
when you got that error. Getting value of attributes does not require () in python.
As for the bad casting, you are absolutely right. It shows you how behind we are in code review. When we did use it, the image was always much larger, so the expected boolean False resulted even though they should not be used for comparison.
You can close this issue after you read this. Several people have used this feature so far, and we no longer have K2. Gatan promised that the new camera software with the new one won't need our effort for this matter.
Updated by Ryan Hoffman almost 12 years ago
- Status changed from In Code Review to Closed
Updated by Anchi Cheng over 11 years ago
r17525 turned this option off. The new K2 does not have this problem and Gatan is supposed to have fixed it.