I want to use the function ipmag.curie(). This is in the ipmag module which I must first import. Then I need to understand how to call the function, so I use the help function for that.
In [1]:
import pmagpy.ipmag as ipmag
help(ipmag.curie)
I want to just look at the figures:
In [2]:
ipmag.curie(path_to_file='Chapter_8',file_name='curie_example.dat')
The Curie Temperature of this specimen is about 550$^{\circ}$C.
Now for the other file...
In [3]:
ipmag.curie(path_to_file='Chapter_8',file_name='curie_example2.dat')
Hmmm. This one IS noisier and so I should try it with a truncated window homing in on what seems to be the true Curie Temperature of around 580$^{\circ}$C.
In [4]:
ipmag.curie(path_to_file='Chapter_8',file_name='curie_example2.dat',t_begin=400,t_end=600)
So it appears that the 'true' Tc for this specimen is about 576$^{\circ}$C.
To do this problem, I first have to read in the data file. I looked at it with a text editor first and noticed that there was some sort of description in the first line and column headers in the second (or line 1 counting from zero as python normally does). This is a tab delimited file, so the separation (sep) is '\t'. I read in the data with pandas, print out the top few lines and convert it to a dataframe here:
In [5]:
import pandas as pd # import the module
# read in the data
data=pd.read_csv('Chapter_8/loess_rockmag.dat', sep='\t', header=1)
print (data.head()) # print the top few lines
data=pd.DataFrame(data) # convert to a Pandas DataFrame
Now I want to make a bunch of plots. One of them is for the ferromagnetic susceptibility. I have to subtract 60 nm$^3$kg$^{-1}$ from the total susceptibility (data['chi']). Because the units of $\chi$ are in $\mu$m$^3$kg$^{-1}$, I multiply the 60 by 10$^{-3}$ to get from nano (10$^{-9}$) to micro (10$^{-6}$).
In [6]:
data['chi_f']=data['chi']-60e-3 # calculate ferromagnetic susceptibility
In [7]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.plot(data['chi'],-data['Depth'])
plt.ylabel('Depth (m) below S0')
plt.xlabel(r'$\chi$ ($\mu$m$^3$kg$^{-1}$)')
plt.plot(data['chi_f'],-data['Depth']);
The plot above shows total $\chi$ in blue and $\chi_f$ in green.
In [8]:
# plot the sIRM versus depth below reference horizon
plt.plot(data['sIRM'],-data['Depth'])
plt.ylabel('Depth (m) below S0')
plt.xlabel(r'sIRM (mAm$^2$kg$^{-1}$)');
In [9]:
# and now for the chi_f over sIRM:
plt.plot(data['chi_f']/data['sIRM'],-data['Depth'])
plt.ylabel('Depth (m) below S0')
plt.xlabel(r'$\chi_f$/sIRM)');
Read the Hunt et al. (1995) paper and figure it out!
For this problem, we must read in the data, convert the volume normalized $\chi$ into mass normalized units, and the mass into density. Then we plot the $\chi$ data versus color (by number) and density. Looking at the data in the datafile, it also has some sort of header and columns in the second line (as in Problem 2).
In [10]:
data=pd.read_csv('Chapter_8/beach_sand.dat', sep='\t', header=1)
print (data.head() )# print the top few lines
data=pd.DataFrame(data) # convert to a Pandas DataFrame
First convert mass to kg. Then multiply chi by units of 10^-5, then by the assumed volume (in m$^3$) and then divide by mass (in kg).
In [11]:
data['mass_kg']=data['mass']*1e-3 # convert from grams to kilograms.
data['chi_norm']=data['chi']*1e-5 # put into SI
data['chi_norm']=data['chi_norm']*7e-6 # take out volume in m^3
data['chi_norm']=data['chi_norm']/(data['mass_kg']) # divide by mass in kg
print (data.head())
We need density which should be in kg/m$^3$.
In [12]:
data['rho']=data['mass_kg']/7e-6
In [13]:
plt.plot(data['Specimen'],data['chi_norm'],'ro') # plot as red dots
plt.xlabel('Color')
plt.ylabel('Mass normalized susceptibility');
The darker the specimen (higher Specimen number), the higher the susceptibility.
In [24]:
plt.plot(data['rho'],data['chi_norm'],'ro')
plt.xlabel('Density')
plt.ylabel('Mass normalized susceptibility');
The denser the specimen, the higher the susceptibility, but the relationship is not linear.
The darker minerals are magnetite, pyroxene, amphibole and biotite. Magnetite is a very dense ($\sim$5000 kg/m$^3$) and very magnetic mineral. The more magnetite in the specimens, the denser and more magnetic (and darker) the specimen becomes. You could test this by extracting the most magnetic minerals out of the samples by suspending the material in water and using a magnet, then repeat the experiment. The remaining material should be less dense, lighter and less magnetic.