Exemplo n.º 1
0
def find_required_apertures(input_list,starting_pos):
    temp = []
    for i in range(len(input_list)):
        temp.append([i,input_list[i]])
    input_list = temp

    sequence = []
    input_list = functions.sort_array(input_list,1)
    n = 0
    i = 1
    while n <= no_apertures-1:
        dist = abs(input_list[len(input_list)-i][0] - starting_pos)
        if dist <= float(no_apertures):
            sequence.append(input_list[len(input_list)-i][0])
            i = i+1
            n = n+1
        else:
            n = n
            i = i+1
    return sequence
Exemplo n.º 2
0
    phase_n,flux_n,err_n,model_n = fitting_functions.lc_chisq(free_param_vals,free_param_names,fixed_param_names,fixed_param_vals,lc,False,True,cadence[n])
    phase += list(phase_n)
    flux += list(flux_n)
    err += list(err_n)
    model += list(model_n)

####################
### Plot transit ###
####################
phase,flux,err,model = array(phase),array(flux),array(err),array(model)

plt.figure(figsize=(8,10))

### Sort in phase
data = transpose([phase,flux,err,model])
data = functions.sort_array(data,0)
phase,flux,err,model = transpose(data)

### Plot data
plt.clf()
plt.subplot(211)

plt.scatter(phase,flux,s=1,color="k")
plt.scatter(phase+1,flux,s=1,color="k")

plt.scatter(phase,model,s=2,color="r")
plt.scatter(phase+1,model,s=2,color="r")

plt.xlim(0.95,1.05)
#plt.show()
Exemplo n.º 3
0
object_MJD = hdulist[0].header['MJD-OBS'] 
hdulist.close()

### Compile list of NeAr arcs
object_list = functions.ccdlist_extract(iraf.ccdlist("*.fits",Stdout = 1))
NeAr_match = functions.ccdlist_identify(object_list,"Ne-Ar")

### Open each fine and find its MJD
arc_MJD = []
for i in range(len(NeAr_match)):
    hdulist = pyfits.open(object_list[NeAr_match[i]][0])
    arc_MJD.append([abs(hdulist[0].header['MJD-OBS'] - object_MJD),object_list[NeAr_match[i]][0]])
    hdulist.close()

### Sort arc_MJD according to closest time to object exposure
arc_MJD = functions.sort_array(arc_MJD,0)

### Choose 2 arc images if the 2nd arc frame was taken <30min from object
if len(arc_MJD) > 1:
    if arc_MJD[1][0] < 0.02:
        arc_names = arc_MJD[0][1] + "\n" + arc_MJD[1][1] + "\n"
    else:
        arc_names = arc_MJD[0][1] + "\n"
else:
    arc_names = arc_MJD[0][1] + "\n"

print "Using arc frames:"
print arc_names

arc_file = open(file_path_temp + "arcs_to_use.txt","w")
arc_file.write(arc_names)
        bk_i = []

        for j in range(len(crop)):
            x.append(j)
            y.append(median(crop[j]))

            for k in bk:
                if x[j] > k[0] and x[j] < k[1]:
                    bk_i.append(median(crop[j]))

        x,y = array(x),array(y)

        slice_flux.append([n,(y[int(round(coo_x))]-median(bk_i))/std(bk_i)])

    slice_flux = functions.sort_array(slice_flux,1)
    print slice_flux

    print coo_y

    image_slices = []
    n = len(slice_flux)-1
    while n >= 0:
        if abs(slice_flux[n][0] - coo_y) < no_apertures:
            image_slices.append(slice_flux[n][0])
        if len(image_slices) < no_apertures:
            n = n-1
        else:
            n = -1

    print "using image slices",image_slices
Exemplo n.º 5
0
        lc, False, True, cadence[n])
    phase += list(phase_n)
    flux += list(flux_n)
    err += list(err_n)
    model += list(model_n)

####################
### Plot transit ###
####################
phase, flux, err, model = array(phase), array(flux), array(err), array(model)

plt.figure(figsize=(8, 10))

### Sort in phase
data = transpose([phase, flux, err, model])
data = functions.sort_array(data, 0)
phase, flux, err, model = transpose(data)

### Plot data
plt.clf()
plt.subplot(211)

plt.scatter(phase, flux, s=1, color="k")
plt.scatter(phase + 1, flux, s=1, color="k")

plt.scatter(phase, model, s=2, color="r")
plt.scatter(phase + 1, model, s=2, color="r")

plt.xlim(0.95, 1.05)
#plt.show()