def update_eph_l1(): """ update eph L1 related data input: none output: <out_dir>/<msid>_full_data_<year>.fits """ t_file = 'sce1300_full_data_*.fits*' out_dir = deposit_dir + 'Comp_save/Compephkey/' ifile = house_keeping + 'msid_list_ephkey' data = mcf.read_data_file(ifile) msid_list = [] for ent in data: atemp = re.split('\s+', ent) msid_list.append(atemp[0]) [tstart, tstop, year] = ecf.find_data_collecting_period(out_dir, t_file) # #--- update the data # get_data(tstart, tstop, year, msid_list, out_dir) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(out_dir)
def update_acis_ctemp(): """ update acis temp data in C input: none output: <out_dir>/<msid>_full_data_<year>fits """ t_file = '1cbat_full_data_*.fits*' out_dir = deposit_dir + '/Comp_save/Compaciscent/' ifile = house_keeping + 'msid_list_compaciscent' data = ecf.read_file_data(ifile) acis_list = [] for ent in data: atemp = re.split('\s+', ent) acis_list.append(atemp[0]) [tstart, tstop, year] = ecf.find_data_collecting_period(out_dir, t_file) get_data(tstart, tstop, year, acis_list, out_dir) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(out_dir)
def update_acis_power(): """ update acis electric pwer data input: none output: <out_dir>/1dppwra_full_data_<year>.fits, <out_dir>/1dppwrb_full_data_<year>fits """ t_file = '1dppwra_full_data_*.fits*' out_dir = deposit_dir + 'Comp_save/Compacispwr/' [tstart, tstop, year] = ecf.find_data_collecting_period(out_dir, t_file) # #--- update the data # get_data(tstart, tstop, year, out_dir) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(out_dir)
def update_sim_offset(): """ update sim offset data input: none output: <out_dir>/Comp_save/Compsimoffset/<msid>_full_data_<year>.fits """ t_file = 'flexadif_full_data_*.fits*' out_dir = deposit_dir + 'Comp_save/Compsimoffset/' [tstart, tstop, year] = ecf.find_data_collecting_period(out_dir, t_file) # #--- update the data # get_data(tstart, tstop, year, out_dir) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(out_dir)
def update_compgradkodak(): """ update compgradkodak related data sets input: none output: <out_dir>/<msid>_fill_data_<year>.fits """ t_file = 'obaavg_full_data_*.fits*' out_dir = deposit_dir + '/Comp_save/Compgradkodak/' [tstart, tstop, year] = ecf.find_data_collecting_period(out_dir, t_file) print "Period: " + str(tstart) + '<-->' + str(tstop) + ' in Year: ' + str( year) get_data(tstart, tstop, year, out_dir) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(out_dir)
def get_data(tstart, tstop, year, grad_list, out_dir): """ update msid data in msid_list for the given data period input: start --- start time in seconds from 1998.1.1 stop --- stop time in seconds from 1998.1.1 year --- the year in which data is extracted grad_list --- a list of group name in grads out_dir --- output_directory """ print("Period: " + str(tstart) + '<-->' + str(tstop) + ' in Year: ' + str(year)) # #--- extract ecach group data # for group in grad_list: print(group) line = 'operation=retrieve\n' line = line + 'dataset = mta\n' line = line + 'detector = grad\n' line = line + 'level = 0.5\n' line = line + 'filetype = ' + group + '\n' line = line + 'tstart = ' + str(tstart) + '\n' line = line + 'tstop = ' + str(tstop) + '\n' line = line + 'go\n' data_list = mcf.run_arc5gl_process(line) # #--- read the first fits file and prep for the data list # [cols, tbdata] = ecf.read_fits_file(data_list[0]) col_list = [] for ent in cols: if ent.lower() == 'time': continue mc = re.search('st_', ent.lower()) if mc is not None: continue col_list.append(ent) mcf.rm_files(data_list[0]) tdata = tbdata['time'] mdata = [] for col in col_list: mdata.append(tbdata[col]) # #--- read the rest of the data # clen = len(col_list) for k in range(1, len(data_list)): fits = data_list[k] [cols, tbdata] = ecf.read_fits_file(fits) tdata = numpy.append(tdata, tbdata['time']) for m in range(0, clen): cdata = tbdata[col_list[m]] mdata[m] = numpy.append(mdata[m], cdata) mcf.rm_files(fits) dout = out_dir + group.capitalize() + '/' if not os.path.isdir(dout): cmd = 'mkdir ' + dout os.system(cmd) # #--- write out the data to fits file # for k in range(0, clen): col = col_list[k] ocols = ['time', col.lower()] cdata = [tdata, mdata[k]] ofits = dout + col.lower() + '_full_data_' + str(year) + '.fits' if os.path.isfile(ofits): ecf.update_fits_file(ofits, ocols, cdata) else: ecf.create_fits_file(ofits, ocols, cdata) # #--- zip the fits file from the last year at the beginning of the year # ecf.check_zip_possible(dout)