def generate_curve(self): """ Generates the light curve according to the parameters provided to the initiator. """ hours = 3600 days = 86400 x = np.arange(0, self.length, self.sdt) # create the time stamps z = np.zeros_like(x) # create the data array # add low frequency variation z = self.va * np.sin(2*np.pi*self.frq*x + self.phi); # Add Gaussian noise self.lc.append(pf.addNoise(z, self.mean, self.sigma)) self.ts.append(x) self.le.append(np.zeros_like(x)) self.original.append(np.zeros_like(x)) self.combine() self.detrend()
def generate_curve(self): """ Generates the light curve according to the parameters provided to the initiator. """ hours = 3600 days = 86400 x = np.arange(0, self.length, self.sdt) # create the time stamps z = np.zeros_like(x) # create the data array # add low frequency variation z = self.va * np.sin(2 * np.pi * self.frq * x + self.phi) # Add Gaussian noise self.lc.append(pf.addNoise(z, self.mean, self.sigma)) self.ts.append(x) self.le.append(np.zeros_like(x)) self.original.append(np.zeros_like(x)) self.combine() self.detrend()
def simulate_single( dt = 1765.55929, length=33.5, sigma=0.5, mean=1, amp = 1.5): """ Produce a timeseries of simulated data containing randomly generated noise and a single flare. Parameters ---------- dt : float, optional The sample time of the required data in seconds. Default is 1765.55929, the sample time of the quarter 1 *Kepler* data length : float, optional The number of days long the required data should be. Default is 33.5, the length of the quarter 1 *Kepler* data sigma : float, optional The standard deviation of the noise in the time series. Default is 0.5 mean : float, optional The mean of the noise in the time series. The default is 1. Returns ------- x : np.ndarray An array of times z : np.array An array containing the time series data, including noise o : np.array An array containing only the flares, without noise or sinusoidal variations. n : int The number of flares injected. See also -------- simulate, simulate_single_chunks """ hours = 3600 days = 86400 dt = 1765.55929 # sample interval (sec) x = np.arange(0, length*days, dt) # create the time stamps z = np.zeros_like(x) # create the data array o = np.zeros_like(x) # create clean data array # add low frequency variation va = 15*random() # amplitude of low frequency variation phi = random() # initial phase of low frequency variation frq = 0.000005*random() # frequency of variation (Hz) z = va * np.sin(2*np.pi*frq*x + phi); # add random flare #amp = 3*sigma # amplitude of flare tau1= np.floor(random()*10)/2 tau2= 0 while tau2 < tau1: tau2= np.floor(random()*10)/2 tau = [tau1*hours, tau2*hours] # decay consts of flare pos = floor(random()*len(x)) # random position t0 = x[floor(len(x)/2)] # position of flare peak z += pf.flare(amp, tau, x, t0) o += pf.flare(amp, tau, x, t0) # Add Gaussian noise z = pf.addNoise(z, mean, sigma) x = x/86400 ze = np.zeros_like(x) a = SimLightcurve() a.sigma = sigma a.ts.append(x) a.lc.append(z) a.le.append(ze) a.original.append(o) a.combine() return a
def simulate_single(dt=1765.55929, length=33.5, sigma=0.5, mean=1, amp=1.5): """ Produce a timeseries of simulated data containing randomly generated noise and a single flare. Parameters ---------- dt : float, optional The sample time of the required data in seconds. Default is 1765.55929, the sample time of the quarter 1 *Kepler* data length : float, optional The number of days long the required data should be. Default is 33.5, the length of the quarter 1 *Kepler* data sigma : float, optional The standard deviation of the noise in the time series. Default is 0.5 mean : float, optional The mean of the noise in the time series. The default is 1. Returns ------- x : np.ndarray An array of times z : np.array An array containing the time series data, including noise o : np.array An array containing only the flares, without noise or sinusoidal variations. n : int The number of flares injected. See also -------- simulate, simulate_single_chunks """ hours = 3600 days = 86400 dt = 1765.55929 # sample interval (sec) x = np.arange(0, length * days, dt) # create the time stamps z = np.zeros_like(x) # create the data array o = np.zeros_like(x) # create clean data array # add low frequency variation va = 15 * random() # amplitude of low frequency variation phi = random() # initial phase of low frequency variation frq = 0.000005 * random() # frequency of variation (Hz) z = va * np.sin(2 * np.pi * frq * x + phi) # add random flare #amp = 3*sigma # amplitude of flare tau1 = np.floor(random() * 10) / 2 tau2 = 0 while tau2 < tau1: tau2 = np.floor(random() * 10) / 2 tau = [tau1 * hours, tau2 * hours] # decay consts of flare pos = floor(random() * len(x)) # random position t0 = x[floor(len(x) / 2)] # position of flare peak z += pf.flare(amp, tau, x, t0) o += pf.flare(amp, tau, x, t0) # Add Gaussian noise z = pf.addNoise(z, mean, sigma) x = x / 86400 ze = np.zeros_like(x) a = SimLightcurve() a.sigma = sigma a.ts.append(x) a.lc.append(z) a.le.append(ze) a.original.append(o) a.combine() return a