Exemplo n.º 1
0
print "Find extinction coefficient from photometry of standards"
standards_set = set(x for x,t in zip(list_images["objname"], list_images["type"]) if t == "standards")
coefficient_list = []
for obj in standards_set:
    input_db = os.path.join(directory, obj+".db")
    airmasses, magnitudes, filters, SNR = extract.main(input_db)
    magnitude_errors_minus, magnitude_errors_plus = snr.snr_to_error(SNR)
    mag_errors = (-magnitude_errors_minus + magnitude_errors_plus) / 2.
    for filt in set(filters.flatten()):
        # find columns with the current filter
        columns = [ii for ii in range(len(filters[0, :])) if filters[0,ii] == filt]
        # if there are more than two images
        if len(airmasses[0,columns]) > 0 and len(airmasses[0,columns]) > 2:
            ext_coeff, serror_ext_coeff = calculate_extinction(airmasses[:, columns],
                                                               magnitudes[:, columns],
                                                               err_magnitudes=mag_errors[:,columns])
            coefficient_list.append(ext_coeff)
            #plt.plot(airmasses[:, columns], magnitudes[:, columns], 'o')
            #plt.show()
            print "Extinction coefficient for ", obj, " for filter ", filt, ":", ext_coeff, "+/-", serror_ext_coeff
        else:
            print "Not used ",  obj, " with filter " + filt + ". Too few elements."

ext_coeff, serror_ext_coeff =  np.mean(coefficient_list), np.std(coefficient_list) / np.sqrt(len(coefficient_list) - 1)
print "Mean extinction = ", ext_coeff, "+/-", serror_ext_coeff


# Equate PSFs for scientific objects
SciObj_set = set(x for x,t in zip(list_images["objname"], list_images["type"]) if t in ["cig", "clusters"])
for obj in SciObj_set:
Exemplo n.º 2
0
                              "--aperture", "4.", "--annulus", "6", "--dannulus", "2", "--individual-fwhm", "--objectk", objectk,
                              "--filterk", filterk, "--datek", datek, "--expk", exptimek, "--fwhmk", seeingk, "--airmk", airmassk,
                              "--coordinates", coord_file, obj_images[0]] + obj_images + [output_db])

print "Find extinction coefficient from photometry of standards"
standards_set = set(x for x,t in zip(list_images["objname"], list_images["type"]) if t == "standards")
coefficient_list = []
for obj in standards_set:
    input_db = os.path.join(directory, obj+".db")
    airmasses, magnitudes, filters = extract.main(input_db)
    for filt in set(filters.flatten()):
        # find columns with the current filter
        columns = [ii for ii in range(len(filters[0, :])) if filters[0,ii] == filt]
        # if there are more than two images
        if len(airmasses[0,columns]) > 0 and len(airmasses[0,columns]) > 2:
            ext_coeff, sigma_ext_coeff = calculate_extinction(airmasses[:, columns], magnitudes[:, columns])
            coefficient_list.append(ext_coeff)
            plt.plot(airmasses[:, columns], magnitudes[:, columns], 'o')
            plt.show()
            print "Extinction coefficient for ", obj, " for filter ", filt, ":", ext_coeff, "+/-", sigma_ext_coeff
        else:
            print "Not used ",  obj, " with filter " + filt + ". Too few elements."

ext_coeff, sigma_ext_coeff =  np.mean(coefficient_list), np.std(coefficient_list)
print "Extinction = ", ext_coeff, "+/-", sigma_ext_coeff

# Equate PSFs for scientific objects
SciObj_set = set(x for x,t in zip(list_images["objname"], list_images["type"]) if t in ["cig", "clusters"])
for obj in SciObj_set:
    obj_images = list(list_images["filename"][np.where(list_images["objname"] == obj)])
    stars_images = [utils.replace_extension(ii, "radec") for ii in obj_images]