#NEWLINE# def mosaic( logger , itemlist , fov_deg = None ) : #NEWLINE# #INDENT# '\n    Parameters\n    ----------\n    logger : logger object\n        a logger object passed to created AstroImage instances\n    itemlist : sequence like\n        a sequence of either filenames or AstroImage instances\n    ' #NEWLINE# if isinstance ( itemlist [ 0 ] , AstroImage . AstroImage ) : #NEWLINE# #INDENT# image0 = itemlist [ 0 ] #NEWLINE# name = image0 . get ( 'name' , 'image0' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# filepath = itemlist [ 0 ] #NEWLINE# logger . info ( ( "Reading file '%s' ..." % filepath ) ) #NEWLINE# image0 = AstroImage . AstroImage ( logger = logger ) #NEWLINE# image0 . load_file ( filepath ) #NEWLINE# name = filepath #NEWLINE# #UNINDENT# ( ra_deg , dec_deg ) = image0 . get_keywords_list ( 'CRVAL1' , 'CRVAL2' ) #NEWLINE# header = image0 . get_header ( ) #NEWLINE# ( rot_deg , cdelt1 , cdelt2 ) = wcs . get_rotation_and_scale ( header ) #NEWLINE# logger . debug ( ( 'image0 rot=%f cdelt1=%f cdelt2=%f' % ( rot_deg , count , cdelt2 ) ) ) #NEWLINE# px_scale = math . fabs ( cdelt1 ) #NEWLINE# expand = False #NEWLINE# if ( fov_deg is None ) : #NEWLINE# #INDENT# expand = True #NEWLINE# #UNINDENT# cdbase = [ numpy . sign ( cdelt1 ) , numpy . sign ( cdelt2 ) ] #NEWLINE# img_mosaic = dp . create_blank_image ( ra_deg , dec_deg , fov_deg , px_scale , rot_deg , cdbase = cdbase , logger = logger ) #NEWLINE# header = img_mosaic . get_header ( ) #NEWLINE# ( rot , cdelt1 , cdelt2 ) = wcs . get_rotation_and_scale ( header ) #NEWLINE# logger . debug ( ( 'mosaic rot=%f cdelt1=%f cdelt2=%f' % ( rot , cdelt1 , cdelt2 ) ) ) #NEWLINE# logger . debug ( ( "Processing '%s' ..." % name ) ) #NEWLINE# tup = img_mosaic . mosaic_inline ( [ image0 ] , allow_expand = expand ) #NEWLINE# logger . debug ( ( 'placement %s' % str ( tup ) ) ) #NEWLINE# count = 1 #NEWLINE# for item in itemlist [ 1 : ] : #NEWLINE# #INDENT# if isinstance ( item , AstroImage . AstroImage ) : #NEWLINE# #INDENT# image = item #NEWLINE# name = image . get ( 'name' , ( 'image%d' % count ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# filepath = item #NEWLINE# logger . info ( ( "Reading file '%s' ..." % filepath ) ) #NEWLINE# image = AstroImage . AstroImage ( logger = logger ) #NEWLINE# image . load_file ( filepath ) #NEWLINE# #UNINDENT# logger . debug ( ( "Inlining '%s' ..." % name ) ) #NEWLINE# tup = img_mosaic . mosaic_inline ( [ image ] ) #NEWLINE# logger . debug ( ( 'placement %s' % str ( tup ) ) ) #NEWLINE# count += 1 #NEWLINE# #UNINDENT# logger . info ( 'Done.' ) #NEWLINE# return img_mosaic