栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

发射度的代码

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

发射度的代码

import numpy as np
from numpy import *
import h5py
import os
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import scipy.signal
import time

start = time.time()
ls = []
files = os.listdir(r'D:Raw7')  # 返回路径下的文件和文件名列表

plt.rcParams[r'xtick.direction'] = 'in'  # 设置坐标轴的刻度向内
plt.rcParams['ytick.direction'] = 'in'

for i in files:

    fileName = r'D:Raw7/' + str(i)
    f = h5py.File(fileName, 'r')
    dataname = '/x1'
    dataset = f[dataname]
    x1 = dataset[...]
    # print(mean(x1))
    dataname = '/x2'
    dataset = f[dataname]
    x2 = dataset[...]
    # print(mean(x2))
    dataname = '/x3'
    dataset = f[dataname]
    x3 = dataset[...]

    dataname = '/p1'
    dataset = f[dataname]
    p1 = dataset[...]

    dataname = '/p2'
    dataset = f[dataname]
    p2 = dataset[...]
    b = np.arange(len(x1))

    m = []
    mm = []
    n = []
    nn = []
    a = []
    for j in b:
        if 100 >= x3[j] >= -100:
            m.append(x2[j])
            n.append(p2[j])

    a = m - mean(m)
    z = n - mean(n)
    b = mean(a * a)
    c = mean(z * z)
    e = mean(a * z)
    f = sqrt(b * c - e ** 2)
    ls.append(f / 1.8834)

print(mean(ls))
print(len(ls))
# print(len(n))


# x = np.arange(0, 3.99, 0.0266)
x = np.arange(0, 40.166, 0.266)
# x = np.arange(151)
# plt.ylim(0, 7)
# plt.xlim(0, 60)

plt.xlabel("Propagation Distance(cm)")
plt.ylabel("Proj. Emittance, εN/εN,0")
plt.plot(x, ls, '-', linewidth=1)
end = time.time()
print('运行时间:%s 秒' % (end - start))
plt.show()

三个片粒子:sigama_v       5.35, 5.45        5.589,5.689     5.828,5.928

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1026109.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号