First commit after changed file framework
这个提交包含在:
@@ -0,0 +1,88 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore')
|
||||
import argparse, json
|
||||
from common import NoIndent, MyEncoder
|
||||
|
||||
def _argparse():
|
||||
parser = argparse.ArgumentParser(description='cs client')
|
||||
parser.add_argument('-a', '--argfile', action='store', dest='argfile', required=True, help='name of arguments file')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
parser = _argparse()
|
||||
argfile = parser.argfile
|
||||
if argfile[-5:] != '.json':
|
||||
print('输入的参数文件名有误')
|
||||
return
|
||||
with open(argfile,'r') as jsonFile:
|
||||
paramData = json.load(jsonFile)
|
||||
if ("m" not in paramData) or ("d" not in paramData) or\
|
||||
("f" not in paramData) or ("c" not in paramData) or\
|
||||
("outParam" not in paramData):
|
||||
print(f'{argfile}中的参数有误,请核实!')
|
||||
return
|
||||
m = int(paramData["m"])
|
||||
d = float(paramData["d"])
|
||||
f = float(paramData["f"])
|
||||
c = float(paramData["c"])
|
||||
outParam = paramData["outParam"]
|
||||
|
||||
from pyat.cscore import np, dis_mats, pn_funcs, ag_funcs
|
||||
import sys
|
||||
print(sys.path)
|
||||
|
||||
|
||||
# 输出:
|
||||
# 所有阵元的间距的集合
|
||||
dis_m = dis_mats(m, d)
|
||||
print('所有阵元的间距的集合:', dis_m)
|
||||
|
||||
# 相邻阵元的噪声相关性
|
||||
pn_res = pn_funcs(f, c, dis_m)
|
||||
print('相邻阵元的噪声相关性:pn=', pn_res[0, 1])
|
||||
|
||||
# 阵增益
|
||||
ag_res = ag_funcs(m, pn_res)
|
||||
print('阵增益:ag=', ag_res)
|
||||
outData = {
|
||||
"param": paramData,
|
||||
"dis": np.round(dis_m,2).tolist(),
|
||||
"pn": np.round(pn_res,2).tolist(),
|
||||
"ag": np.round(ag_res,2).tolist()
|
||||
}
|
||||
with open(("" if outParam["outPath"]=="" else outParam["outPath"] + "/")+"csOut.json", 'w') as jsonFile:
|
||||
json_data = json.dumps(outData, cls=MyEncoder, indent=2, ensure_ascii=False)
|
||||
jsonFile.write(json_data)
|
||||
# # write data to file
|
||||
# # 保存地形数据
|
||||
# bathym.r = np.around(bathym.r, decimals=0)
|
||||
# bathym.d = np.around(bathym.d, decimals=0)
|
||||
# bathymData = {
|
||||
# "param": paramData,
|
||||
# "count": len(bathym.d),
|
||||
# "descript": "距离、深度",
|
||||
# "data": NoIndent(list(zip(bathym.r, bathym.d)))
|
||||
# }
|
||||
# with open(("" if outParam["outPath"]=="" else outParam["outPath"] + "/")+"tlOut_bathym.json", 'w') as jsonFile:
|
||||
# json_data = json.dumps(bathymData, cls=MyEncoder, indent=2, ensure_ascii=False)
|
||||
# jsonFile.write(json_data)
|
||||
|
||||
# # 保存传播损失数据
|
||||
# tlpoint = []
|
||||
# depths = np.around(depths, decimals=0)
|
||||
# ranges = np.around(ranges, decimals=0)
|
||||
# TL = np.around(TL, decimals=2)
|
||||
# tlpoint = list(zip(np.tile(depths.reshape(len(depths),1),len(ranges)).flatten(), np.tile(ranges,(len(depths),1)).flatten(), TL.flatten()))
|
||||
# tlData = {
|
||||
# "param": paramData,
|
||||
# "count": len(ranges)*len(depths),
|
||||
# "descript": "距离、深度、损失",
|
||||
# "data": NoIndent(tlpoint)
|
||||
# }
|
||||
# with open(("" if outParam["outPath"]=="" else outParam["outPath"] + "/")+"tlOut_tl.json", 'w') as jsonFile:
|
||||
# json_data = json.dumps(tlData, cls=MyEncoder, indent=2, ensure_ascii=False)
|
||||
# jsonFile.write(json_data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
在新工单中引用
屏蔽一个用户