anisoms package

A library to read and manipulate AMS data from AGICO instruments.

class anisoms.Direction(components)

Bases: object

A direction in three-dimensional space

classmethod from_polar_degrees(dec, inc)

Create a direction from declination and inclination in degrees

classmethod make_lower_hemisphere(x, y, z)

Create a lower-hemisphere direction from an (x, y, z) triplet.

If z<0, the co-ordinates will be flipped when creating the Direction object.

plot(canvas, shape='s')

Plot this direction on a pyx canvas.

The direction will be transformed onto a Lambert equal-area projection and plotted as a square, circle, or triangle (shape parameter: s, c, or t).

project(scale=10)

Return a Lambert azimuthal equal-area projection of this direction

to_decinc()

Convert this direction to declination/inclination (degrees)

class anisoms.PrincipalDirs(p1, p2, p3, tensor=None)

Bases: object

A set of three principal directions

classmethod from_tensor(tensor)

Make principal directions from a tensor.

Any upward pointing directions are flipped, so all resulting directions are in the lower hemisphere (z>0).

plot(canvas, other=None)

Plot these directions on a pyx canvas.

Plot these directions using standard AMS conventions: Lambert equal-area projection; major direction as a square; intermediate direction as a triangle; minor direction as a circle. If the “other” argument is provided, additionally draw a line from each direction in this PrincipalDirs object to its corresponding direction in the other PrincipalDirs object; this is intended to provide a visual comparison between pairs of PrincipalDirs objects, in particular when the directions are close to one another.

to_decinc_string()

Convert to a string of declination/inclination pairs.

Output string is formatted as:

dec1 inc1 dec2 inc2 dec3 inc3

to_decinc_tuples()

Return a 3-tuple of 2-tuples of declination/inclination pairs

anisoms.corrected_anisotropy_factor(ps1, ps2, ps3)

Calculate the corrected anisotropy factor (P′ or Pj)

See Jelínek, 1981, “Characterization of the magnetic fabric of rocks” for definition. See also Hrouda, 1982, “Magnetic anisotropy of rocks and its application in geology and geophysics”. Notation for this parameter is usually P′ or Pj; in the ASC file it is 'P.

Arguments are the three principal susceptibilities in descending order.

anisoms.directions_from_asc_directions(filename, system_header)

Read principal directions from an ASC file.

The requested co-ordinate system is specified in the same string format that the ASC file itself uses: Specimen, Geograph Paleo 1, Paleo 2, Tecto 1, or Tecto 2. If any sample in the file does not have data for the requested co-ordinate system, it will be omitted from the returned dictionary.

Parameters:
  • filename – an Agico ASC file to read
  • system_header – a string specifying the co-ordinate system to use
Returns:

an ordered dictionary whose keys are sample names and whose values are PrincipalDirs objects

anisoms.directions_from_asc_tensors(filename, system_header='Geograph')

Calculate principal directions from tensors in an ASC file.

The requested co-ordinate system is specified in the same string format that the ASC file itself uses: Specimen, Geograph Paleo 1, Paleo 2, Tecto 1, or Tecto 2. If any sample in the file does not have data for the requested co-ordinate system, an exception will be raised.

Parameters:
  • filename – an Agico ASC file to read
  • system_header – a string specifying the co-ordinate system to use
Returns:

an ordered dictionary whose keys are sample names and whose values are PrincipalDirs objects

anisoms.directions_from_ran(filename)

Read directions from a RAN file.

Directions are returned in the geographical co-ordinate system, since this is the only system used in a RAN file.

Parameters:filename – an Agico RAN file to read
Returns:an ordered dictionary whose keys are sample names and whose values are PrincipalDirs objects
anisoms.read_asc(filename)

Read AMS data from an AGICO ASC file.

Returns an ordered dictionary indexed by sample name. All values are returned as strings for maximum fidelity in format conversions. The ASC format can vary a little, so not every possible field is guaranteed to be present in every sample record.

The vector_data key points to another dictionary, indexed by co-ordinate system (“Specimen”, “Geograph”, etc.). For each co-ordinate system present in the ASC data for the sample, the relevant key points to another dictionary with the keys “directions” and “tensor”. “directions” points to a list of three tuples (the principal directions). “tensor” points to a list of six values defining the anisotropy tensor. So, for instance, to get the second principal direction in the geographic system of the sample “jeff”, one could write:

read_asc(filename)["jeff"]["vector_data"]["Geograph"]["directions"][1]

List of keys in the sample record: name, program, azimuth, orientation_parameters nominal_volume, dip, demagnetizing_factor_used holder_susceptibility, actual_volume, T1, F1 L1, T2, F2, L2, field, frequency mean_susceptibility, standard_error, Ftest F12test, F23test, mean_susceptibility norming_factor, standard_error, Ftest, F12test F23test, principal_suscs, a95s principal_susc_errs, a95_errs, L, F, P primeP, T, U, Q, E, vector_data, date.

anisoms.read_ran(filename)

Read AMS data from a RAN file.

Returns a tuplet of (header_data, sample_data).

header_data is an ordered dictionary, indexed by header field name, with an entry for each header data field.

sample_data is an ordered dictionary, indexed by sample name, with an entry for each sample. Each entry in this dictionary is itself an ordered dictionary, indexed by sample data field name, with an entry for each item of sample data.

Header field key names: num_recs, int, locality, long lat, rock, strati, litho, regio, orient. All of these have string values, except num_recs, which has an int value.

Sample field key names: name, mean_susceptibility, frequency, field, tensor, C1, FOLI1, LINE1, C2, FOLI2, LINE2