Example #1
0
    def gaTdem1dsen(datapoint, model1d, ix=None, modelChanged=True):
        """ Compute the sensitivty matrix for a 1D layered earth model, optionally compute the responses for only the layers in ix """
        # Unfortunately the code requires forward modelled data to compute the
        # sensitivity if the model has changed since last time
        if modelChanged:
            E = Earth(model1d.par[:], model1d.thk[:-1])
            G = Geometry(datapoint.z[0], datapoint.T.roll, datapoint.T.pitch,
                         datapoint.T.yaw, datapoint.loopOffset[0],
                         datapoint.loopOffset[1], datapoint.loopOffset[2],
                         datapoint.R.roll, datapoint.R.pitch, datapoint.R.yaw)

            for i in range(datapoint.nSystems):
                datapoint.system[i].forwardmodel(G, E)

        if (ix is None
            ):  # Generate a full matrix if the layers are not specified
            ix = range(np.int(model1d.nCells[0]))
            J = np.zeros([datapoint.nWindows, np.int(model1d.nCells[0])])
        else:  # Partial matrix for specified layers
            J = np.zeros([datapoint.nWindows, np.size(ix)])

        for j in range(datapoint.nSystems):  # For each system
            iSys = datapoint._systemIndices(j)
            for i in range(np.size(ix)):  # For the specified layers
                tmp = datapoint.system[j].derivative(
                    datapoint.system[j].CONDUCTIVITYDERIVATIVE, ix[i] + 1)
                # Store the necessary component
                J[iSys, i] = -model1d.par[ix[i]] * tmp.SZ[:]

        datapoint.J = J[datapoint.active, :]
        return datapoint.J
Example #2
0
 def _BrodieForward(self, mod):
     # Generate the Brodie Earth class
     E = Earth(mod.par[:], mod.thk[:-1])
     # Generate the Brodie Geometry class
     G = Geometry(self.z[0], self.T.roll, self.T.pitch, self.T.yaw, -12.64,
                  0.0, 2.11, self.R.roll, self.R.pitch, self.R.yaw)
     # Forward model the data for each system
     iJ0 = 0
     for i in range(self.nSystems):
         iJ1 = iJ0 + self.sys[i].nwindows()
         fm = self.sys[i].forwardmodel(G, E)
         self.p[iJ0:iJ1] = -fm.SZ[:]  # Store the necessary component
         iJ0 = iJ1
Example #3
0
    def _BrodieForward(self, mod):
        # Generate the Brodie Earth class
        E = Earth(mod.par[:], mod.thk[:-1])
        # Generate the Brodie Geometry class
        G = Geometry(self.z[0], self.T.roll, self.T.pitch, self.T.yaw, -12.64,
                     0.0, 2.11, self.R.roll, self.R.pitch, self.R.yaw)

        # Forward model the data for each system
        for i in range(self.nSystems):
            iSys = self._systemIndices(i)
            fm = self.system[i].forwardmodel(G, E)
            self._predictedData[
                iSys] = -fm.SZ[:]  # Store the necessary component
Example #4
0
    def gaTdem1dfwd(datapoint, model1d):
        # Generate the Brodie Earth class
        E = Earth(model1d.par[:], model1d.thk[:-1])
        # Generate the Brodie Geometry class
        G = Geometry(datapoint.z[0],
                    datapoint.transmitter.roll, datapoint.transmitter.pitch, datapoint.transmitter.yaw,
                    datapoint.loopOffset[0], datapoint.loopOffset[1], datapoint.loopOffset[2],
                    datapoint.receiver.roll, datapoint.receiver.pitch, datapoint.receiver.yaw)

        # Forward model the data for each system
        for i in range(datapoint.nSystems):
            iSys = datapoint._systemIndices(i)
            fm = datapoint.system[i].forwardmodel(G, E)
            datapoint._predictedData[iSys] = -fm.SZ[:]  # Store the necessary component
Example #5
0
    def fm_dlogc(self, mod):
            # Generate the Brodie Earth class
        E = Earth(mod.par[:], mod.thk[:-1])
#    ####lg.debug('Parameters: '+str(mod.par))
#    ####lg.debug('Thickness: '+str(mod.thk[:-1]))
        # Generate the Brodie Geometry class
