def create_table(self, title: str, column_titles: list, rows: list, metrics: list): array = numpy.array(rows) data_frame = pandas.DataFrame(data=array, columns=column_titles) data_frame = data_frame[column_titles] data_frame.sort_values(by=metrics) path = Utils.outputs_path(title) Imager.data_frame_to_jpg(title, data_frame, path) self.outputs[Utils.outputs_name(title)] = path
def operate(self, input_name, configs): # (输出): # 交易数据: # (IMAGE): # #(输入值): '/Users/LiXiangYu/Desktop/交易数据-(TODAY).jpg' # (输出值): '交易数据-(TODAY).jpg' # (EXCEL): # #(输入值): '/Users/LiXiangYu/Desktop/交易数据-(TODAY).xls' # (输出值): '交易数据-(TODAY).xls' # 一个用于output的数据集 input_items = self.inputs[input_name] # 校验是否空数据集 if len(input_items) == 0: print('空数据集' + input_name) return keys = list(input_items[0].keys()) for output_type, config in configs.items(): output_name = config['(输出值)'] if len(output_name) == 0: raise RuntimeError('输出值长度0') output_name = Keywords.active_date(output_name) # 如果有path,那么用path作为输出路径,否则自定义路径 if '(输入值)' in config.keys(): path = config['(输入值)'] path = Keywords.active_date(path) else: outputs_dir = os.path.join(os.path.dirname(__file__), "outputs") if os.path.exists(outputs_dir) is False: os.makedirs(outputs_dir) path = os.path.join(outputs_dir, output_name) # 如果已经存在输出,则删除输出 if os.path.exists(path): os.remove(path) if output_type == '(IMAGE)': Imager.data2jpg(input_items, keys, path) self.inputs[output_name] = path elif output_type == '(EXCEL)': Exceler.data2sheet(input_items, keys, 'sheet1', path)
def addImage(self): self.shiftImages() self.addNames() self.saveImages() imageAgent = Imager.Imager(1.0, 1.0, 1.0, 1.0) imageAgent.takePicture() imageToAdd = cv2.imread(self.tempFile, 0) self.imageArray.append(imageToAdd) if self.size < 30: self.size = self.size + 1 nt = datetime.datetime.now() self.lastAccessed = datetime.datetime.strptime( str(nt), '%Y-%m-%d %H:%M:%S.%f').strftime("%s") if self.size == self.arrayMaxSize: self.arrayFull = True self.buildGif() self.saveState() return
f.addNoise(variance=1, bandwidth=15e3, mode='point', point=pos_ruido) # 8x8 minimum missing lags array xs = np.array([0, 1, 4, 9, 15, 22, 32, 34]) * 0.3 / 34 ys = xs a = GridArray(xs, ys, sampleRate=44100, verbose=True) #a.show() # plots array geometry a.receiveSignal(f) a.addNoise(snr=30) # 30 dB sampling noise windowFFT = 44100 a.signal2FFT(windowFFT=windowFFT) lookingFreq = 14037 imager = Imager(a, freq=lookingFreq, fieldRes=fieldRes) imager.calculateRn() imager.Rn_regularization = 1e-5 * np.mean(np.abs(imager.Rn)) imager.Rx_regularization = 1e-2 * np.mean(np.abs(imager.Rn)) t0 = time.time() y_das = imager.beamform( #beamformer = "DAS") beamformer="X-KAT") #beamformer = "CSM-KAT") #beamformer = "MPDR") #beamformer = "MVDR") t1 = time.time() print("Beamformer {} in {}s".format(imager.beamformer, t1 - t0)) iterations = 2e2 t0 = time.time()
signal_plel.fill(self.S_restr_plel(model)) signal_perp = self.S_restr_perp(radii, model) signal_ST = empty(500) signal_ST.fill(self.ST(model)) figure() plot(radii, signal_plel) plot(radii, signal_perp) plot(radii, signal_ST) show() if __name__ == '__main__': imager = Imager() model = Model() c = ComputeVariables(imager, model) num_vectors = 10 vector_list = c.genVectorsWithTheta(0, num_vectors) axon_1_signal_list = [] for vector in vector_list: c.imager.g = vector c.updateVariables(model) axon_1_signal_list.append(c.calcS(model)) print vector c.plotSignal(model) #print axon_1_signal_list '''
def __init__(self): self.IMG = Imager.Imager()
def generatePotentialSpook(): imager = Imager.Imager(IMG_WIDTH, IMG_HEIGHT) return imager.generateOneRGB()
def __init__(self, gridArray, freq, farFieldReference=None, fieldRes=None): Imager.__init__(self, gridArray, freq, farFieldReference=farFieldReference, fieldRes=fieldRes)
def __init__(self, root): super().__init__(root) self.img = Imager.Imager() self.FW = File_work.File_work() self.__init_main__() self.render_ui()