import numpy as np import h5py import pandas as pd import sys # sys.path.append("C:/Users/iuliia/recoUI/serv") np.set_printoptions(threshold=np.inf) class ReconstructionService: path_np_data_json = None path_raw_data = None path_seq_json = None def open_file_read_data(self): # data param with open(self.path_np_data_json, 'r') as f: data = pd.read_json(f, typ='series') return data def read_consts(self, data): # consts in data param: slice | np | nf df = pd.DataFrame(data) d_scans = int(df.loc['D_scans', 0]) Np = int(df.loc['Np', 0]) Nf = int(df.loc['Nf', 0]) sl_nb = int(df.loc['sl_nb', 0]) # ETL = int(df.loc['ETL', 0]) # for tse # N_TE = df.loc['N_TE', 0] # # phi_wing = df.loc['phi_wing', 0] # for radial # N_wings = df.loc['N_wings', 0] return (Np, Nf, sl_nb, d_scans) # , ETL, N_TE, phi_wing, N_wings) def read_mat_file(self): with h5py.File(self.path_raw_data, 'r') as f: key = list(f.keys())[0] with h5py.File(self.path_raw_data, 'r') as f: data = f[key][:] data = np.array(data) return data