Tag Archives: matlab

Overview of running MARE2DEM

Overview of the typical MARE2DEM workflow for forward and inverse modeling.Overview of the typical MARE2DEM workflow for forward and inverse modeling.

The diagram above gives an overview of the typical MARE2DEM workflow.  Here's a brief summary step-by-step run through:

  1. Inputs include any EM data, a topography profile and any other a priori geologic information you wish to incorporate into the forward or inverse model.
  2. Create the model and data files. On your laptop or desktop, you create the model domain using the MATLAB code Mamba2D.m, which outputs a few files describing the model geometry, resistivity parameters and the inversion penalty matrix. Real data can be written to the MARE2DEM data format using the routine writeEMData2DFile.m. For forward modeling, you can use this routine to create a dummy data file that lists the desired sources, receivers and frequencies.
  3. Run MARE2DEM on your laptop, desktop or cluster. If running on a cluster, you will first need to upload the model and data files created in step 2.  MARE2DEM will output a bunch of text to the screen informing you of its progress. For inversions, there will also be an output .logfile detailing Occam's performance; at the end of each successful iteration, the new inversion model and its response will be written to a files.
  4. View the results on your laptop or desktop. The inversion model files can be viewed using the MATLAB routine plotMARE2DEM.m.  Model responses (as well as data) can be viewed and interacted with using plotMARE2DEM_MT.m and plotMARE2DEM_CSEM.m.   At this point you may decide you want to change the forward model and recompute results, or you may want to eliminate some noisy data from an inversion; if so, carry our some quality control inspections and head back to step 2.


Summary of the main MATLAB routines

  • Mamba2D.m - creates forward and inverse models
  • plotMARE2DEM.m - for viewing for forward and inverse models
  • plotMARE2DEM_MT.m - for viewing and interacting with MT data and model responses
  • plotMARE2DEM_CSEM.m  - for viewing and interacting with CSEM data and model responses
  • writeEMData2DFile.m  - routine that will write a MARE2DEM format data file. If you can already import your data into MATLAB, then interfacing with this routine is all you need to get your data ready for MARE2DEM inversion.
  • readEMData2DFile.m  - routine that will read a MARE2DEM format data file. This may be useful if you want to write your own custom plotting utility.
  • There are a bunch of other helper functions in the MATLAB folder that these routines rely upon.

Installing the MATLAB plotting routines

First, you should have downloaded the most recent version of the MARE2DEM MATLAB routines from the download page.  Unzip that folder if you haven't already and place it in a safe place where you won't risk deleting it by accident.

Now you have to let MATLAB know where these files are located. This is done by adding them to the MATLAB search path.  So start up MATLAB  and find the "Set Path" menu item (or preferences item, depending on your version of MATLAB).  Select "Set Path" and then hit the "Add with Subfolders" button. Select the MARE2DEM MATLAB folder you downloaded and then you will have 5 folders added to the MATLAB search path, similar to what is shown in the figure below.  Hit the "Save" button so that MATLAB will store the paths for future sessions.

Setting the MATLAB search path.
Setting the MATLAB search path to see the MARE2DEM MATLAB files.