Processing Paleomagnetic Data on the JR using PmagPy

 

There is a Jupyter notebook set up to process paleomagnetic data generated on board the JR using PmagPy, a python-based data analysis package. Jupyter notebook is an open-sourced application that allows for interactive coding and data presentation in a versatile browser-like format. PmagPy has been installed on the shipboard Macintosh computer next to the JR6.    To get started, open a terminal window (type terminal into the search icon in the upper right hand corner of the Mac menu bar), click on it, and follow these steps:


  1. Refresh the PmagPy software to get the latest version:
  • After the “$” prompt in the terminal window, type (case sensitive):
    • $ cd Desktop/PmagPy
    • $ git pull

2. Launch a Jupyter notebook from the terminal window:

  • After the “$” prompt in the terminal window, type (case sensitive):
    • $ cd
    • $ cd Desktop/anaconda3/data_files
    • $ jupyter notebook


This terminal execution will open up a window something like this:



Click on the PmagPy_iodp_HOLE_template.ipynb link.  This is a template for working with JR paleomagnetic data downloaded from LIMS. 


3. Learn the basics of Jupyter notebook operation:


There are two kinds of cells in a Jupyter notebook:  “Markdown” and “Code”. Code cells are the primary content of Jupyter notebooks. They contain source code in the language of the document's associated kernel, and a list of outputs associated with executing that code. Text can be added to Jupyter Notebooks using Markdown cells. The flavor can be picked in a dropdown menu at the top of the notebook (the cell labeled Markdown in the figure below).  To “run” a cell, just click on the cell and then click on “Run” in the menu next to the “flavor” menu.




You don’t have to actually know Python to use this notebook, but the code cells contain Python scripts which do the data processing and visualization for you. 


4. Practice on FAKE data first:


There is a worked example of how to use the notebooks in the PmagPy-data folder.  From your open notebook, look under the “File” menu in the notebook menu bar, click on ‘Open’, then click on data_files => iodp_magic and finally click on U999A.ipynb

Read through the notebook and execute each cell in turn. 


Now let’s work with your REAL data

5. Set up your directory structure:

On Exp 378, the directory structure for the paleomagnetic working directory looked like this:  Desktop/anaconda3/data_files. In this case, “data_files” is the working directory.

It doesn’t matter what you call that directory and we will refer to it as the “working_directory”.   Each hole will have its own Jupyter notebook which will create a directory for each hole with the structure like this:  working_directory/U999A.  If you have not already done so, create a working directory and put the PmagPy_iodp_HOLE_template.ipynb in it, according to step 6. The program will not work if this file and your data are not in the same working directory.

6. Setup a notebook for your own data:

Open the PmagPy_iodp_HOLE_template notebook either from your open notebook, or go back to the terminal window and type jupyter notebook again.  Copy the notebook by selecting “Make a copy” from the File Menu on the notebook menu bar.  Then select File => Rename and rename it for your HOLE (e.g., U999A).    Place the copy in your working directory. 

Edit the first code cell (below “Preliminaries”) with the HOLE name for your expedition, HOLE. New names should be entered within the available quotation marks. This will set up the directory structure that the notebook expects within the HOLE folder that you created in step 5.  Eventually, you should set the hole_lat and hole_lon variables too as this will correctly populate the MagIC tables with the required meta-data, but that is not necessary at first (although if you want the GAD inclination on you plots, you should do this as soon as the information is available. See Hole Summary under Summaries in the LIMS Reports window below.). Once you have made the changes, be sure to execute the code cell with “Run”, located near the top of the notebook.  Once you run the cell, the folders specified in the code will automatically be placed into the HOLE folder. To save the notebook, click on the little disk icon on the left end of the menu bar, or choose Save under the File menu.


7. Download data to analyze in your new notebook

  • To process paleomagnetic data generated on the ship, you need to download the data files from LORE. These data files will go into the directory structure you just created. 
  • To get the necessary files, open a new browser window and go to: ship.iodp.tamu.edu.


  • Click on Download LIMS core data




  • Click on ‘Summaries’ and select “Hole Summary”. Select the Expedition, Site and Hole, then click on “view data”, then “Download tabular data”.
  • Repeat for “Core Summary”.
  • Then click on on 'Curation and Samples' and then select the 'Sample Report'. Then choose the sample type of Cube under Sample Filters and Pmag as the sample code. Click on the 'Download tabular data' tab.
  • Click on Magnetism and download SRM archive data, discrete sample data, JR6 data and/or Kappabridge data (be sure to select the extended version for kappabridge).
  • Follow the instructions in the notebook.


8. Go forth and enjoy the bountiful pleasures of paleomagnetic analyses!


Credits

This document originated from a Word document that was written by Lisa Tauxe


Archive Versions:

  • No labels