imaginglss.model.imagerepo module

class imaginglss.model.imagerepo.ImageRepo(root, pattern, image_hdu)[source]

Bases: object

Image repository.

This class serves as an interface to the file system, the layout of files and IO for brick files. Given a Brick object, ImageRepo can return the image data or meta data of the image. Standard users should not need to modify this class.

get_filename(brick, **kwargs)[source]

Generate a filename.

Generate a filename for a brick.

Parameters:

brick : brick.Brick

the brick whose filename will be generated.

Notes

We also try to generate a .gz filename, if the original filename does not exist.

metadata(brick, **kwargs)[source]

Fetch the meta data about a brick.

Parameters:

brick : Brick

the brick whose metadata will be loaded

Returns:

metadata : dict

the metadata as a dictionary. Currently this is the FITS header

open(brick, **kwargs)[source]

Open and read an image.

The image for Brick object brick is read into memory and returned. If the image is already in cache, return the cache.

This function does not add the image to cache.

Parameters:

brick : Brick

the brick whose image will be loaded

Returns:

image : array_like

the image as an ndarray, as the ordering in FITS files. (index with (y, x))

preload(bricks, **kwargs)[source]

Preload images into the cache

This function loads images for given bricks into the cache. In generate the function is not useful, and we shall try to remove it soon.

Parameters:

bricks : list, Brick

the bricks whose images will be loaded