コード例 #1
0
    def set_real_data_survey(self):
        """
        Model of conductivity field.
        Constant backgorund with one more conductive and one less conductive cylinder (full 2D case).
        :return: None
        """

        file_in = os.path.join(src_dir, '..', '..','data', 'ert_mereni', 'komora_1','lhp.2dm')

        raw_df = pd.read_csv(file_in, skiprows=18, header=None, sep='\t')
        # remove last empty column
        raw_df = raw_df.dropna(axis=1)
        # name columns
        raw_df.columns = ['ca', 'cb', 'pa', 'pb', 'array', 'I', 'V', 'EP', 'AppRes', 'std']

        # remove wrong readings
        raw_df = raw_df.drop(raw_df[raw_df['V'] < 0].index)
        raw_df['std'] = raw_df['std'] * 0.01 /10    # input error is in percent
        # I [mA], V [mV]
        measured_df = raw_df.iloc[:, [0,1,2,3,5,6,7,9]]
        print(measured_df.iloc[:,0])
        raw_df['idx'] = raw_df['ca']*100 + raw_df['cb']


        def od(a, b):
            return 1.0 / (raw_df[b] - raw_df[a])

        raw_df['k'] = 1.0 / (od('ca', 'pa') - od('pa', 'cb') - od('ca', 'pb') + od('pb', 'cb'))
        raw_df['res'] = 2* np.pi * raw_df['k'] * raw_df['V'] / raw_df['I'] /raw_df['AppRes']

        eps = 0.005     # rounding error of input data
        I = raw_df['I']
        V = raw_df['V']
        raw_df['round_rel_err'] = np.abs(2 * (V + I) * eps / ( I**2 - eps**2) * I / V )
        #raw_df['res_min'] = 2 * np.pi * raw_df['k'] * (raw_df['V'] - 0.01) / (raw_df['I'] + 0.01) /raw_df['AppRes']
        #raw_df['res_max'] = 2 * np.pi * raw_df['k'] * (raw_df['V'] + 0.01) / (raw_df['I'] - 0.01) /raw_df['AppRes']
        #raw_df['app_to_res'] = raw_df['AppRes'] / raw_df['res']
        # math up to +- 0.5 percent

        # TODO: ? meaning of std and EP
        # TODO: compute and use error of V / I (normalizing to I=1) from known 0.01 precision of the given values

        print(raw_df.iloc[127, :])
        raw_df.plot(y=['round_rel_err', 'std'])
        #plt.show()



        xlim = self.xyzlim[0]
        n_points = max( [np.max(raw_df['ca']), np.max(raw_df['cb']), np.max(raw_df['pa']), np.max(raw_df['pb']) ] ) + 1
        print(n_points)
        self.probe_points = inv.PointSet.line([xlim[0], 0], [xlim[1], 0], n_points)
        #self.survey = survey_factory.compose_1d_survey(self.probe_points, survey_factory.schlumberger_full(n_points))
        self.survey = inv.Survey(self.probe_points)
        self.survey.read_scheme(raw_df, ['ca', 'cb', 'pa', 'pb'])
        self.survey.read_data(raw_df, ['res', 'round_rel_err'])
コード例 #2
0
    def setup_measurement(self):

        # Manual setup of Dipole-Dipole Survey
        n_points = 20

        self.probe_points = inv.PointSet.line([-15, 0], [15, 0], n_points)
        #self.survey = survey_factory.compose_1d_survey(self.probe_points, survey_factory.schlumberger_full(n_points))
        self.survey = inv.Survey(self.probe_points)
        #self.survey.schlumberger_inv_scheme()
        #self.survey.full_per_cable()
        self.survey.marching_cc_pair()