deepdisc.data_format.image_readers
Classes
Base class that will read images on the fly for the training/testing dataloaders |
|
An ImageReader for DC2 image files. |
|
An ImageReader for DC2 image files. |
|
An ImageReader for DC2 image files. |
|
An ImageReader for DC2 image files. |
Module Contents
- class ImageReader(norm='raw', *args, **kwargs)[source]
Bases:
abc.ABCBase class that will read images on the fly for the training/testing dataloaders
To implement an image reader for a new class, the derived class needs to have an __init__() function that calls super().__init__(*args, **kwargs) and a custom version of _read_image().
- abstract _read_image(key)[source]
Read the image. No-op implementation.
- Parameters:
key (str or int) – The key indicating the image to read.
- Returns:
im – The image.
- Return type:
numpy array
- __call__(image)[source]
Read the image and apply scaling.
- Parameters:
image (str or numpy array) – The path indicating the image to read or image data in a numpy array with dimensions (band, h, w).
- Returns:
im – The image.
- Return type:
numpy array
- raw()[source]
Apply raw image scaling (no scaling done).
- Parameters:
im (numpy array) – The image.
- Returns:
The image with pixels as float32.
- Return type:
numpy array
- lupton(bandlist=[2, 1, 0], stretch=0.5, Q=10, m=0)[source]
Apply Lupton scaling to the image and return the scaled image.
- Parameters:
im (np array) – The image being scaled
bandlist (list[int]) – Which bands to use for lupton scaling (must be 3)
stretch (float) – lupton stretch parameter
Q (float) – lupton Q parameter
m (float) – lupton minimum parameter
- Returns:
image – The 3-channel image after lupton scaling using astropy make_lupton_rgb
- Return type:
numpy array
- zscore(A=1.0, m=0.0)[source]
Apply z-score scaling to the image and return the scaled image.
- Parameters:
im (np array) – The image being scaled
A (float) – A multiplicative scaling factor applied to each band
m (float) – A minimum pixel value. Defaults to 0.0
- Returns:
image – The image after z-score scaling (subtract mean and divide by std deviation)
- Return type:
numpy array
- class wlDC2ImageReader(bands=['u', 'g', 'r', 'i', 'z', 'y'], *args, **kwargs)[source]
Bases:
ImageReaderAn ImageReader for DC2 image files.
- class wlDC2psfImageReader(*args, **kwargs)[source]
Bases:
ImageReaderAn ImageReader for DC2 image files.
- class wlHSCImageReader(bands, *args, **kwargs)[source]
Bases:
ImageReaderAn ImageReader for DC2 image files.
- class NumpyImageReader(*args, **kwargs)[source]
Bases:
ImageReaderAn ImageReader for DC2 image files.