Rock magnetic python code. Kappabridge K15 AMS data right now
Can I make this a Kn file and Allow for K6, K9, and K15?
CLASSES:
AMSposition - get info about the phi theta for different measurement schemes
K15 - Handle a 15 position measurement
K15file - Read and write SIO .k15 files
VERSION
$Id: anisotropy.py,v 1.3 2005/03/05 17:19:53 schwehr Exp $
LICENSE
Copyright (C) 2005 Kurt Schwehr
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Classes |
| |
- AMSposition
- K15
- K15file
class AMSposition |
|
get info about the phi theta for different measurement schemes |
|
Methods defined here:
- __init__(self, numPos=15)
- Create an object with the number of positions.
Valid number of positions are 6, 9, and 15
- getPhiTheta(whichPos)
- Return phiTheta in radians for a position index. First pos is 0
- getPhiThetaFrom1(whichPos)
- Return phiTheta in radians for a position index. First pos is *** 1 ***
Data and other attributes defined here:
- numberOfPositions = -999
|
class K15 |
|
Wrap a k15 record. Can this be generalized to Kn? |
|
Methods defined here:
- addToDatabase(cx, table='ams')
- Add the value stored in this class instance into an sqlite database in table
- getHext()
- Return some sort of class that has all the hext statistics
- getK(index)
- Return a raw susceptability
- getName()
- getParameter(paramName)
- Return a derived parameter... should this be part of a hext class instead?
- getS()
- Return the 6 s matrix values plus sigma in the 7th field
- setFromDatabase(samplename, cx, table='ams')
- lookup samplesame in an sqlite database from the specified table
- setFromFile(filedescriptor)
- Read through an open file descriptor for the next k15 entry.
The file must be SIO .k15 4 line style with optional comment
lines that start with the '#' character.
- setFromLines(lines)
- Can be all on one line or a list of 4 lines
- writeMagIC(fileDescriptor)
- Write out the magic sample entry to an open file
Data and other attributes defined here:
- date = datetime.date(1, 1, 1)
- rawbulk = -999
- sampleHolder = -999.0
- samplename = 'unknown'
- username = 'nobody'
|
class K15file |
|
Handle SIO format .k15 files from Bruno the KLY-2
This handles an .k15 files with one extension. These files
can also have lines that begin with '#' which are treated as
comments. |
|
Methods defined here:
- appendComment(string)
- Add a # comment line to the end of the file
- appendK15(k15sample)
- Add a K15 instance on to the end of the file
- close()
- Close the file handle for the currently open file
- eof()
- Test if we are at the end for the file in read mode
- getK15ByName(samplename)
- Read and return the first K15 record with a specific name
- getNextK15()
- Read and return the next K15 record as a K15 object
- open(filename, mode='r')
- Open a file for reading and/writing of K15 AMS data. SIO Format
arguments:
filename --- file to open
mode --- r for read, w for write, rw for read/write
- seek(recordNum=0)
- Jump to a specific record by number.
Going far into the file will be slow!
- writeMagic(filename)
- Writes from the current record to the end of file
out to a magIC format file. This is just the measurement table
| |