punchbowl.level1.sqrt#

Attributes#

Functions#

decode_sqrt(→ numpy.ndarray)

Square root decode between specified bitrate values.

encode_sqrt(→ numpy.ndarray)

Square root encode between specified bitrate values.

decode_sqrt_simple(→ numpy.ndarray)

Perform a simple decoding using the naive squaring strategy.

noise_pdf(→ tuple)

Generate a probability distribution function (pdf) from an input data value.

mean_b_offset(→ float)

Compute an offset from the naive and robust decoding processes.

decode_sqrt_corrected(→ float)

Compute an individual decoding value for an input data value.

generate_decode_sqrt_table(→ numpy.ndarray)

Generate a square root decode table between specified bitrate values and CCD parameters.

decode_sqrt_by_table(→ numpy.ndarray)

Generate a square root decode table between specified bitrate values and CCD parameters.

decode_sqrt_data(→ ndcube.NDCube)

Prefect task in the pipeline to decode square root encoded data.

Module Contents#

punchbowl.level1.sqrt.TABLE_PATH#
punchbowl.level1.sqrt.decode_sqrt(data: numpy.ndarray | float, from_bits: int = 16, to_bits: int = 12, ccd_gain: float = 1 / 4.3, ccd_offset: float = 100, ccd_read_noise: float = 17, overwrite_table: bool = False) numpy.ndarray#

Square root decode between specified bitrate values.

Parameters:
  • data – Input encoded data array

  • from_bits – Specified bitrate of encoded image to unpack

  • to_bits – Specified bitrate of output data (decoded)

  • ccd_gain – CCD gain [photons / DN]

  • ccd_offset – CCD bias level [DN]

  • ccd_read_noise – CCD read noise level [DN]

  • overwrite_table – Toggle to regenerate and overwrite existing decoding table

Returns:

Square root decoded version of the input image

Return type:

np.ndarray

punchbowl.level1.sqrt.encode_sqrt(data: numpy.ndarray | float, from_bits: int = 16, to_bits: int = 12) numpy.ndarray#

Square root encode between specified bitrate values.

Parameters:
  • data – Input data array

  • from_bits – Specified bitrate of original input image

  • to_bits – Specified bitrate of output encoded image

Returns:

Encoded version of input data

Return type:

np.ndarray

punchbowl.level1.sqrt.decode_sqrt_simple(data: numpy.ndarray | float, from_bits: int = 16, to_bits: int = 12) numpy.ndarray#

Perform a simple decoding using the naive squaring strategy.

Parameters:
  • data – Input data array

  • from_bits – Specified bitrate of original input image

  • to_bits – Specified bitrate of output encoded image

Returns:

Decoded version of input data

Return type:

np.ndarray

punchbowl.level1.sqrt.noise_pdf(data_value: numpy.ndarray | float, ccd_gain: float = 1 / 4.3, ccd_offset: float = 100, ccd_read_noise: float = 17, n_sigma: int = 5, n_steps: int = 10000) tuple#

Generate a probability distribution function (pdf) from an input data value.

Parameters:
  • data_value – Input data value

  • ccd_gain – CCD gain [DN / electron]

  • ccd_offset – CCD bias level [DN]

  • ccd_read_noise – CCD read noise level [DN]

  • n_sigma – Number of sigma steps

  • n_steps – Number of data steps

Returns:

  • np.ndarray – Data step distribution

  • normal – Data normal distribution

punchbowl.level1.sqrt.mean_b_offset(data_value: float, from_bits: int = 16, to_bits: int = 12, ccd_gain: float = 1 / 4.3, ccd_offset: float = 100, ccd_read_noise: float = 17) float#

Compute an offset from the naive and robust decoding processes.

Parameters:
  • data_value – Input data value [DN]

  • from_bits – Specified bitrate of encoded image to unpack

  • to_bits – Specified bitrate of output data (decoded)

  • ccd_gain – CCD gain [DN / electron]

  • ccd_offset – CCD bias level [DN]

  • ccd_read_noise – CCD read noise level [DN]

Returns:

Generated decoding value for use in constructing a decoding table

Return type:

float

punchbowl.level1.sqrt.decode_sqrt_corrected(data_value: float, from_bits: int = 16, to_bits: int = 12, ccd_gain: float = 1 / 4.3, ccd_offset: float = 100, ccd_read_noise: float = 17) float#

Compute an individual decoding value for an input data value.

Parameters:
  • data_value – Input data value [DN]

  • from_bits – Specified bitrate of encoded image to unpack

  • to_bits – Specified bitrate of output data (decoded)

  • ccd_gain – CCD gain [DN / electron]

  • ccd_offset – CCD bias level [DN]

  • ccd_read_noise – CCD read noise level [DN]

Returns:

Generated decoding value for use in constructing a decoding table

Return type:

float

punchbowl.level1.sqrt.generate_decode_sqrt_table(from_bits: int = 16, to_bits: int = 12, ccd_gain: float = 1 / 4.3, ccd_offset: float = 100, ccd_read_noise: float = 17) numpy.ndarray#

Generate a square root decode table between specified bitrate values and CCD parameters.

Parameters:
  • from_bits – Specified bitrate of encoded image to unpack

  • to_bits – Specified bitrate of output data (decoded)

  • ccd_gain – CCD gain [DN / electron]

  • ccd_offset – CCD bias level [DN]

  • ccd_read_noise – CCD read noise level [DN]

Returns:

Generated square root decoding table

Return type:

table

punchbowl.level1.sqrt.decode_sqrt_by_table(data: numpy.ndarray | float, table: numpy.ndarray) numpy.ndarray#

Generate a square root decode table between specified bitrate values and CCD parameters.

Parameters:
  • data – Input encoded data array

  • table – Square root decoding table

Returns:

Decoded version of input data

Return type:

np.ndarray

punchbowl.level1.sqrt.decode_sqrt_data(data_object: ndcube.NDCube, overwrite_table: bool = False) ndcube.NDCube#

Prefect task in the pipeline to decode square root encoded data.

Parameters:
  • data_object (NDCube) – the object you wish to decode

  • overwrite_table – Toggle to regenerate and overwrite existing decoding table

Returns:

a modified version of the input with the data square root decoded

Return type:

NDCube