PRO wlsg, lbl ;lbl = strcompress(string(lbl),/remove_all ;loc = '/auto/home2/jmason86/big_run1/solignis/data/'+lbl+'/' cd, lbl readcol, +lbl+'_av_NL_grad.dat', fits_id, grad, format = 'a,f', /silent readcol, +lbl+'_NL_length.dat', fits_id, len, format = 'a,f', /silent sz = n_elements(grad) -1 WLSG = fltarr(sz+1) for i = 0, sz DO BEGIN WLSG(i) = grad(i) * len(i) openw, 1, +lbl+'_WLSG.dat', /append printf, 1, fits_id(i), WLSG(i) close, 1 ENDFOR ;TIME ;loop for running all fits files openr, 1, +lbl+'_NL_length.dat' while not eof(1) DO BEGIN fits_lbl = '' & readf, 1, fits_lbl & fits_lbl = strmid(fits_lbl,0,9) fits = readfits('fits/fd_M_96m_01d.'+fits_lbl+'.fits',hd) ;get date, ascending time and time in UTC asc_time = string(fxpar(hd, 'OBT_TIME')) ;time that always increases nor_time = strmid(fxpar(hd, 'T_REC'),11,8) ;time using TAI date1 = strmid(fxpar(hd, 'T_REC'),0,4) + '-' + strmid(fxpar(hd,'T_REC'),5,2) + '-' + strmid(fxpar(hd,'T_REC'), 8,2) close, 4 & openw, 4, 'calc/'+lbl+'_time.dat',/append printf, 4, fits_lbl, ': ', asc_time, ' ', nor_time, ' ', date1 ENDWHILE END