punchbowl.data.io#

Attributes#

Functions#

write_file_hash(→ None)

Create a SHA-256 hash for a file.

get_base_file_name(→ str)

Determine the base file name without file type extension.

write_ndcube_to_jp2(→ None)

Write an NDCube as a JPEG2000 file.

write_ndcube_to_fits(→ None)

Write an NDCube as a FITS file.

_pack_uncertainty(→ numpy.ndarray)

Compress the uncertainty for writing to file.

_unpack_uncertainty(→ numpy.ndarray)

Uncompress the uncertainty when reading from a file.

_update_statistics(→ None)

Update image statistics in metadata before writing to file.

load_ndcube_from_fits(→ ndcube.NDCube)

Load an NDCube from a FITS file.

Module Contents#

punchbowl.data.io._ROOT = b'.'#
punchbowl.data.io.write_file_hash(path: str) None#

Create a SHA-256 hash for a file.

punchbowl.data.io.get_base_file_name(cube: ndcube.NDCube) str#

Determine the base file name without file type extension.

punchbowl.data.io.write_ndcube_to_jp2(cube: ndcube.NDCube, filename: str, layer: int | None = None, vmin: float = 1e-15, vmax: float = 8e-13) None#

Write an NDCube as a JPEG2000 file.

punchbowl.data.io.write_ndcube_to_fits(cube: ndcube.NDCube, filename: str, overwrite: bool = True, write_hash: bool = True, skip_stats: bool = False, uncertainty_quantize_level: float = 16) None#

Write an NDCube as a FITS file.

punchbowl.data.io._pack_uncertainty(cube: ndcube.NDCube) numpy.ndarray#

Compress the uncertainty for writing to file.

punchbowl.data.io._unpack_uncertainty(uncertainty_array: numpy.ndarray, data_array: numpy.ndarray) numpy.ndarray#

Uncompress the uncertainty when reading from a file.

punchbowl.data.io._update_statistics(cube: ndcube.NDCube) None#

Update image statistics in metadata before writing to file.

punchbowl.data.io.load_ndcube_from_fits(path: str | pathlib.Path, key: str = ' ', include_provenance: bool = True) ndcube.NDCube#

Load an NDCube from a FITS file.