예제 #1
0
def make_output_directory(extraction_box_height,
                          extraction_box_start,
                          sn_name,
                          overwrite=False):
    '''
	Create an output directory for the extracted files to go into with the name
		<sn_name>_loc_<extraction_box_start>_hgt_<extraction_box_height>
	User will be asked before files are deleted if directory already exists
	'''
    output_dir = '{}_loc_{}_hgt_{}'.format(sn_name, extraction_box_start,
                                           extraction_box_height)
    repo_path = get_repository_path()
    new_dir_path = os.path.join(repo_path, output_dir)
    if os.path.exists(new_dir_path):
        if overwrite == False:
            delete_dir = raw_input(
                '{} exists, delete contents? y, n '.format(new_dir_path))
            if delete_dir == 'n':
                sys.exit(
                    'Output path already exists and you don\'t want to overwrite it'
                )
        flist = glob.glob(os.path.join(new_dir_path, 'ocdd*'))
        for ifile in flist:
            os.remove(ifile)
    else:
        os.makedirs(new_dir_path)
    return new_dir_path
예제 #2
0
def extract_nuv_2006gy():
    '''
	Defines extraction location for 2006gy. Data taken with the NUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the NUV plate scale = 0.0248 arcsec/pix --> 1 arcsecond = 40.32 pixels.

	The dither position centers the target at ycenter = 461 (340 + 120.8)
	'''
    extraction_box_height = 20  #200 pixels
    extraction_box_start = 511.  #-100.
    dither_step = 0.

    repo_path = get_repository_path()
    output_dir = make_output_directory(extraction_box_height,
                                       extraction_box_start, '2006gy')

    extract_for_a_single_dither_position(['10'],
                                         1,
                                         dither_step,
                                         repo_path,
                                         output_dir,
                                         extraction_box_start,
                                         extraction_box_height,
                                         maxsearch=0)
예제 #3
0
def extract_fuv_2010jl():
	'''
	Defines extraction location for 2010jl. Data taken with the FUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the FUV plate scale = 0.0246 arcsec/pix --> 1 arcsecond = 40.6504065 pixels.

	The dither position centers the target at ycenter = 340
	'''
	extraction_box_height = 21 #pixels
	extraction_box_start = 195.+132. #340
	dither_step = 40.65

	repo_path = get_repository_path()
	output_dir = make_output_directory(extraction_box_height, extraction_box_start, '2010jl')


	extract_for_a_single_dither_position(['10', '50', '90'], 1, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height)


	extract_for_a_single_dither_position(['20', '60', 'a0'], 2, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height)

	extract_for_a_single_dither_position(['30', '70', 'b0'], 3, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height)

	extract_for_a_single_dither_position(['40', '80', 'c0'], 4, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height)
예제 #4
0
def extract_nuv_2010jl():
    '''
	Defines extraction location for 2010jl. Data taken with the NUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the NUV plate scale = 0.0248 arcsec/pix --> 1 arcsecond = 40.32 pixels.

	The dither position centers the target at ycenter = 461 (340 + 120.8)
	'''
    extraction_box_height = 21  #pixels
    extraction_box_start = 262. + 61.
    dither_step = 40.32

    repo_path = get_repository_path()
    output_dir = make_output_directory(extraction_box_height,
                                       extraction_box_start, '2010jl')

    extract_for_a_single_dither_position(['d0', 'h0'],
                                         1,
                                         dither_step,
                                         repo_path,
                                         output_dir,
                                         extraction_box_start,
                                         extraction_box_height,
                                         maxsearch=0)

    extract_for_a_single_dither_position(['e0', 'i0'],
                                         2,
                                         dither_step,
                                         repo_path,
                                         output_dir,
                                         extraction_box_start,
                                         extraction_box_height,
                                         maxsearch=0)

    extract_for_a_single_dither_position(['f0', 'j0'],
                                         3,
                                         dither_step,
                                         repo_path,
                                         output_dir,
                                         extraction_box_start,
                                         extraction_box_height,
                                         maxsearch=0)

    extract_for_a_single_dither_position(['g0', 'k0'],
                                         4,
                                         dither_step,
                                         repo_path,
                                         output_dir,
                                         extraction_box_start,
                                         extraction_box_height,
                                         maxsearch=0)
예제 #5
0
def make_output_directory(extraction_box_height, extraction_box_start, sn_name, overwrite = False):
	'''
	Create an output directory for the extracted files to go into with the name
		<sn_name>_loc_<extraction_box_start>_hgt_<extraction_box_height>
	User will be asked before files are deleted if directory already exists
	'''
	output_dir = '{}_loc_{}_hgt_{}'.format(sn_name, extraction_box_start, extraction_box_height)
	repo_path = get_repository_path()
	new_dir_path = os.path.join(repo_path, output_dir)
	if os.path.exists(new_dir_path):
		if overwrite == False:
			delete_dir = raw_input('{} exists, delete contents? y, n '.format(new_dir_path))
			if delete_dir == 'n':
				sys.exit('Output path already exists and you don\'t want to overwrite it')
		flist = glob.glob(os.path.join(new_dir_path, 'ocdd*'))
		for ifile in flist:
			os.remove(ifile)
	else:
		os.makedirs(new_dir_path)
	return new_dir_path
