Skip to content
Snippets Groups Projects

[Gotthard2][Dark] Process dark constants starting the 21st pulse

Merged Karim Ahmed requested to merge fix/G2_dark_exclude_1st_20pulses into master
3 unresolved threads

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

@calibration @mramilli

Edited by Karim Ahmed

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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. :slight_smile:

  • 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.

  • Thanks Marco!

    I just realised I misread the code, and this is actually skipping the first 20 images of each train, rather than the whole run.

    If darks are always recorded with 2700 images per train (?), then it's probably OK to skip the first 20 even if we could skip fewer.

  • 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
  • Please register or sign in to reply
  • Karim Ahmed added 1 commit

    added 1 commit

    Compare with previous version

  • Karim Ahmed added 1 commit

    added 1 commit

    Compare with previous version

  • Karim Ahmed added 3 commits

    added 3 commits

    • 79ffc23a - Check for run_values as acquisitionRate is missing from CONTROL
    • 5be12d04 - use EAFP instead of LBYL
    • 72df8622 - remove unneeded noqa

    Compare with previous version

  • Karim Ahmed added 1 commit

    added 1 commit

    • 1cf2265e - update worker number from 15 to 25

    Compare with previous version

    • Does it make sense to make this pulse slice / first pulse configurable?

    • 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.

    • Please register or sign in to reply
  • David Hammer
  • David Hammer approved this merge request

    approved this merge request

  • Karim Ahmed changed the description

    changed the description

  • Thanks for the review!

  • merged

  • Karim Ahmed mentioned in commit 8852def8

    mentioned in commit 8852def8

  • Please register or sign in to reply
    Loading