This notebook tests the PmagPy distribution files using the examples in the PmagPy cookbook: http://earthref.org/PmagPy/

It is meant to function from within the PmagPy data_files/notebooks directory and calls are relative to that.
To specify a working directory, many programs have the hidden command line argument -WD.


In [1]:
#import pmagpy.ipmag as ipmag
import pmagpy.pmagplotlib as pmagplotlib
import pmagpy.pmag as pmag
from IPython.display import Image
import matplotlib as plt
basemap_present = True
try: 
    from mpl_toolkits.basemap import Basemap
except ImportError:
    print "Your Python installation doesn't have Basemap.  You won't be able to run certain plotting programs"
    basemap_present = False

%matplotlib inline

aarm_magic.py


In [2]:
!sio_magic.py -f ../aarm_magic/arm_magic_example.dat -loc Bushveld -LP AF:ANI \
    -F ../aarm_magic/aarm_measurements.txt -ncn 3 -ac 180 -dc 50 -1 -1


126  records written to file  ../aarm_magic/aarm_measurements.txt
results put in  ../aarm_magic/aarm_measurements.txt

In [3]:
!aarm_magic.py -f ../aarm_magic/aarm_measurements.txt


7  records written to file  ./arm_anisotropy.txt
specimen tensor elements stored in  ./arm_anisotropy.txt
7  records written to file  ./aarm_results.txt
specimen statistics and eigenparameters stored in  ./aarm_results.txt

angle.py


In [4]:
!angle.py -f ../angle/angle.dat | head


   75.9
  119.1
  103.7
   81.4
  120.1
  100.9
   95.1
   74.1
   78.4
  120.1

ANI_depthplot.py


In [5]:
!ani_depthplot.py -f ../ani_depthplot/rmag_anisotropy.txt -fsa ../ani_depthplot/er_samples.txt \
    -fb ../ani_depthplot/magic_measurements.txt -sav -fmt png
Image(filename='U1361A_ani_depthplot.png')


['f', 'F', 'A', 'WD', 'ID', 'Fsa', 'Fsi'] 7
-I- using default for arg: F
-
-I- using default for arg: A
-
-I- using default for arg: WD
-
-I- using default for arg: ID
-
-I- using default for arg: Fsa
-
-I- using default for arg: Fsi
-
-I- using default for arg: fa
-
-I- using default for arg: fsum
-
-I- using default for arg: ds
-
-I- using default for arg: d
-
Saved file: U1361A_ani_depthplot.png in folder: /Users/nebula/Python/PmagPy/data_files/notebooks
Out[5]:

aniso_magic.py


In [6]:
!aniso_magic.py -f ../aniso_magic/dike_anisotropy.txt -gtc 110 2 -par -v -crd g \
   -F ../aniso_magic/rmag_results.txt -fmt png -sav


Doing bootstrap - be patient
3  saved in  Scripps Beach_g_TY__aniso-tcdf_.png
1  saved in  Scripps Beach_g_TY__aniso-data_.png
2  saved in  Scripps Beach_g_TY__aniso-conf_.png
7  records written to file  ./../aniso_magic/rmag_results.txt

In [7]:
Image(filename='Scripps Beach_g_TY__aniso-tcdf_.png')


Out[7]:

In [8]:
Image(filename='Scripps Beach_g_TY__aniso-data_.png')


Out[8]:

In [9]:
Image(filename='Scripps Beach_g_TY__aniso-conf_.png')


Out[9]:

apwp.py


In [10]:
!apwp.py -f ../apwp/apwp_example.dat


   100.0    38.8   352.4    58.1    81.5   198.3

atrm_magic.py


In [11]:
!sio_magic.py -f ../atrm_magic/atrm_magic_example.dat -loc Africa -LP T:ANI\
    -F ../atrm_magic/atrm_measurements.txt -ncn 1 -dc 40 -1 -1


210  records written to file  ../atrm_magic/atrm_measurements.txt
results put in  ../atrm_magic/atrm_measurements.txt

In [12]:
!atrm_magic.py -f ../atrm_magic/atrm_measurements.txt\
   -Fa ../atrm_magic/trm_anisotropy.txt -Fr ../atrm_magic/atrm_results.txt


30  records written to file  ./../atrm_magic/trm_anisotropy.txt
specimen tensor elements stored in  ./../atrm_magic/trm_anisotropy.txt
30  records written to file  ./../atrm_magic/atrm_results.txt
specimen statistics and eigenparameters stored in  ./../atrm_magic/atrm_results.txt

azdip_magic.py


In [13]:
!azdip_magic.py -f ../azdip_magic/azdip_magic_example.dat -ncn 1\
   -mcd FS-FD:SO-POM -loc "Northern Iceland" -F ../azdip_magic/er_samples.txt


['f', 'F', 'A', 'WD', 'ID', 'Fsa', 'Fsi'] 7
-I- using default for arg: A
-
-I- using default for arg: WD
-
-I- using default for arg: ID
-
-I- using default for arg: Fsa
-
-I- using default for arg: Fsi
-
-I- using default for arg: app
-
checked_args: [['f', '../azdip_magic/azdip_magic_example.dat'], ['ncn', '1'], ['mcd', 'FS-FD:SO-POM'], ['loc', 'Northern', 'Iceland'], ['F', '../azdip_magic/er_samples.txt'], ['A', ''], ['WD', '.'], ['ID', '.'], ['Fsa', 'er_samples.txt'], ['Fsi', 'er_sites.txt'], ['app', False]]
916  records written to file  ./er_samples.txt
Data saved in  ./er_samples.txt

