-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
2,030 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
punchbowl.level1.sqrt | ||
===================== | ||
|
||
.. py:module:: punchbowl.level1.sqrt | ||
Attributes | ||
---------- | ||
|
||
.. autoapisummary:: | ||
|
||
punchbowl.level1.sqrt.TABLE_PATH | ||
|
||
|
||
Functions | ||
--------- | ||
|
||
.. autoapisummary:: | ||
|
||
punchbowl.level1.sqrt.decode_sqrt | ||
punchbowl.level1.sqrt.encode_sqrt | ||
punchbowl.level1.sqrt.decode_sqrt_simple | ||
punchbowl.level1.sqrt.noise_pdf | ||
punchbowl.level1.sqrt.mean_b_offset | ||
punchbowl.level1.sqrt.decode_sqrt_corrected | ||
punchbowl.level1.sqrt.generate_decode_sqrt_table | ||
punchbowl.level1.sqrt.decode_sqrt_by_table | ||
punchbowl.level1.sqrt.decode_sqrt_data | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:data:: TABLE_PATH | ||
.. py:function:: 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. | ||
|
||
:param data: Input encoded data array | ||
:param from_bits: Specified bitrate of encoded image to unpack | ||
:param to_bits: Specified bitrate of output data (decoded) | ||
:param ccd_gain: CCD gain [photons / DN] | ||
:param ccd_offset: CCD bias level [DN] | ||
:param ccd_read_noise: CCD read noise level [DN] | ||
:param overwrite_table: Toggle to regenerate and overwrite existing decoding table | ||
|
||
:returns: Square root decoded version of the input image | ||
:rtype: np.ndarray | ||
|
||
|
||
.. py:function:: encode_sqrt(data: numpy.ndarray | float, from_bits: int = 16, to_bits: int = 12) -> numpy.ndarray | ||
Square root encode between specified bitrate values. | ||
|
||
:param data: Input data array | ||
:param from_bits: Specified bitrate of original input image | ||
:param to_bits: Specified bitrate of output encoded image | ||
|
||
:returns: Encoded version of input data | ||
:rtype: np.ndarray | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param data: Input data array | ||
:param from_bits: Specified bitrate of original input image | ||
:param to_bits: Specified bitrate of output encoded image | ||
|
||
:returns: Decoded version of input data | ||
:rtype: np.ndarray | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param data_value: Input data value | ||
:param ccd_gain: CCD gain [DN / electron] | ||
:param ccd_offset: CCD bias level [DN] | ||
:param ccd_read_noise: CCD read noise level [DN] | ||
:param n_sigma: Number of sigma steps | ||
:param n_steps: Number of data steps | ||
|
||
:returns: * *np.ndarray* -- Data step distribution | ||
* *normal* -- Data normal distribution | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param data_value: Input data value [DN] | ||
:param from_bits: Specified bitrate of encoded image to unpack | ||
:param to_bits: Specified bitrate of output data (decoded) | ||
:param ccd_gain: CCD gain [DN / electron] | ||
:param ccd_offset: CCD bias level [DN] | ||
:param ccd_read_noise: CCD read noise level [DN] | ||
|
||
:returns: Generated decoding value for use in constructing a decoding table | ||
:rtype: float | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param data_value: Input data value [DN] | ||
:param from_bits: Specified bitrate of encoded image to unpack | ||
:param to_bits: Specified bitrate of output data (decoded) | ||
:param ccd_gain: CCD gain [DN / electron] | ||
:param ccd_offset: CCD bias level [DN] | ||
:param ccd_read_noise: CCD read noise level [DN] | ||
|
||
:returns: Generated decoding value for use in constructing a decoding table | ||
:rtype: float | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param from_bits: Specified bitrate of encoded image to unpack | ||
:param to_bits: Specified bitrate of output data (decoded) | ||
:param ccd_gain: CCD gain [DN / electron] | ||
:param ccd_offset: CCD bias level [DN] | ||
:param ccd_read_noise: CCD read noise level [DN] | ||
|
||
:returns: Generated square root decoding table | ||
:rtype: table | ||
|
||
|
||
.. py:function:: 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. | ||
|
||
:param data: Input encoded data array | ||
:param table: Square root decoding table | ||
|
||
:returns: Decoded version of input data | ||
:rtype: np.ndarray | ||
|
||
|
||
.. py:function:: decode_sqrt_data(data_object: ndcube.NDCube, overwrite_table: bool = False) -> ndcube.NDCube | ||
Prefect task in the pipeline to decode square root encoded data. | ||
|
||
:param data_object: the object you wish to decode | ||
:type data_object: NDCube | ||
:param overwrite_table: Toggle to regenerate and overwrite existing decoding table | ||
|
||
:returns: a modified version of the input with the data square root decoded | ||
:rtype: NDCube | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
_sources/autoapi/punchbowl/level1/tests/test_sqrt/index.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
punchbowl.level1.tests.test_sqrt | ||
================================ | ||
|
||
.. py:module:: punchbowl.level1.tests.test_sqrt | ||
Functions | ||
--------- | ||
|
||
.. autoapisummary:: | ||
|
||
punchbowl.level1.tests.test_sqrt.sample_punchdata | ||
punchbowl.level1.tests.test_sqrt.test_encoding | ||
punchbowl.level1.tests.test_sqrt.test_decoding | ||
punchbowl.level1.tests.test_sqrt.test_encode_then_decode | ||
punchbowl.level1.tests.test_sqrt.test_decode_sqrt_data_task | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:function:: sample_punchdata() | ||
Generate a sample PUNCHData object for testing | ||
|
||
|
||
.. py:function:: test_encoding() | ||
.. py:function:: test_decoding() | ||
.. py:function:: test_encode_then_decode(from_bits, to_bits) | ||
.. py:function:: test_decode_sqrt_data_task(sample_punchdata) | ||
Test the decode_sqrt_data prefect task using a test harness | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.