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.

Hysteresis Processing

Install and import packages

Loading...
Loading...

Import local data in MagIC format

In this demonstration we will be using local data.

The data is from the following publication:

  • Swanson-Hysell, N. L., Avery, M. S., Zhang, Y., Hodgin, E. B., Sherwood, R. J., Apen, F. E., et al. (2021). The paleogeography of Laurentia in its early years: New constraints from the Paleoproterozoic East-Central Minnesota Batholith. Tectonics, 40, e2021TC006751. Swanson‐Hysell et al. (2021)

1  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/contribution.txt
1  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/locations.txt
90  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/sites.txt
312  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/samples.txt
1574  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/specimens.txt
17428  records written to file  /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/measurements.txt
-I- Using online data model
-I- Getting method codes from earthref.org
-I- Using cached vocabularies
-I- Using cached suggested vocabularies

Get hysteresis data using the method code

The method codes relevant to hysteresis loops are:

  • LP-HYS for regular hysteresis loops

  • LP-HYS-O for hysteresis loops as a function of orientation

  • LP-HYS-T for hysteresis loops as a function of temperature

We can filter the data to only have data for LP-HYS.

We can see what experimental hysteresis data are available in this dataset:

Loading...

Process hysteresis data for one experiment

We can process the data from one of the experiments using the rmag.process_hyst_loop function. The processing steps behind the function are described in the hysteresis_processing_walk_through.ipynb notebook.

Loading...
Loading...
Loading...
Loading...

Process hysteresis data for all experiments

The decision tree handles the full range of loop behavior within a batch: statistically linear loops terminate with only χHF reported (the fit_linear_loop=True argument overrides this exit when full processing is desired), and every other loop is processed in full. Loop closure at high field is tested and reported rather than acted on: each row of the results table carries closure_state ('closed', 'open' or 'indeterminate') and the openness statistic HF_Mrh_fraction (fopenf_{open}, the high-field Mrh as a fraction of Mr) with its standard error, loops that are open or of unresolved closure are flagged with a printed -W- line, and a summary line reports how many were flagged. The openness_tolerance argument (default 0.05) sets the level of fopenf_{open} at which a loop is flagged. When results are written to the specimens table, add_hyst_stats_to_specimens_table(..., exclude_open=True) withholds Ms, Bc and χHF for open loops while keeping Mr and Brh.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
-I- 0 of 5 loops open at high field, 0 of unresolved closure, 0 statistically linear; see the 'closure_state', 'HF_Mrh_fraction' and 'loop_is_linear' columns

Export hysteresis loop statistics into a MagIC specimens data table

The add_hyst_stats_to_specimens_table function adds the summary hysteresis parameters (hyst_ms_mass, hyst_mr_mass, hyst_bc, hyst_xhf) to the MagIC columns of the specimens table, with the additional quality statistics (Q, Qf, FNL values, sigma, etc.) recorded in the description column.

Loading...

The updated table can then be written out as a MagIC-format specimens.txt file:

-I- overwriting /private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/specimens.txt
-I- 1574 records written to specimens file
'/private/tmp/claude-501/-Users-hematite-Documents-GitHub-PmagPy/167d67da-2cda-4fca-810e-f539c9908e87/scratchpad/rmnb2/example_data/ECMB/specimens.txt'

Processing hysteresis data that are not in MagIC format

While the workflow above is built around MagIC-formatted data — the recommended practice, since it keeps measurement-level data, metadata, and derived parameters together — the processing functions themselves operate on simple sequences of field and magnetization values. This makes these algorithms accessible to data coming from any stream: an instrument export, a spreadsheet, or a colleague’s text file.

A few conventions to be aware of:

  • Field values are expected in tesla. The high-field susceptibility unit conversions assume tesla, and a warning is printed if the field values appear to be in mT or Oe.

  • Magnetization can be in any consistent unit. Mass-normalized Am²/kg matches MagIC conventions and makes the resulting Ms and Mr directly comparable to database values.

  • Inputs are cleaned automatically by sanitize_hyst_inputs: plain Python lists, numeric strings, and dataframe columns are all accepted; measurement pairs with non-finite values are dropped with a report; and loops measured in either field sweep order (starting from positive or negative saturation) are handled.

Below we process a plain two-column CSV file (the NED18-2c loop exported with field_tesla and moment_Am2_per_kg columns):

Loading...
Loading...
Loading...
Loading...
References
  1. Swanson‐Hysell, N. L., Avery, M. S., Zhang, Y., Hodgin, E. B., Sherwood, R. J., Apen, F. E., Boerboom, T. J., Keller, C. B., & Cottle, J. M. (2021). The Paleogeography of Laurentia in Its Early Years: New Constraints From the Paleoproterozoic East‐Central Minnesota Batholith. Tectonics, 40(5). 10.1029/2021tc006751