예제 #1
0
파일: 3_phase.py 프로젝트: astrobel/rgredux
if smoothtype2 == "s": # smoothing

   smoothtype = raw_input('--> Boxcar or Gaussian smoothing? (b/g) ')
   while smoothtype != "b" and smoothtype != "g":
      smoothtype = raw_input('--> Please enter b or g: ')
   while True:
      try:
         kern = int(raw_input('--> Smoothing kernel: '))
         break
      except ValueError:
         print '--> Please enter an integer'
   print ' '

   # smoothing method
   if smoothtype == "b": # boxcar smoothing
      sap_flux2, smth_flux = smoothing.boxsmooth(time, sap_flux, kern)
   elif smoothtype == "g": # gaussian smoothing
      sap_flux2, smth_flux = smoothing.gausssmooth(time, sap_flux, kern)

   # plotting phase curve
   plt.figure(2)
   plt.plot(time, smth_flux, 'ro', markersize=3)
   plt.xlabel('Time mod %f days' % foldper)
   plt.ylabel('Fractional Intensity')
   exec("plt.title('%d')" % kic)
   exec("plt.savefig('kic%d_phase.png')" % kic)

elif smoothtype2 == "b": # binning
   
   while True:
      try:
예제 #2
0
   index = (j + 1) * k + (x - k) * j
   if img == 0:
      pass
   else:
      flux2 = second_flux[index,:]

      # creating a blend array to remove NaNs
      blend = np.array([time, flux2])
      blend = np.transpose(blend)
      blend2 = np.ma.compress_rows(np.ma.fix_invalid(blend))

      time2 = blend2[:,0]
      flux2 = blend2[:,1]

      if smoothtype == "b": # boxcar smoothing
         flux3, smth_flux = smoothing.boxsmooth(time2, flux2, kern)
      elif smoothtype == "g": # gaussian smoothing
         flux3, smth_flux = smoothing.gausssmooth(time2, flux2, kern)

      exec("pixel%d_flux = flux3" % index)
      exec("pixel%d_time = time2" % index)

      exec("tempflux = pixel%d_flux" % index)
      exec("temptime = pixel%d_time" % index)

      clip = inp * np.std(tempflux)
      meanflux = np.mean(tempflux)
 
      upperbound = meanflux + clip
      lowerbound = meanflux - clip
예제 #3
0
sap_flux_0 = table_0['SAP_FLUX']
#sap_flux_err_0 = table_0['SAP_FLUX_ERR']
time_0 = table_0['TIME']

hdulist.close()

# creating a blend array to remove NaNs
blend_0 = np.array([time_0, sap_flux_0])
blend_0 = np.transpose(blend_0)
blend2_0 = np.ma.compress_rows(np.ma.fix_invalid(blend_0))

time_0 = blend2_0[:,0]
sap_flux_0 = blend2_0[:,1]

if smoothtype == "b": # boxcar smoothing
   sap_flux2_0, smth_flux_0 = smoothing.boxsmooth(time_0, sap_flux_0, kern)
elif smoothtype == "g": # gaussian smoothing
   sap_flux2_0, smth_flux_0 = smoothing.gausssmooth(time_0, sap_flux_0, kern)


### FIRST QUARTER ###

hdulist = pyfits.open('kplr00skeleton-2009166043257_llc.fits')

table_1 = hdulist[1].data
sap_flux_1 = table_1['SAP_FLUX']
#sap_flux_err_1 = table_1['SAP_FLUX_ERR']
time_1 = table_1['TIME']

hdulist.close()