def import_eit40(self, filename, configfile, correction_file=None): """EIT40 data import""" df = reda_eit40.import_medusa_data( filename, configfile, ) if correction_file is not None: reda_eit40.apply_correction_factors(df, correction_file) redanr.assign_norrec_to_df(df) df = redanr.assign_norrec_diffs(df, ['R', 'rpha']) self._add_to_container(df) print('Summary:') self._describe_data(df)
def _add_to_container(self, df): """Add a given DataFrame to the container Parameters ---------- df : pandas.DataFrame DataFrame, must adhere to the container contraints (i.e., must have all required columns) """ if self.data is None: self.data = df else: self.data = pd.concat((self.data, df), ignore_index=True, sort=True) # clean any previous norrec-assignments if 'norrec' and 'id' in self.data.columns: self.data.drop(['norrec', 'id'], axis=1, inplace=True) self.data = assign_norrec_to_df(self.data) # note that columns not in the DataFrames are ignored, thus no problem # to include rho_a and rpha self.data = assign_norrec_diffs(self.data, ['r', 'rho_a', 'rpha']) # Put a, b, m, n in the front and ensure integers for col in tuple("nmba"): cols = list(self.data) cols.insert(0, cols.pop(cols.index(col))) self.data = self.data.iloc[:, self.data.columns.get_indexer(cols)] self.data[col] = self.data[col].astype(int) if 'timestep' in self.data: # make sure the timestep column is in the fifth position col_order = ['a', 'b', 'm', 'n', 'timestep'] self.data = self.data.reindex(columns=(col_order + list( [key for key in self.data.columns if key not in col_order])))
# Daten einlesen und berechnen # ---------------------------- # reda container erstellen ert = reda.ERT() # normal und reciproke Daten einlesen ert.import_syscal_bin('data_nor.bin') ert.import_syscal_bin('data_rec.bin', reciprocals=48) # K-Faktor berechnen K = reda.utils.geometric_factors.compute_K_analytical(ert.data, spacing=2.5) # Rho_a berechnen reda.utils.geometric_factors.apply_K(ert.data, K) # negative Widerstände bei negativen K umdrehen reda.utils.fix_sign_with_K.fix_sign_with_K(ert.data) # calculate diffeence between nor and rec measurement ert.data = NR.assign_norrec_diffs(ert.data, ('r', 'rho_a')) ############################################################################### # Histogramme plotten # ------------------- fig = ert.histogram(('r', 'rdiff', 'rho_a', 'rho_adiff', 'Iab')) plt.savefig('histogramms.png') ############################################################################### # Pseudosektionen plotten # ----------------------- fig = ert.pseudosection('r') plt.savefig('pseudo_r.png') fig = ert.pseudosection('rdiff')