Attachment 'get_param.py'

Download

   1 import characterize_variability as var
   2 import pyfits
   3 import numpy as np
   4 def call_char_var(fil):
   5       hdu=pyfits.open(fil)
   6       time=hdu[1].data.field('TIME')
   7       rate= hdu[1].data.field('RATE')
   8       rate_err= hdu[1].data.field('RATE_ERR')
   9       #ignore nan values
  10       indok=np.where(np.isnan(rate)==False)[0]
  11       time=time[indok]
  12       rate=rate[indok]
  13       rate_err=rate_err[indok]
  14       #set minimum rate to zero
  15       rate[rate<=0]=0.
  16       rate_err[rate_err<=0]=0.
  17       
  18       #remove first and last bin
  19       time=time[1:-1]
  20       rate=rate[1:-1]
  21       rate_err=rate_err[1:-1]
  22       #T0 has to be 0
  23       time=time-np.min(time)
  24       BestfitPar=var.compute_variability_parameters(rate, rate_err, time, 0.)
  25       #retrieve parameters for linear fit
  26       chi2_lin=BestfitPar.Linear  
  27       #retrieve parameters for flare fit
  28       chi2_flare=BestfitPar.Flare 
  29       #retrieve parameters for eclipse fit
  30       chi2_eclipse=BestfitPar.Eclipse 
  31       flch2p1 = float(chi2_flare[3])
  32       ecch2p1 = float(chi2_eclipse[3])
  33       snr_flare=np.sqrt(np.sum((rate-flch2p1)**2/rate_err**2))
  34       snr_eclipse=snr=np.sqrt(np.sum((rate-ecch2p1)**2/rate_err**2))
  35       return chi2_lin,chi2_flare,chi2_eclipse,snr_flare,snr_eclipse

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2019-03-14 10:44:47, 1.6 KB) [[attachment:call_get_param.py]]
  • [get | view] (2019-03-14 10:44:11, 10.1 KB) [[attachment:characterize_variability.py]]
  • [get | view] (2019-03-14 10:22:08, 19.7 KB) [[attachment:eclip_am02.0_du16.3_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:22:25, 19.7 KB) [[attachment:eclip_am04.0_du21.1_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:22:45, 19.7 KB) [[attachment:eclip_am05.8_du25.9_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:20:43, 19.7 KB) [[attachment:flare_am05.2_du07.6_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:21:25, 19.7 KB) [[attachment:flare_am11.0_du04.5_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:21:44, 19.7 KB) [[attachment:flare_am15.0_du03.9_040_LightCurve_source_1.fits]]
  • [get | view] (2019-03-14 10:44:32, 1.2 KB) [[attachment:get_param.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.