コード例 #1
0
            plt.savefig('test_r_hesfit_' + np.str(ilc) + '.pdf')

    return (parmout, covout, freq, tplot, xplot)


#!!!!!!!!!!!!!!!!!!! test the code using this program

timeall = []
sigall = []
yall = []

nlc = 1

for i in range(nlc):
    #generate test light curve and add noise
    datpre = mylcgen(tlo=0, thi=100, dt=0.03, iseed=132423)
    npre = np.shape(datpre[:, 0])[0]
    datmean = np.std(datpre[:, 1])
    snow = np.ones(npre) / 10 * datmean
    dat = mrs.myresample(dir='',
                         fname=[''],
                         dtave=2.0,
                         sampmin=0.8,
                         sampcode=3,
                         datin=np.array((datpre[:, 0], datpre[:, 1], snow)).T)
    ndat = np.shape(dat[:, 0])[0]
    sig = dat[:, 2]
    for i in range(ndat):
        dat[i, 1] = normdis(1, dat[i, 1], sig[i])[0]
    sigall.append(sig)
    yall.append(dat[:, 1] + 50)
コード例 #2
0
import numpy as np
from mylcgen import *
from myrandom import *
import matplotlib.pylab as plt
import mysinecostrans as msc

#generate test light curve and add noise
dat = mylcgen(tlo=0, thi=100, dt=2.0, iseed=42342332)
ndat = np.shape(dat[:, 0])[0]
datmean = np.std(dat[:, 1])
sig = np.ones(ndat) / 10 * datmean
for i in range(ndat):
    dat[i, 1] = normdis(1, dat[i, 1], sig[i])[0]
y = dat[:, 1]
time = dat[:, 0]

tlo = np.min(time)
thi = np.max(time)
dt = np.mean(time[1:] - time[:-1])

flo = 0.5 / (thi - tlo)
fhi = 5. / dt

msc.sct(time, y, sig, freq=np.arange(flo, fhi + flo, flo), costrans=0)

#test the routine above and do it manually to compare

tlo = np.min(time)
thi = np.max(time)
dt = np.mean(time[1:] - time[:-1])
コード例 #3
0
ファイル: myfitrw.py プロジェクト: dstarkey23/astropy_stark
import numpy as np
from mylcgen import *
from myrandom import *
import matplotlib.pylab as plt
import myresample as mrs

#generate test light curve and add noise
datpre = mylcgen(tlo=0, thi=100, dt=0.03, iseed=34245)

ndat = np.shape(datpre[:, 0])[0]
datmean = np.std(datpre[:, 1])
sig = np.ones(ndat) / 10 * datmean

dat = mrs.myresample(dir='',
                     fname=[''],
                     dtave=2.0,
                     sampmin=0.8,
                     sampcode=3,
                     datin=np.array((datpre[:, 0], datpre[:, 1], sig)).T)
ndat = np.shape(dat[:, 0])[0]
sig = dat[:, 2]

for i in range(ndat):
    dat[i, 1] = normdis(1, dat[i, 1], sig[i])[0]
y = dat[:, 1] + 50
time = dat[:, 0]

tlo = np.min(time)
thi = np.max(time)
dt = np.mean(time[1:] - time[:-1])
コード例 #4
0
 
 
##!!!!!!!!!!!!!!!!!!! test the code using this program
#
#





#generate test light curve and add noise
cadence = 3.0
timeall = []
sigall  = []
yall    = []
datpre      = mylcgen(tlo=0,thi=100,dt=cadence,iseed=132423)
npre     = np.shape(datpre[:,0])[0]
sig = np.std(datpre[:,1])/10
#add noise
sigpre = np.ones(npre)*sig
datpre[:,1] = np.random.randn(npre)*sig + datpre[:,1]
#add bad data to test sigma clipping
datpre[10,1] = datpre[10,1] + 100*sig
datpre[5,1] = datpre[5,1] - 40*sig

timeall = datpre[:,0] + np.random.randn(npre)*0.1#npre,datpre[:,0],0.1)
yall = datpre[:,1]
sigall = sigpre