punchbowl.level1.sqrt#
Attributes#
Functions#
|
Square root decode between specified bitrate values. |
|
Square root encode between specified bitrate values. |
|
Perform a simple decoding using the naive squaring strategy. |
|
Generate a probability distribution function (pdf) from an input data value. |
|
Compute an offset from the naive and robust decoding processes. |
|
Compute an individual decoding value for an input data value. |
|
Generate a square root decode table between specified bitrate values and CCD parameters. |
|
Generate a square root decode table between specified bitrate values and CCD parameters. |
|
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_bottom: float = 4.9, ccd_gain_top: float = 4.9, ccd_offset: float = 100, ccd_read_noise: float = 17, overwrite_table: bool = False, reconstitute_noise: bool = True, dateobs: datetime.datetime | None = None) numpy.ndarray[source]#
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_bottom – CCD gain (bottom side of CCD) [e / DN]
ccd_gain_top – CCD gain (top side of CCD) [e / 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
reconstitute_noise – If True, adds appropriate noise after decoding. Otherwise, only square root decodes.
dateobs – The reference time to use as the random noise seed. If None, then the result is random and not reproducible.
- 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[source]#
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[source]#
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 = 4.9, ccd_offset: float = 100, ccd_read_noise: float = 17, n_sigma: int = 5, n_steps: int = 10000) tuple[source]#
Generate a probability distribution function (pdf) from an input data value.
- Parameters:
data_value – Input data value
ccd_gain – CCD gain [e/DN]
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 = 4.9, ccd_offset: float = 100, ccd_read_noise: float = 17) float[source]#
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 [e/DN]
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 = 4.9, ccd_offset: float = 100, ccd_read_noise: float = 17) float[source]#
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 [e/DN]
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 = 4.9, ccd_offset: float = 100, ccd_read_noise: float = 17, first_order: bool = False) numpy.ndarray[source]#
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 [e/DN]
ccd_offset – CCD bias level [DN]
ccd_read_noise – CCD read noise level [DN]
first_order – Toggle for first order square root decoding table only, defaults to False
- 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[source]#
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[source]#
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