Exemplo n.º 1
0
# value, in order to interpolate a value for a simulated curve follwing the same
# sampling pattern as the data 
 
simtime = np.array([(xtime - xtime[0]).astype(int),xtime - xtime.astype(int)])

simarray = [[] for h in range(n_bins)] 		# binned, simulted CCF array

first = 1
shows = 0

# for n curves....
for curve in range(ncurves):

	# -- simulate curve --

	lc  = lcsim(xflux,xtime,psdindexlow, psdindexhigh, psdbrkfreq,
				np.mean(xflux),np.std(xflux),curve) 		# simulate curve
	
	# -- interpolate values with data sampling pattern --
	
	lcsamp = []
	for val in range(len(simtime[0])):
		index = simtime[0][val]		# index of nearest value in time (before)
		
		# interpolate amplitude from nearest two values & gradient between them
		intval= lc[index] + ( lc[index+1]-lc[index] ) * ( simtime[1][val] )
		
		lcsamp.append(intval) # sampled simulated lightcurve
	
	# -- cross correlate with 2nd data set --
	
	sxc, stl, sba = xcor(rflux,rfluxerr, rtime, lcsamp,np.zeros(len(lcsamp)), xtime,  n_bins,t_lim,t_range)
Exemplo n.º 2
0
# below each xray time and the time difference
 
for n in xtime:
	simtime[0].append( int(n) - xtime[0] )
	simtime[1].append( n - int(n) )	

# --- simulate and create array of xcor fns of simulated light curves ----------

simarray = [[] for h in range(n_bins)]
first = 1

for curve in range(ncurves):

	# -- simulate curves, applying the sampling pattern of the data curve --

	lc  = lcsim(psdindexlow, psdindexhigh, psdbrkfreq,curve)# simulate curve
	
	# interpolate values with data sampling pattern

	lcsamp = []
	
	for val in range(len(simtime[0])):
	
		intval= lc[int(simtime[0][val])] + ( lc[int(simtime[0][val]+1)]\
			-lc[int(simtime[0][val])] ) * ( simtime[1][val] )
		lcsamp.append(intval)
	
	# -- cross correlate with second data curve and add to sorted data array 
	
	sxc, sxce, stl = xcor(rflux, rtime, lcsamp, xtime, tstart, tend, n_bins)