#    ####lg.debug('Geometry: '+str([self.z[0],self.T.roll,self.T.pitch,self.T.yaw,-12.64,0.0,2.11,self.R.roll,self.R.pitch,self.R.yaw]))
        G = Geometry(self.z[0], self.T.roll, self.T.pitch, self.T.yaw, -
                     12.615, 0.0, 2.16, self.R.roll, self.R.pitch, self.R.yaw)
        # Forward model the data for each system
        iJ0 = 0
        for i in range(self.nSystems):
            iJ1 = iJ0 + self.sys[i].nwindows()
            dummy = self.sys[i].forward(G, E)

#      self.p[iJ0:iJ1]=-fm.SZ[:]
#      iJ0=iJ1
        return fm
Example #6
0
    def _sensitivity1D(self, mod, ix=None, scale=False, modelChanged=True):
        """ Compute the sensitivty matrix for a 1D layered earth model, optionally compute the responses for only the layers in ix """
        # Unfortunately the code requires forward modelled data to compute the
        # sensitivity if the model has changed since last time
        if modelChanged:
            E = Earth(mod.par[:], mod.thk[:-1])
            G = Geometry(self.z[0], self.T.roll, self.T.pitch, self.T.yaw,
                         -12.64, 0.0, 2.11, self.R.roll, self.R.pitch,
                         self.R.yaw)
            for i in range(self.nSystems):
                self.sys[i].forwardmodel(G, E)
        if (ix is None
            ):  # Generate a full matrix if the layers are not specified
            ix = range(mod.nCells[0])
            J = np.zeros([self.nWindows, mod.nCells[0]])
        else:  # Partial matrix for specified layers
            J = np.zeros([self.nWindows, len(ix)])

        iJ0 = 0
        for j in range(self.nSystems):  # For each system
            iJ1 = iJ0 + self.sys[j].nwindows()
            for i in range(len(ix)):  # For the specified layers
                tmp = self.sys[j].derivative(
                    self.sys[j].CONDUCTIVITYDERIVATIVE, ix[i] + 1)
                # Store the necessary component
                J[iJ0:iJ1, i] = -mod.par[ix[i]] * tmp.SZ[:]
            iJ0 = iJ1

        if scale:
            iJ0 = 0
            for j in range(self.nSystems):  # For each system
                iJ1 = iJ0 + self.sys[j].nwindows()
                for i in range(len(ix)):  # For the specified layers
                    # Scale the sensitivity matix rows by the data weights if
                    # required
                    J[iJ0:iJ1, i] /= self.s[iJ0:iJ1]
                iJ0 = iJ1

        J = J[self.iActive, :]
        return J
#Print the window times
S.windows.print();

if True:
    #Plot the waveform and window positions
    fig1 = plt.figure(1);
    #S.waveform.print(); #Too much printing
    S.waveform_windows_plot(fig1);
    if display_plots: plt.show(fig1);
    if save_pdfs: plt.savefig("figure1.pdf", dpi=300, facecolor='w', edgecolor='w',           orientation='portrait', papertype=None, format=None, transparent=False, bbox_inches=None, pad_inches=0.1, frameon=None);

#Set the conductivity and thicknesses
conductivity = [0.01, 0.1, 0.001];
thickness    = [40, 20];
E = Earth(conductivity,thickness);
E.print();

#Set the system geometry
G = Geometry(tx_height=35, txrx_dx = -12.62, txrx_dz = +2.16);
G.print();

#Run a few random forward models in a loop
t1=time.clock()
for i in range(10):
    conductivity[0] = 10**(random.uniform(-3, 0));
    conductivity[1] = 10**(random.uniform(-3, 0));
    conductivity[2] = 10**(random.uniform(-3, 0));
    thickness       = [40, 20];
    E = Earth(conductivity,thickness);
    fm = S.forwardmodel(G,E);
Example #8
0
        plt.savefig("figure1.pdf",
                    dpi=300,
                    facecolor='w',
                    edgecolor='w',
                    orientation='portrait',
                    papertype=None,
                    format=None,
                    transparent=False,
                    bbox_inches=None,
                    pad_inches=0.1,
                    frameon=None)

#Set the conductivity and thicknesses
conductivity = [0.01, 0.1, 0.001]
thickness = [40, 20]
E = Earth(conductivity, thickness)
E.print()

#Set the system geometry
G = Geometry(tx_height=35, txrx_dx=-12.62, txrx_dz=+2.16)
G.print()

#Run a few random forward models in a loop
t1 = time.clock()
for i in range(10):
    conductivity[0] = 10**(random.uniform(-3, 0))
    conductivity[1] = 10**(random.uniform(-3, 0))
    conductivity[2] = 10**(random.uniform(-3, 0))
    thickness = [40, 20]
    E = Earth(conductivity, thickness)
    fm = S.forwardmodel(G, E)