def PGetUV(InImager): """ Return the member uvdata returns uv data (as UV) InImager = Python ImageMosaic object """ ################################################################ # Checks if not PIsA(InImager): raise TypeError, "InImager MUST be a Python Obit UVImager" # out = UV.UV("None") out.me = Obit.UVImagerGetUV(InImager.me) return out
def PGetRFI(inRFI): """ Return the data set containing estimated RFI returns Residual dataset, this is only valid after calling PRemove or PCounterRot. If PFilter (or PRemove) has beed called the residual will have been filtered to give the estimate of the RFI. inRFI = Python UVRFIXize object """ ################################################################ # Checks if not PIsA(inRFI): raise TypeError("inRFI MUST be a Python Obit UVRFIXize") # RFIUV = UV("RFI") RFIUV.me = Obit.UVRFIXizeGetRFI(inRFI.me) return RFIUV
# 把处理好的数据划分为 train 和 verify with open("output/final_scored_data.txt", 'r') as f: choose_rate = 0.2 # 80%数据用于测试, 20%数据用于验证 i = 0 for line in f.readlines(): i += 1 if(random.random() > choose_rate): with open("output/train.txt", 'a') as train: train.write(line) else: with open("output/train.txt", 'a') as verify: verify.write(line) print("done line " + i) # 建立 UV 模型 uv = UV.UV("output/train.txt", 5) rmse = uv.getRMSE() for i in range(50): uv.loop() rmse = uv.getRMSE() if rmse < 1000: break print(rmse) uv.output() # 读取 U、V 矩阵 with open("output/UmatS.txt", 'r') as f: Umat = [] for line in f.readlines(): line_arr = line.replace("\n", "").split(" ") new_arr = []