[Gotthard2][Dark] Process dark constants starting the 21st pulse
Description
PSI has recommended against using the 1st 20 pulses while characterizing the detector and producing calibration constants.
This MR excludes these pulses while creating the dark constants. Also num_workers is updated to 25 after testing multiple values.
How Has This Been Tested?
Relevant Documents (optional)
Types of changes
- Bug fix (non-breaking change which fixes an issue)
Checklist:
Reviewers
Merge request reports
Activity
added 1 commit
- 9657c2b6 - exclude 1st 20 pulses from badpixels processing
338 336 "\n", 339 337 " # Split even and odd data to calculate the two storage cell constants.\n", 340 338 " # Detector always operates in burst mode.\n", 341 " even_data = data_10bit[:, ::2, :]\n", 342 " odd_data = data_10bit[:, 1::2, :]\n", 339 " even_data = data_10bit[:, 20::2, :]\n", 340 " odd_data = data_10bit[:, 21::2, :]\n", - Comment on lines +339 to +340
Just to check, should we be skipping the first 20 pulses in each run, or the first 20 in each train? This does the former, I believe.
It seems strange to me for a detector to behave differently at the start of a run - I didn't think the detector 'knows' when you start recording a run. But I might well be wrong about that.
you should be skipping the first ~20 images of each train. The electronics needs some time to reach stable operational conditions at the beginning of each acquisition cycle, hence the first ~20 images have lower quality and should not be used.
By the way, the rough number of 20 is correct at 4.5 MHz acquisition rate, but skipping 5 should be enough at 1.1 MHz.
I think that even if at 1.1 MHz the detector clock has a period 4 times longer, it should be safe to run up to 2700 images anyhow (I think we still have enough time to properly read them all before the next train trigger); but even if, for safety, we would use 2700/4 = 675 images max, you would be right anyhow and it would not make much of a difference skipping 5 instead of 20.
@kluyvert had a good raised point. We are going to create the dark maps from 2700 frames by default, correct?
BTW, thanks for the discussion. I have documented your words in the code @mramilli. If we are indeed using 2700 frames by default while creating the constants and it wouldn't make much of a difference, I will stick with 20 excluded frames for 1.1 or 4.5 acquisition rate runs.
Edited by Karim Ahmed
Thank you @kluyvert !
So I can make it switch between 5 or 20 based on the acquisition rate. I am not sure if we are going to benefit from it being configurable.
I am inclined to go with this now and update it later when there is a need.
Just to make sure: @mramilli are there scenarios when there is a need to configure the pulses to exclude?
@ahmedk do you mean for the offset calculation? if so, at the moment I do not foresee a scenario where this level of configuration can be beneficial. Actually, since atm we do not have an exact pulse ID stamping (e.g. from the FW), allowing configuration opens the door to mistakes (we attribute 'even' offset to 'odd' cell and viceversa). Swapping between 20 and 5 could make sense, but as discussed above, it probably doesn't make a lot of difference.
- Resolved by Karim Ahmed
mentioned in commit 8852def8