b_vdm.py


In [14]:
!b_vdm.py -f ../b_vdm/b_vdm_example.dat


 7.159e+22

basemap_magic.py

basemap_magic doesn't work anymore.

biplot_magic.py


In [15]:
!biplot_magic.py -f ../biplot_magic/biplot_magic_example.dat \
       -x LP-X -y LT-AF-I -fmt png -sav


LP-X  selected for X axis
LT-AF-I  selected for Y axis
All
measurement_magn_mass  being used for plotting Y
measurement_chi_mass  being used for plotting X.
1  saved in  All_fig.png

In [16]:
Image(filename='All_fig.png')


Out[16]:

bootams.py


In [17]:
!bootams.py -par -f ../bootams/bootams_example.dat


Doing bootstrap - be patient

tau tau_sigma V_dec V_inc V_eta V_eta_dec V_eta_inc V_zeta V_zeta_dec V_zeta_inc

0.33505 0.00020     5.3    14.7    10.8   266.8    28.2    25.3   122.4    56.6
0.33334 0.00022   124.5    61.7    18.3   245.5    14.9    22.9   341.7    22.3
0.33161 0.00027   268.8    23.6    10.0     6.8    18.2    19.3   131.1    59.7

cart_dir.py


In [18]:
!cart_dir.py -f ../cart_dir/cart_dir_example.dat


  340.0    65.0  1.000e+00
  176.0   -55.0  1.000e+00

chartmaker.py

You can't do chartmaker from within the notebook. And chi_magic.py is still a bit buggy (problem with legend and 4th plot still shows up.)

chi_magic.py


In [19]:
!chi_magic.py -f ../chi_magic/chi_magic_example.dat -fmt png -sav


IRM-Kappa-2352 1 out of  2
IRM-OldBlue-1892 2 out of  2
Skipping susceptibitily - AC field plot as a function of temperature
1  saved in  IRM-OldBlue-1892_1.png
3  saved in  IRM-OldBlue-1892_3.png
2  saved in  IRM-OldBlue-1892_2.png

In [20]:
Image(filename='IRM-OldBlue-1892_1.png')


Out[20]:

In [21]:
Image(filename='IRM-OldBlue-1892_3.png')


Out[21]:

In [22]:
Image(filename='IRM-OldBlue-1892_2.png')


Out[22]:

common_mean.py


In [23]:
!common_mean.py -f ../common_mean/common_mean_ex_file1.dat\
   -f2 ../common_mean/common_mean_ex_file2.dat -sav -fmt png


Doing first set of directions, please be patient..
Doing second  set of directions, please be patient..
2  saved in  CD_Y.png
1  saved in  CD_X.png
3  saved in  CD_Z.png

In [24]:
Image(filename='CD_X.png')


Out[24]:

In [25]:
Image(filename='CD_Y.png')


Out[25]:

In [26]:
Image(filename='CD_Z.png')


Out[26]:

cont_rot.py


In [27]:
!cont_rot.py -con af:sam -prj ortho\
    -eye -20 0 -sym k-  1 -age 180 -res l  -fmt png -sav


1  saved in  Cont_rot.png

In [28]:
if basemap_present:
    image = Image(filename="Cont_rot.png")
else: 
    image = None
image


Out[28]:

convert_samples.py


In [29]:
!convert_samples.py -f ../convert_samples/convert_samples_example.dat\
   -F ../convert_samples/orient_Northern_Iceland.txt


file_type er_samples
916  records written to file  ./../convert_samples/orient_Northern_Iceland.txt
Data saved in:  ./../convert_samples/orient_Northern_Iceland.txt

core_depthplot.py


In [30]:
!core_depthplot.py -fsa ../core_depthplot/er_samples.txt -LP AF 15 \
    -f ../core_depthplot/magic_measurements.txt -log \
    -d 50 150 -ts gts12 23 34 -D -fmt png -sav


['f', 'F', 'A', 'WD', 'ID', 'Fsa', 'Fsi'] 7
-I- using default for arg: F
-
-I- using default for arg: A
-
-I- using default for arg: WD
-
-I- using default for arg: ID
-
-I- using default for arg: Fsa
-
-I- using default for arg: Fsi
-
-I- using default for arg: fsum
-
-I- using default for arg: fwig
-
-I- using default for arg: fa
-
-I- using default for arg: fsp
-
-I- using default for arg: fres
-
-I- using default for arg: n
-
-I- using default for arg: L
-
-I- using default for arg: S
-
-I- using default for arg: I
-
-I- using default for arg: M
-
-I- using default for arg: ds
-
-I- using default for arg: sym
-
9328  measurements read in from  ./../core_depthplot/magic_measurements.txt
spec file found

In [31]:
Image(filename='DSDP Site 522_m__LT-AF-Z_core-depthplot.png')


Out[31]: