Exemplo n.º 1
0
test2, p_value2 = stats.ks_2samp(poisson, poisson1)
print p_value, p_value2

test3, p3 = stats.normaltest(poisson_std)
print p3

x = stats.norm(mu, sigma)
pl.plot(t, x.pdf(t), label=u"norm")
pl.plot(t, x1, label=u"poisson", color="red")
pl.ylabel(u"概率")
pl.legend()

pl.show()

inputFile = "result_v1.txt"
data = np.loadtxt(util.getRelativePath(inputFile))
m, n = data.shape
tags = data[:, n - 1]
subClassData = {}

for i in range(m):
    tag = tags[i]
    for j in range(n - 1):
        if data[i][j] == 99:
            continue
        if not subClassData.has_key(tag):
            subClassData[tag] = []
        while len(subClassData[tag]) - 1 < j:
            subClassData[tag].append([])
        subClassData[tag][j].append(data[i][j])
Exemplo n.º 2
0
import os
import Astronomy.Util.CommonUtil as astroUtil
import CodeLib.Util.CommonUtil as util

# waveLens = [1188,1453,2023,2217,2313,2356,2491,3262,3613,3635,3696]
waveLens = [1188, 2023, 2217, 2356, 2491, 3613, 3262, 3635, 3696]

features = ["MAG1", "MAG2", "MAG3"]
subClassKey = "SUBCLASS"

classMap = {"O": 1, "B": 2, "A": 3, "F": 4, "G": 5, "K": 6, "M": 7, "N": 8}
classCount = {"O": 0, "B": 0, "A": 0, "F": 0, "G": 0, "K": 0, "M": 0, "N": 0}
inputPath = "C:\dr2"

outFile = "data.txt"
outFilePath = util.getRelativePath(outFile)
output = open(outFilePath, "w")

dirs = os.listdir(inputPath)
count = 0

for dir in dirs:
    files = os.listdir(os.path.join(inputPath, dir))
    for fileName in files:
        filePath = os.path.join(inputPath, dir, fileName)
        try:
            keywords, flux = astroUtil.getFitsHeaderAndFlux(filePath)

            record = []
            for fea in features:
                record.append(keywords[fea])