예제 #6
0
def extract_fuv_2006gy():
	'''
	Defines extraction location for 2006gy. Data taken with the FUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the FUV plate scale = 0.0246 arcsec/pix --> 1 arcsecond = 40.6504065 pixels.

	The dither position centers the target at ycenter = 340
	'''
	extraction_box_height = 20 #64 pixels
	extraction_box_start = 509.#-32. #340
	dither_step = 0.

	repo_path = get_repository_path()
	output_dir = make_output_directory(extraction_box_height, extraction_box_start, '2006gy')


	extract_for_a_single_dither_position(['30'], 1, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height)
예제 #7
0
def extract_fuv_2006gy():
    '''
	Defines extraction location for 2006gy. Data taken with the FUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the FUV plate scale = 0.0246 arcsec/pix --> 1 arcsecond = 40.6504065 pixels.

	The dither position centers the target at ycenter = 340
	'''
    extraction_box_height = 20  #64 pixels
    extraction_box_start = 509.  #-32. #340
    dither_step = 0.

    repo_path = get_repository_path()
    output_dir = make_output_directory(extraction_box_height,
                                       extraction_box_start, '2006gy')

    extract_for_a_single_dither_position(['30'], 1, dither_step, repo_path,
                                         output_dir, extraction_box_start,
                                         extraction_box_height)
예제 #8
0
def extract_nuv_2006gy():
	'''
	Defines extraction location for 2006gy. Data taken with the NUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the NUV plate scale = 0.0248 arcsec/pix --> 1 arcsecond = 40.32 pixels.

	The dither position centers the target at ycenter = 461 (340 + 120.8)
	'''
	extraction_box_height = 20 #200 pixels
	extraction_box_start = 511.#-100.
	dither_step = 0.

	repo_path = get_repository_path()
	output_dir = make_output_directory(extraction_box_height, extraction_box_start, '2006gy')


	extract_for_a_single_dither_position(['10'], 1, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height,
										maxsearch = 0)
예제 #9
0
def copy_files_for_2010jl():
	'''
	Check if files for 2010jl need to be copied to Dropbox. Copy if they do.
	'''
	copy_to_directory = '/Users/abostroem/Dropbox/13287/2010jl'
	copy_from_directory = get_repository_path()

	#Copy plots to dropbox
	plot_filenames = [
		'2010jl_combined_labeled.pdf',
		'2010jl_finder_image_fuv.pdf',
		'2010jl_nuv_fuv_xd_profile_compare_man_shift.pdf',
		'2010jl_nuv_fuv_xd_profile_compare.pdf',
		'2010jl_xd_profile_for_each_dither_fuv.pdf',
		'2010jl_xd_profile_for_each_dither_nuv.pdf',
		'xd_profile_match.pdf',
		]

	#Copy combined fits files
	fits_filenames = [
		'2010jl_all_x1dsum.fits',
		'2010jl_loc_340_hgt_21/2010jl_fuv_x1dsum.fits',
		'2010jl_loc_461_hgt_21/2010jl_nuv_x1dsum.fits'
		]
	copy_if_new_version_exists(plot_filenames, copy_to_directory, copy_from_directory)

	#Copy FUV x1d files and confirmation plots
	xtrac_directory = '2010jl_loc_340_hgt_21'
	xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf')) + \
			glob.glob(os.path.join(xtrac_directory, '*x1d.fits'))

	copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)

	#Copy NUV x1d files and confirmation plots
	xtrac_directory = '2010jl_loc_461_hgt_21'
	xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf')) + \
			glob.glob(os.path.join(xtrac_directory, '*x1d.fits'))

	copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)
예제 #10
0
def copy_files_for_2010jl():
	'''
	Check if files for 2010jl need to be copied to Dropbox. Copy if they do.
	'''
	copy_to_directory = '/Users/abostroem/Dropbox/13287/2010jl'
	copy_from_directory = get_repository_path()

	#Copy plots to dropbox
	plot_filenames = [
		'2010jl_combined_labeled.pdf',
		'2010jl_finder_image_fuv.pdf',
		'2010jl_nuv_fuv_xd_profile_compare_man_shift.pdf',
		'2010jl_nuv_fuv_xd_profile_compare.pdf',
		'2010jl_xd_profile_for_each_dither_fuv.pdf',
		'2010jl_xd_profile_for_each_dither_nuv.pdf',
		'xd_profile_match.pdf',
		]

	#Copy combined fits files
	fits_filenames = [
		'2010jl_all_x1dsum.fits',
		'2010jl_loc_340_hgt_21/2010jl_fuv_x1dsum.fits',
		'2010jl_loc_461_hgt_21/2010jl_nuv_x1dsum.fits'
		]
	copy_if_new_version_exists(plot_filenames, copy_to_directory, copy_from_directory)

	#Copy FUV x1d files and confirmation plots
	xtrac_directory = '2010jl_loc_340_hgt_21'
	xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf')) + \
			glob.glob(os.path.join(xtrac_directory, '*x1d.fits'))

	copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)

	#Copy NUV x1d files and confirmation plots
	xtrac_directory = '2010jl_loc_461_hgt_21'
	xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf')) + \
			glob.glob(os.path.join(xtrac_directory, '*x1d.fits'))

	copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)
