Exemplo n.º 1
0
else:
    fits_list = readfile(list_name)
if len(argv) == 3:
    ecc = argv[1]
    ecc = float(ecc)
#----------------------------------------------------------------------
# main code
if VERBOSE > 0: print "number of under processed fits:", len(fits_list)
for name in fits_list:
    if VERBOSE > 0: print "--- {0} ---".format(name)
    data = pyfits.getdata(name)
    imh = pyfits.getheader(name)
    exptime = imh['EXPTIME']
    exptime = float(exptime)
    if VERBOSE > 0: print exptime
    paras, cov = curvefit.hist_gaussian_fitting(name, data, shift=-7)
    data_mean = paras[0]
    data_std = paras[1]
    # peak list is a list contain elements with position tuple.
    sz = 24
    tl = 15
    peak_list = []
    while len(peak_list) > 500 or len(peak_list) < 3:
        sz += 1
        peak_list = curvefit.get_peak_filter(data, tall_limit=tl, size=sz)
    # star list is a list contain elements with star in this fits
    # we want to control the number of stars within 20.
    hwl = 3

    star_list = []
    while len(star_list) > 50 or len(star_list) < 3:
Exemplo n.º 2
0
path_of_result = tat_datactrl.get_path("result")
ref_name ="{2}/reference/{1}_{0}.fits".format(date_name[:-4], obj_name, path_of_result)
if VERBOSE>1 :
        print " "
        print "--- ", ref_name, " ---"
try:
    ref_data = pyfits.getdata(ref_name+"pass")
except:
    ref_name = fits_list[0]
    del fits_list[0]
    if VERBOSE>1:
        print "No reference, use the first image as reference."
        print " "
        print "--- ", ref_name, " ---"
    ref_data = pyfits.getdata(ref_name)
ref_paras, ref_cov = curvefit.hist_gaussian_fitting("default", ref_data)
ref_data_mean = ref_paras[0]
ref_data_std = ref_paras[1]
if VERBOSE>1:
    print "mean: ", ref_data_mean, "std: ", ref_data_std
# test hwo many peak in this figure.
# If too much, raise up the limitation of size
sz = 29
tl = 5
ref_peak_list = []
while len(ref_peak_list) >500 or len(ref_peak_list) < 3:
    sz +=1
    ref_peak_list = curvefit.get_peak_filter(ref_data, tall_limit = tl, size = sz)
if VERBOSE>3:
    print "peak list: "
    for peak in ref_peak_list:
Exemplo n.º 3
0
            os.system(temp)
            wrong = True
            break
    if wrong:
        continue
    # If the ccd temperature is too high, abandom this fit.
    img_temp = darkh['CCDTEMP']
    if img_temp >= -29.5:
        bad_img_count += 1
        temp = "mv {0} X_{0}_X".format(image_list[i])
        if VERBOSE > 1: print temp
        os.system(temp)
        continue
    # save the bkg and stdev of each img.
    data = pyfits.getdata(image_list[i])
    params, cov = curvefit.hist_gaussian_fitting("default", data, shift=-7)
    data_mean = params[0]
    data_std = params[1]
    if VERBOSE > 1: print "mean = {0}, stdev = {1}".format(data_mean, data_std)
    bkg_array[i] = data_mean
    noise_array[i] = data_std
    if VERBOSE > 0: print image_list[i], ",checked"

# check whether the image over exposure or not.
mean_bkg = np.mean(bkg_array[np.nonzero(bkg_array)])
std_bkg = np.std(bkg_array[np.nonzero(bkg_array)])
temp_bkg_array = np.subtract(bkg_array, mean_bkg)
abs_bkg_array = np.absolute(temp_bkg_array)

mean_noise = np.mean(noise_array[np.nonzero(noise_array)])
std_noise = np.std(noise_array[np.nonzero(noise_array)])
Exemplo n.º 4
0
#!/usr/bin/env python
'''
try poisson fitting and gaussian
'''
import numpy as np
import curvefit
from sys import argv
import pyfits
imA_name = argv[-1]
imA = pyfits.getdata(imA_name, dtype=float)
paras, cov = curvefit.hist_gaussian_fitting(
    "gaussian_fitting :{0}".format(imA_name), imA, VERBOSE=4)