Skip to content
Snippets Groups Projects

[AGIPD] Only use bad pixels from darks in agipdutils.baseline_correct_via_stripes

Merged Philipp Schmidt requested to merge fix/AGIPD_baseline_shift_masking into master
All threads resolved!

Description

In response to https://git.xfel.eu/calibration/planning/-/issues/96, @jsztuk asked to only use bad pixels obtained from darks to be used for masking in baseline correction via stripes.

How Has This Been Tested?

@jsztuk verified the correction result with this change.

Types of changes

  • Changed behaviour (non-breaking change which fixes an issue)

Reviewers

@jsztuk @ahmedk @kluyvert

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Philipp SchmidtPhilipp Schmidt 3 years ago (Oct 7, 2021 7:56am UTC)

Merge details

  • Changes merged into master with c134799a.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • `GAIN_THRESHOLDING_ERROR' is not needed as we already select only pixels in HG, this bit is only relevant for pixels in MG or LG gain as there is an issue with gain decoding (i.e. it is not possible for some pixels to separate MG from LG based on the gain value informations)

    There are two classes BadPixels and BadPixelsFF BadPixelsFF.FIT_FAILED bits values are used internally in FF processing notebook. To fill bits for BadPixels, they are grouped

    for mod in modules:
        bpmask[mod] = np.zeros(fit_data[mod]['mask'].shape).astype(np.int32)
        bpmask[mod][ any_in(fit_data[mod]['mask'], BadPixelsFF.NO_ENTRY.value) ] = BadPixels.FF_NO_ENTRIES.value
        bpmask[mod][ any_in(fit_data[mod]['mask'], 
                            BadPixelsFF.GAIN_DEVIATION.value) ] |= BadPixels.FF_GAIN_DEVIATION.value
        bpmask[mod][ any_in(fit_data[mod]['mask'], 
                            BadPixelsFF.FIT_FAILED.value | BadPixelsFF.ACCURATE_COVAR.value |
                            BadPixelsFF.CHI2_THRESHOLD.value | BadPixelsFF.GAIN_THRESHOLD.value |
                            BadPixelsFF.NOISE_PEAK_THRESHOLD.value | BadPixelsFF.PEAK_WIDTH_THRESHOLD.value) ] |= BadPixels.FF_GAIN_EVAL_ERROR.value
  • Aha, I had missed that translation from BadPixelsFF to BadPixels. :thumbsup:

    LGTM

  • added 1 commit

    • a1b8f7c0 - Move BadPixelsFF to cal_tools.agipdutils_ff and clarify internal usage

    Compare with previous version

  • Thanks for clarification of the BadPixelsFF enum. I've moved it to agipdutils_ff and clarified the comment to prevent any confusion in the future.

    EDIT: Force-pushed to fix missing comma :rolling_eyes:

    Edited by Philipp Schmidt
  • added 1 commit

    • 9c60cfd0 - Move BadPixelsFF to cal_tools.agipdutils_ff and clarify internal usage

    Compare with previous version

  • i have installed the branch (i.e. before @schmidtp moved BadPixelsFF to agipdutils_ff :)) and runs a small test on r21 from p002929. I processed data with --xray-gain and w/o xray-gain.

    1. The bls values are the same in both cases

    image image

    1. data is properly corrected. I compared results obtained with the old version and the current branch. the same set of corrections was applied to the data. The plot shows mean image for one train after bug fix (this branch):

    image

    For comparision, the same train before the bug fix:

    image

  • Thomas Kluyver resolved all threads

    resolved all threads

  • Thanks for review and also the extensive testing from @jsztuk

  • Philipp Schmidt mentioned in commit c134799a

    mentioned in commit c134799a

  • Please register or sign in to reply
    Loading