def jump_test(inifile): ''' to be run in /d/monk/eigenbrot/MANGA/20121015 ''' options = ConfigParser() options.read(inifile) finald = [] for d in ['d1','d2','d3','d4']: nood = N(options) nood.get_darks() nood.fill_dict(d,nood.direct) nood.sub_darks(nood.direct) nood.ratios = {'direct': {'data': {'V':{}}}} nood.direct_to_ratios(nood.direct) nood.combine() finald.append(nood.ratios['direct']['data']['V']['direct']['final']) os.system('rm *_ds.fits') print "reduction finished" countarr = np.array([]) voltarr = np.array([]) pot = thePot(options) for image in finald: hdu = pyfits.open(image)[0] fits_raw = hdu.data center = ADE.centroid(fits_raw) dist = ADE.dist_gen(fits_raw,center) * 0.024 idx = np.where(dist < 6.75) fits_data = fits_raw[idx] countarr = np.append(countarr,np.mean(fits_data)) stime = hdu.header['STARTIME'] etime = hdu.header['ENDTIME'] voltage = pot.get_voltage(stime,etime,'V') voltarr = np.append(voltarr,voltage) print "\nImage :{:>15}{:>15}{:>15}{:>15}\nCounts :{:15.3E}{:15.3E}{:15.3E}{:15.3E}\nVoltage:{:15.2f}{:15.2f}{:15.2f}{:15.2f}".format(*finald+countarr.tolist()+voltarr.tolist()) print "-"*(4*15+8) print "Ratio :{:15.3E}{:15.3E}{:15.3E}{:15.3E}\n".format(*(countarr/voltarr).tolist()) return countarr, voltarr, countarr/voltarr
def ratio_test(t_file,data_path): T = thePot(t_file) fits_list = glob(data_path+'/*.FIT') volts = np.array([]) counts = np.array([]) for fits in fits_list: print fits, HDU = pyfits.open(fits)[0] exptime = HDU.header['EXPTIME'] timestr = HDU.header['TIME-OBS'] obstime = np.float(timestr[6:])\ + np.float(timestr[3:5])*60.\ + np.float(timestr[0:2])*3600. voltage = T.get_voltage(obstime,obstime+exptime,'V') r, sb, e = ADE.fast_annulize(HDU.data,300) r *= 0.024 flux = np.cumsum(sb) rate = flux/exptime ADU = np.interp(54/10.,r,rate) print voltage, ADU volts = np.append(volts,voltage) counts = np.append(counts,ADU) fit = ADE.fit_line(volts,counts,np.ones(counts.shape)) print fit fig = plt.figure() ax = fig.add_subplot(111) ax.plot(volts,counts,'.') ax.set_xlabel('Voltage') ax.set_ylabel('ADU/s') fig.show()