Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Summary plots of hysteresis parameters

This notebook imports summary hysteresis parameters from a MagIC contribution and generates:

  • a Day plot which is the remanence ratio (Mr/Ms; “squareness”) vs. the coercivity ratio (Bcr/Bc)

  • a squareness-coercivity diagram (Mr/Ms) vs. the coercivity (Bc); also referred to as a Néel plot

Here, Mr is the remanent magnetization, Ms is the saturation magnetization, Bc is the coercivity, and Bcr is the coercivity of remanence.

import pmagpy.rockmag as rmag
import pmagpy.ipmag as ipmag
import pmagpy.contribution_builder as cb
import pandas as pd

import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'

Download data in MagIC format

We will start by downloading the MagIC data associated with this paper (MagIC ID of 16460):

  • Jackson, M. and Swanson-Hysell, N.L. (2012), Rock Magnetism of Remagnetized Carbonate Rocks: Another Look, In: Elmore, R. D., Muxworthy, A. R., Aldana, M. M. and Mena, M., eds., Remagnetization and Chemical Alteration of Sedimentary Rocks, Geological Society of London Special Publication, 371, Jackson & Swanson-Hysell (2012).

# set the dir_path to the directory where the measurements.txt file is located
dir_path = '../example_data/Jackson2012'

# download the data from the MagIC database (public contribution 16460)
result, magic_file = ipmag.download_magic_from_id('16460', directory=dir_path)
# unpack the MagIC file
ipmag.unpack_magic(magic_file, dir_path, print_progress=False)
# get the contribution object
contribution = cb.Contribution(dir_path)
# get the measurements table
measurements = contribution.tables['measurements'].df
measurements = measurements.dropna(axis=1, how='all')
specimens = contribution.tables['specimens'].df
Download successful. File saved to: ../example_data/Jackson2012/magic_contribution_16460.txt
1  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/contribution.txt
5  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/locations.txt
8  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/sites.txt
51  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/samples.txt
186  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/specimens.txt
4758  records written to file  /Users/penokean/0000_GitHub/RockmagPy-notebooks/example_data/Jackson2012/measurements.txt
-I- Using online data model
-I- Getting method codes from earthref.org
-I- Importing controlled vocabularies from https://earthref.org
specimens.head()
Loading...

Make Day Plot

Option 1: filter for individual specimen data and make a Day Plot

  • One has more flexibility to make a custom plot

  • However, the user has to specify the row numbers that contain each of the attributes

specimen_name = '09-27'
example_specimen_data = specimens[specimens['specimen'] == specimen_name].reset_index()
example_specimen_data
Loading...
ax = rmag.plot_day(Mr = example_specimen_data['hyst_mr_mass'][1], 
                   Ms = example_specimen_data['hyst_ms_mass'][1],
                   Bcr = example_specimen_data['rem_bcr'][0],
                   Bc = example_specimen_data['hyst_bc'][1], 
                   color = 'red', 
                   marker = 'o', 
                   label = specimen_name, 
                   alpha=1, 
                   lc = 'black')

plt.show()
<Figure size 800x600 with 1 Axes>

Option 2: Plot all specimen data in a MagIC specimens data table on a Day Plot

  • Because Bcr is obtained from a backfield experiment whereas other values can be obtained from a hysteresis experiment, the data entry in the data tables are decoupled. In many cases there could be multiple entries for the same attribute for the same specimen.

  • If one were to use the default approach to plot all data at once, bear in mind that the default function will simply take the average of all of the entries for the same attribute for the same specimen.

H_specimens = specimens[specimens['specimen'].str.contains('H')].reset_index()

# let's filter for the room temperature measurements
H_specimens_RT = H_specimens[H_specimens['meas_temp'] == 300].reset_index(drop=True)
H_specimens_RT.head()
Loading...
ax=rmag.plot_day_magic(H_specimens_RT,
               by='specimen',
               Mr='hyst_mr_mass', 
               Ms='hyst_ms_mass', 
               Bcr='rem_bcr', 
               Bc='hyst_bc', 
               color = 'dodgerblue', 
               marker = 'o', 
               label = 'Jackson 2012 carbonates', 
               alpha=1, 
               lc = 'black')
<Figure size 800x600 with 1 Axes>

Make squareness-coercivity diagram


ax = rmag.plot_neel_magic(H_specimens_RT,
            by='specimen',
            Mr='hyst_mr_mass', 
            Ms='hyst_ms_mass', 
            Bcr='rem_bcr', 
            Bc='hyst_bc', 
            color = 'dodgerblue', 
            marker = 'o', 
            label = 'Jackson 2012 carbonates', 
            alpha=1, 
            lc = 'black')
ax.set_xlim(0, 0.01)
ax.set_ylim(0, 0.4)
plt.show()
<Figure size 500x500 with 1 Axes>
References
  1. Jackson, M., & Swanson-Hysell, N. L. (2012). Rock magnetism of remagnetized carbonate rocks: another look. Geological Society, London, Special Publications, 371(1), 229–251. 10.1144/sp371.3