act.qc.set_bit#

act.qc.set_bit(array, bit_number)[source]#

Function to set a quality control bit given a scalar or array of values and a bit number.

Parameters:
  • array (int list of int or numpy array of int) – The bitpacked array to set the bit number.

  • bit_number (int) – The bit (or test) number to set starting at 1.

Returns:

array (int, numpy array, tuple, list) – Integer or numpy array with bit set for each element of the array. Returned in same type.

Examples

Example use setting bit 2 to an array called data:

from act.qc.qcfilter import set_bit
data = np.array(range(0, 7))
data = set_bit(data, 2)
print(data)
array([2, 3, 2, 3, 6, 7, 6])