Skip to content

Commit

Permalink
Merge pull request #2 from DES-SL/documentation_dev
Browse files Browse the repository at this point in the history
add documentation for class and init variables
  • Loading branch information
rmorgan10 authored Dec 14, 2020
2 parents bbcc77c + 9e7d9f7 commit 39ea62d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,35 @@
# also TODO: PSFs

class CutoutProducer:
"""
Class to produce cutouts of all objects on a specified DES tile.
Based on the provided tilename, the CutoutProducer locates and reads a
compressed text file (referred to as metadata) specific to the tile. The
metadata contains the object COADD_OBJECT_ID, RA, and DEC (among other
properties) in a tabular format.
The objects in the tile are then located using the FITS header of the
DES tile file and the RA, DEC of each object.
Image cutouts of the same size in each band are then stored in an array
of size (num_objects, num_bands, cutout_size, cutout_size) and saved to a
FITS file.
"""
def __init__(self, tilename, cutout_size):
"""
Initialize a CutoutProducer.
:param tilename: (str) name of DES tile; something like 'DES0536-5457'
:param cutout_size: (int) side length in pixels of desired cutouts
"""
self.metadata_path = "/data/des81.b/data/stronglens/Y6_CUTOUT_METADATA/"
self.metadata_suffix = ".tab.gz"
self.tilename = tilename
self.cutout_size = cutout_size
self.read_metadata()
return

def read_metadata(self):
"""
Expand Down Expand Up @@ -172,6 +195,7 @@ def produce_cutout_file(self, image_array, out_dir=''):
if not out_dir.endswith('/') and out_dir != '':
out_dir += '/'
hdu_list.writeto(f'{out_dir}{self.tilename}.fits', overwrite=True)
return


if __name__ == "__main__":
Expand Down

0 comments on commit 39ea62d

Please sign in to comment.