############################################################################### # Obtaining a datapoint from a dataset # ++++++++++++++++++++++++++++++++++++ # More often than not, our observed data is stored in a file on disk. # We can read in a dataset and pull datapoints from it. # # For more information about the time domain data set, see :ref:`Time domain dataset` # The data file name dataFile = [dataFolder + 'Skytem_High.txt', dataFolder + 'Skytem_Low.txt'] # The EM system file name systemFile = [dataFolder + 'SkytemHM-SLV.stm', dataFolder + 'SkytemLM-SLV.stm'] ################################################################################ # Initialize and read an EM data set D = TdemData() D.read(dataFile, systemFile) ################################################################################ # Get a datapoint from the dataset tdp = D.datapoint(0) plt.figure() tdp.plot() ################################################################################ # Using a time domain datapoint # +++++++++++++++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data par = StatArray(np.r_[500.0, 20.0], "Conductivity", "$\frac{S}{m}$")
# Obtaining a datapoint from a dataset # ++++++++++++++++++++++++++++++++++++ # More often than not, our observed data is stored in a file on disk. # We can read in a dataset and pull datapoints from it. # # For more information about the time domain data set, see :ref:`Time domain dataset` # The data file name dataFile = dataFolder + 'Skytem.csv' # The EM system file name systemFile = [dataFolder + 'SkytemHM-SLV.stm', dataFolder + 'SkytemLM-SLV.stm'] ################################################################################ # Initialize and read an EM data set # Prepare the dataset so that we can read a point at a time. Dataset = TdemData._initialize_sequential_reading(dataFile, systemFile) # Get a datapoint from the file. tdp = Dataset._read_record() Dataset._file.close() # plt.figure() # tdp.plot() ################################################################################ # Using a time domain datapoint # +++++++++++++++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data par = StatArray(np.r_[500.0, 20.0], "Conductivity", "$\frac{S}{m}$") mod = Model1D(edges=np.r_[0, 75.0, np.inf], parameters=par)
# The data file name dataFiles = dataFolder + 'Skytem_small.csv' # dataFiles = dataFolder + 'Skytem.csv' # The EM system file name systemFiles = [ dataFolder + 'SkytemHM-SLV.stm', dataFolder + 'SkytemLM-SLV.stm' ] from pathlib import Path for f in systemFiles[:1]: txt = Path(f).read_text() print(txt) ################################################################################ # Read in the data from file TD = TdemData.read_csv(dataFiles, systemFiles) ################################################################################ # Plot the locations of the data points plt.figure(1, figsize=(8, 6)) _ = TD.scatter2D() ################################################################################ # Plot all the data along the specified line plt.figure(2, figsize=(8, 6)) _ = TD.plotLine(100101.0, log=10) ################################################################################ # Or, plot specific channels in the data plt.figure(3, figsize=(8, 6)) _ = TD.plot(system=0, channels=[1, 3, 5], log=10)
# Send and recieve a single datapoint from the file. if master: fd = FdemData() fd._initLineByLineRead(dataPath+"Resolve2.txt", dataPath+"FdemSystem2.stm") fdp = fd._readSingleDatapoint() for i in range(1, size): fdp1 = fd._readSingleDatapoint() fdp1.Isend(dest=i, world=world, systems=systems) else: fdp = FdemDataPoint().Irecv(source=0, world=world, systems=systems) assert np.allclose(fdp.data, fdSave.data[rank, :], equal_nan=True), Exception("Could not use FdemData.Isend/Irecv, with pre-existing system class. Rank {}".format(rank)) tdSave = TdemData() tdSave.read([dataPath+"Skytem_High.txt", dataPath+"Skytem_Low.txt"], [dataPath+"SkytemHM-SLV.stm", dataPath+"SkytemLM-SLV.stm"]) ### Test Time Domain Data if master: td = tdSave else: td = TdemData() #Bcast td1 = td.Bcast(world) assert np.allclose(td1.data, tdSave.data, equal_nan=True), Exception("Could not use TdemData.Bcast. Rank {}".format(rank)) # # Scatterv starts, chunks = myMPI.loadBalance1D_shrinkingArrays(tdSave.nPoints, size) i0 = starts[rank]
# myMPI.orderedPrint(world, td1._std[:, td1.iActive]) # myMPI.orderedPrint(world, td1._predictedData[:, td1.iActive]) # # Scatterv # starts, chunks = myMPI.loadBalance_shrinkingArrays(td1.nPoints, size) # td1 = td.Scatterv(starts, chunks, world) # myMPI.orderedPrint(world, np.asarray([td1.x, td1.y, td1.z]), "TdemData.Scatterv") # myMPI.orderedPrint(world, td1._data[:, td1.iActive]) # myMPI.orderedPrint(world, td1._std[:, td1.iActive]) # myMPI.orderedPrint(world, td1._predictedData[:, td1.iActive]) # Point by Point read in and send if master: td = TdemData() td._initLineByLineRead([dataPath+"Skytem_High.txt", dataPath+"Skytem_Low.txt"], [dataPath+"SkytemHM-SLV.stm", dataPath+"SkytemLM-SLV.stm"]) # # Send and recieve a single datapoint from the file. # if master: # for i in range(1, size): # tdp = td._readSingleDatapoint() # tdp.Isend(dest=i, world=world) # else: # tdp = TdemDataPoint().Irecv(source=0, world=world) # myMPI.orderedPrint(world, tdp.summary(True), "FdemData.Isend/Irecv") # Testing pre-read in system classes sysPath = [dataPath+"SkytemHM-SLV.stm", dataPath+"SkytemLM-SLV.stm"] systems = []
# The following list of parameters can be given either a single value or a list of values # of length equal to the number of systems in the data. If one value is specified and there # are multiple systems, that value is used for all of them. # self.initialRelativeError # self.minimumRelativeError # self.maximumRelativeError # self.initialAdditiveError # self.minimumAdditiveError # self.maximumAdditiveError # self.relativeErrorProposalVariance # self.additiveErrorProposalVariance # ------------------------------------------------------- # Define whether this parameter file uses time domain or frequency domain data! from geobipy import TdemData data_type = TdemData() # ------------------------------------------------------- # ------------------------------------------------------- # General file structure information. # ------------------------------------------------------- # Specify the folder to the data dataDirectory = "..//Data" # Data File Name. If there are multiple, encompass them with [ , ]. This is a standard python list of str. dataFilename = dataDirectory + "//Aeroquest.txt" # dataFilename = [dataDirectory + "//DataFile1.txt", dataDirectory + "//DataFile2.txt"] # System File Name. If there are multiple, encompass them with [ , ]. This is a standard python list of str. systemFilename = dataDirectory + "//Aeroquest.stm" # systemFilename = [dataDirectory + "//SystemFile1.stm", dataDirectory + "//SystemFile2.stm"]
############################################################################### # Obtaining a datapoint from a dataset # ++++++++++++++++++++++++++++++++++++ # More often than not, our observed data is stored in a file on disk. # We can read in a dataset and pull datapoints from it. # # For more information about the time domain data set, see :ref:`Time domain dataset` # The data file name dataFile = [dataFolder + 'Skytem_High.txt', dataFolder + 'Skytem_Low.txt'] # The EM system file name systemFile = [dataFolder + 'SkytemHM-SLV.stm', dataFolder + 'SkytemLM-SLV.stm'] ################################################################################ # Initialize and read an EM data set D = TdemData.read_csv(dataFile, systemFile) ################################################################################ # Get a datapoint from the dataset tdp = D.datapoint(0) plt.figure() tdp.plot() ################################################################################ # Using a time domain datapoint # +++++++++++++++++++++++++++++ ################################################################################ # We can define a 1D layered earth model, and use it to predict some data par = StatArray(np.r_[500.0, 20.0], "Conductivity", "$\frac{S}{m}$")