예제 #11
0
def extract_nuv_2010jl():
	'''
	Defines extraction location for 2010jl. Data taken with the NUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the NUV plate scale = 0.0248 arcsec/pix --> 1 arcsecond = 40.32 pixels.

	The dither position centers the target at ycenter = 461 (340 + 120.8)
	'''
	extraction_box_height = 21 #pixels
	extraction_box_start = 262.+61.
	dither_step = 40.32

	repo_path = get_repository_path()
	output_dir = make_output_directory(extraction_box_height, extraction_box_start, '2010jl')


	extract_for_a_single_dither_position(['d0', 'h0'], 1, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height,
										maxsearch = 0)


	extract_for_a_single_dither_position(['e0', 'i0'], 2, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height,
										maxsearch = 0)

	extract_for_a_single_dither_position(['f0', 'j0'], 3, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height,
										maxsearch = 0)

	extract_for_a_single_dither_position(['g0', 'k0'], 4, dither_step,
										repo_path, output_dir,
										extraction_box_start, extraction_box_height,
										maxsearch = 0)
예제 #12
0
def extract_fuv_2010jl():
    '''
	Defines extraction location for 2010jl. Data taken with the FUV MAMA using 4 along
	the slit dithers.

	The MAMA along-the-slit dither pattern is specified with point spacing = 1 arcseconds
	For the FUV plate scale = 0.0246 arcsec/pix --> 1 arcsecond = 40.6504065 pixels.

	The dither position centers the target at ycenter = 340
	'''
    extraction_box_height = 21  #pixels
    extraction_box_start = 195. + 132.  #340
    dither_step = 40.65

    repo_path = get_repository_path()
    output_dir = make_output_directory(extraction_box_height,
                                       extraction_box_start, '2010jl')

    extract_for_a_single_dither_position(['10', '50', '90'], 1, dither_step,
                                         repo_path, output_dir,
                                         extraction_box_start,
                                         extraction_box_height)

    extract_for_a_single_dither_position(['20', '60', 'a0'], 2, dither_step,
                                         repo_path, output_dir,
                                         extraction_box_start,
                                         extraction_box_height)

    extract_for_a_single_dither_position(['30', '70', 'b0'], 3, dither_step,
                                         repo_path, output_dir,
                                         extraction_box_start,
                                         extraction_box_height)

    extract_for_a_single_dither_position(['40', '80', 'c0'], 4, dither_step,
                                         repo_path, output_dir,
                                         extraction_box_start,
                                         extraction_box_height)
예제 #13
0
def copy_files_for_2005ip():
	'''
	Check if files for 2005ip need to be copied to Dropbox. Copy if they do.
	'''
	copy_to_directory = '/Users/abostroem/Dropbox/13287/2005ip'
	copy_from_directory = get_repository_path()

	#Copy plots
	plot_filenames = [
		'2005ip_combined_labeled.pdf',
		'2005ip_otfr_quicklook.pdf'
		]
	#Copy combined fits files
	fits_filenames = [
		'2005ip_all_x1dsum.fits',
		'2005ip_otfr/2005ip_fuv_x1dsum.fits',
		'2005ip_otfr/2005ip_nuv_x1dsum.fits'
		]

	#Copy confirmation plots
	xtrac_directory = '2005ip_otfr'
	xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf'))

	copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)
예제 #14
0
def copy_files_for_2005ip():
	'''
	Check if files for 2005ip need to be copied to Dropbox. Copy if they do.
	'''
	copy_to_directory = '/Users/abostroem/Dropbox/13287/2005ip'
	copy_from_directory = get_repository_path()

	#Copy plots
	plot_filenames = [
		'2005ip_combined_labeled.pdf',
		'2005ip_otfr_quicklook.pdf'
		]
	#Copy combined fits files
	fits_filenames = [
		'2005ip_all_x1dsum.fits',
		'2005ip_otfr/2005ip_fuv_x1dsum.fits',
		'2005ip_otfr/2005ip_nuv_x1dsum.fits'
		]

	#Copy confirmation plots
	xtrac_directory = '2005ip_otfr'
		xtrac_flist = glob.glob(os.path.join(xtrac_directory, '*.pdf'))

		copy_if_new_version_exists(xtrac_flist, copy_to_directory, copy_from_directory)