예제 #1
0
def find_data_collection_interval():

    tlist = tcnv.currentTime(format='UTC')
    tyear = tlist[0]
    tyday = tlist[7]
    tdom = tcnv.YdateToDOM(tyear, tyday)

    file = data_dir + 'Disp_dir/hist_ccd3'
    f = open(file, 'r')
    data = [line.strip() for line in f.readlines()]
    f.close()

    chk = 0
    k = 1
    while (chk == 0):
        atemp = re.split('<>', data[len(data) - k])
        ldom = atemp[0]
        if mcf.chkNumeric(ldom) == True:
            ldom = int(ldom)
            chk = 1
            break
        else:
            k += 1

    ldom += 1
    return (ldom, tdom)
예제 #2
0
def collect_data(dir, col_list, outfile, eline):

    #
    #--- now loop through year and ydate
    #
    for year in range(2015, 2017):
        for month in range(1, 13):

            if year == 2014 and month < 12:
                continue

            chk = tcnv.isLeapYear(year)
            if (year == 2016) and (month > 6):
                break

            print "Date year: " + str(year) + ' month: ' + str(
                month) + ' : ' + str(dir)

            try:
                line = extract_new_data(dir, col_list, year, month)
            except:
                line = 'na'
                cmd = 'rm ./mta*fits* ./Working_dir/mta*fits*'
                os.system(cmd)

            fo = open(outfile, 'a')
            if line != 'na':
                fo.write(line)
            else:
                dom = int(tcnv.YdateToDOM(year, yday))
                line = str(dom) + '\t' + eline + '\n'
                fo.write(line)

            fo.close()
예제 #3
0
def convTimeFullColumn2(time_list):
    """
    convert time format to fractional year for the entire array
    Input:  time_list   --- a list of time 
    Output: converted   --- a list of tine in dom
    """

    converted = []
    for ent in time_list:
        time = tcnv.dateFormatConAll(ent)
        year = time[0]
        ydate = time[6]
        dom = tcnv.YdateToDOM(year, ydate)
        converted.append(dom)

    return converted
예제 #4
0
def fyear_to_dom(dlist):

    dom_list = []
    for ent in dlist:
        year = int(ent)
        fy = ent - year
        if tcnv.isLeapYear(year) == 1:
            base = 366
        else:
            base = 365
        ydate = int(base * fy)

        dom = tcnv.YdateToDOM(year, ydate)
        dom_list.append(dom)

    return dom_list
예제 #5
0
def print_main_head_part(fo, new_bad_pix_list, new_hot_pix_list,
                         new_col_pix_list):

    localt = tcnv.currentTime('UTC')
    tyear = int(localt[0])
    tyday = int(localt[7])
    dom = tcnv.YdateToDOM(tyear, tyday)

    dispt = tcnv.currentTime('Display')
    atemp = re.split('\s+', dispt)
    dtime = atemp[0] + ' ' + atemp[1] + ' ' + atemp[2] + ', ' + atemp[4]

    hfile = house_keeping + 'head'
    head_part = open(hfile, 'r').read()
    head_part = head_part.replace('#DISPLAY# ', dtime)
    head_part = head_part.replace('#YDATE#', str(tyday))
    head_part = head_part.replace('#DOM#', str(dom))

    line = ''
    chk = 0
    for i in range(0, 10):
        if new_bad_pix_list[i][0] != '':
            chk += 1
            line = line + 'CCD' + str(i) + ': '
            for ent in new_bad_pix_list[i]:
                line = line + ent
            line = line + '<br />\n'
    if chk == 0:
        line = 'No New Warm Pixel'

    head_part = head_part.replace('#WARMPIX#', line)

    line = ''
    chk = 0
    for i in range(0, 10):
        if new_hot_pix_list[i][0] != '':
            chk += 1
            line = line + 'CCD' + str(i) + ': '
            for ent in new_hot_pix_list[i]:
                line = line + ent
            line = line + '<br />\n'
    if chk == 0:
        line = 'No New Hot Pixel'

    head_part = head_part.replace('#HOTPIX#', line)

    line = ''
    chk = 0
    for i in range(0, 10):
        if new_col_pix_list[i][0] != '':
            chk += 1
            line = line + 'CCD' + str(i) + ': '
            for ent in new_col_pix_list[i]:
                line = line + ent
            line = line + '<br />\n'
    if chk == 0:
        line = 'No New Warm Column'

    head_part = head_part.replace('#WARMCOL#', line)

    fo.write(head_part)