kammerje / spaceKLIP

Pipeline for reducing JWST high-contrast imaging data. Published in Kammerer et al. 2022 and Carter et al. 2022.
https://ui.adsabs.harvard.edu/abs/2022SPIE12180E..3NK/abstract
MIT License
16 stars 9 forks source link

DQ flags and masks #147

Closed JarronL closed 6 months ago

JarronL commented 6 months ago

I created a couple utility functions for interpreting DQ masks and their flags.

  1. interpret_dq_value(dq_value) will parse out a value from the DQ array into various bits and show their human-readable mnemonic as a set. This just wraps the interpret_dq_value from the pipeline.
    res = interpret_dq_value(16387)
    # res = {'DO_NOT_USE', 'RC', 'SATURATED'}
  2. get_dqmask(dq_arr, bitvalues) will create a binary boolean mask from a DQ array. For instance, if someone wanted to find all pixels that were flagged as RC pixel as well as saturated within a DQ array, you would say:
    mask = get_dqmask(dq_arr, [2, 2**14])