| |
- Segy
- SegyHdr
- SegyTraceHdr
- unittest.TestCase(__builtin__.object)
-
- TestDriverName
- TestSegy
class Segy |
|
Base class that contains the SEGY header and all the traces
http://seg.org/publications/tech-stand/
Then look at segy rev 0 and rev 1 |
|
Methods defined here:
- __init__(self, filename=None, drivername='segy_drv_rev1', verbosity=0)
- Open up a segy file for reading using mmap for speed.
filename - name of the segy file to read
drivername - what format of segy does this file need.
FIX: Eventually a value of None should allow you to have this
code identify the version.
verbosity - how much spewage
- getHeader(self)
- getNumberOfTraces(self)
- FIX: deal with variable length traces
- getRawTrace(self, traceNumber)
- Return a block of bytes for a trace including header and data
- getTraceData(self, traceNumber=1)
- return a list of samples
FIX: cope with variable length traces
- getTraceDataSize(self, traceNumber=1)
- FIX: handle variable length traces
- getTraceHdr(self, traceNumber=1)
- getTraceSize(self, traceNumber=1)
- returns the number of bytes for the particular trace
fix: cope with variable length traces
- getTraceStart(self, traceNumber)
- Return the starting offset in a file of a particular trace
FIX: cope with extended text headers and variable length traces
- writeTraceToFile(self, filename='default.dat', traceNumber=1)
- Write out pairs of samplenumber and value to a file
|
class SegyHdr |
|
class for reading segy seismic file header
http://seg.org/publications/tech-stand/
Then look at segy rev 0 and rev 1 |
|
Methods defined here:
- __init__(self, mmapData=None, size=None, filename=None, drv=None)
- Open up a segy file for reading using mmap for speed.
- getBinEntry(self, fieldName)
- Retrieve the value from one of the binary header entries by name
- getEntireRawHdr(self)
- Return a block of memory containing all of the text, binary, and extended headers
- getTextFileBlock(self)
- Return the raw text header block. Could be either ebcdic or ascii
- getTextHeaderField(self, fieldName)
- BROKEN
e.g.:
C2 LINE:5t6 AREA:Goleta
- getTextHeaderLine(self, lineNumber)
- Return the string for the line number
- getTextTranslateValue(self, key, val)
- Lookup in the driver what the translation for a value should be
e.g. 'SampleFormat' of 1 will return:
4-byte IBM floating point
- hasR1TextFileHeader(self)
- Turn True if it has a R1 header with C1..C40 sections as ASCII
- printBinaryHeaders(self, shortList=False, filename=None)
- Dump all header into to stdout
shortList - use the shorter list provided by the driver. most interesting fields
- sqlInsert(self, filename, specificKeys=None, table='segyFile')
- Build an SQL string to INSERT the values for the current file
SEE CREATE...
FIX: CorrelatedTraces and BinGainRecovered are bools, but I treat them as ints
FIX: maybe check self.drv if this function is provided by the driver.
|
class SegyTraceHdr |
|
Handle one trace in a segy file. |
|
Methods defined here:
- __init__(self, segyHdr, startOffset, mmapData=None, drv=None)
- Load up a trace from an mmap'ed data file by jumping to the startOffset
- getHeader(self, fieldName)
- Return the interpreted value for a trace header field
Should know about IBM floats but does not!
- getTextTranslateValue(self, key, val)
- Lookup in the driver what the translation for a value should be
e.g. 'TraceId'
- printHeader(self, shortList=False, filename=None, traceNum=None)
- Dump all trace header info to stdout
shortList - use the driver specified shorter list of more interesting fields
- sqlInsert(self, specificKeys=None, table='segyTrace', traceNumber=-1, fileKey=-1)
- Build an SQL string to INSERT the values for the current trace
SEE CREATE...
FIX: CorrelatedTraces and BinGainRecovered are bools, but I treat them as ints
FIX: maybe check self.drv if this function is provided by the driver.
traceNumber - a trace does not know its number. Set it if you
know it! the traceNumber is which trace position in
the header. Not necessarily shot number!!!
FIX FIX FIX: deal with things that are not integers!!!
|
class TestDriverName(unittest.TestCase) |
|
###################################################################### |
|
- Method resolution order:
- TestDriverName
- unittest.TestCase
- __builtin__.object
Methods defined here:
- test01Nop(self)
- test02Py(self)
- test03drv(self)
- test04segy(self)
- test05(self)
- test06(self)
- test07(self)
- test10load(self)
Methods inherited from unittest.TestCase:
- __call__(self, *args, **kwds)
- __init__(self, methodName='runTest')
- Create an instance of the class that will use the named test
method when executed. Raises a ValueError if the instance does
not have a method with the specified name.
- __repr__(self)
- __str__(self)
- assertAlmostEqual = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertAlmostEquals = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertEqual = failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- assertEquals = failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- assertFalse = failIf(self, expr, msg=None)
- Fail the test if the expression is true.
- assertNotAlmostEqual = failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertNotAlmostEquals = failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertNotEqual = failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- assertNotEquals = failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- assertRaises = failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
- Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
- assertTrue = failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- assert_ = failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- countTestCases(self)
- debug(self)
- Run the test without collecting errors in a TestResult
- defaultTestResult(self)
- fail(self, msg=None)
- Fail immediately, with the given message.
- failIf(self, expr, msg=None)
- Fail the test if the expression is true.
- failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
- Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
- id(self)
- run(self, result=None)
- setUp(self)
- Hook method for setting up the test fixture before exercising it.
- shortDescription(self)
- Returns a one-line description of the test, or None if no
description has been provided.
The default implementation of this method returns the first line of
the specified test method's docstring.
- tearDown(self)
- Hook method for deconstructing the test fixture after testing it.
Data and other attributes inherited from unittest.TestCase:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'TestCase' objects>
- list of weak references to the object (if defined)
- failureException = <class exceptions.AssertionError>
- Assertion failed.
|
class TestSegy(unittest.TestCase) |
|
Run the segy class through its paces
Use one of the BPSIO xstar segy files. These are not proper segy |
|
- Method resolution order:
- TestSegy
- unittest.TestCase
- __builtin__.object
Methods defined here:
- setUp(self)
- tearDown(self)
- testA0000SqlGlobalCreate(self)
- Make sure the globally scoped create database functions work
- testA0004TraceHdr(self)
- Read some header fields out of a trace
- testA0005TraceHdr100(self)
- Read some header fields out of a trace
- testA0006TraceWrite(self)
- testA0007TracePrintHdr(self)
- testA0010FileSqlCreate(self)
- Make sure the CREATE TABLE string looks ok
- testA0011FileSqlInsert(self)
- Make sure the INSERT INTO string looks ok
- testA0012FileSqlite(self)
- Make sure the CREATE and INSERT actually pass sqlite
- testA001Open(self)
- Make sure we can open a file
- testA0020FileSqlCreate(self)
- Make sure the CREATE TABLE string looks ok
- testA0021FileSqlInsert(self)
- Make sure the INSERT INTO string looks ok
- testA0022FileSqlite(self)
- Make sure the CREATE and INSERT actually pass sqlite
- testA002FileBinHeader(self)
- Be able to read a value out of the file header
- testA003KeyValueTranslation(self)
- Can we get the english translation of a value?
- testIntro(self)
- Test the first few bytes of the file - magic number C1 or C 1
- testSegyTrace(self)
- work on the trace class
- testSegyTrace2(self)
- work on the trace class - load in two and make sure they are different
Methods inherited from unittest.TestCase:
- __call__(self, *args, **kwds)
- __init__(self, methodName='runTest')
- Create an instance of the class that will use the named test
method when executed. Raises a ValueError if the instance does
not have a method with the specified name.
- __repr__(self)
- __str__(self)
- assertAlmostEqual = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertAlmostEquals = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertEqual = failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- assertEquals = failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- assertFalse = failIf(self, expr, msg=None)
- Fail the test if the expression is true.
- assertNotAlmostEqual = failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertNotAlmostEquals = failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- assertNotEqual = failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- assertNotEquals = failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- assertRaises = failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
- Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
- assertTrue = failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- assert_ = failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- countTestCases(self)
- debug(self)
- Run the test without collecting errors in a TestResult
- defaultTestResult(self)
- fail(self, msg=None)
- Fail immediately, with the given message.
- failIf(self, expr, msg=None)
- Fail the test if the expression is true.
- failIfAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- failIfEqual(self, first, second, msg=None)
- Fail if the two objects are equal as determined by the '=='
operator.
- failUnless(self, expr, msg=None)
- Fail the test unless the expression is true.
- failUnlessAlmostEqual(self, first, second, places=7, msg=None)
- Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
- failUnlessEqual(self, first, second, msg=None)
- Fail if the two objects are unequal as determined by the '=='
operator.
- failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
- Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
- id(self)
- run(self, result=None)
- shortDescription(self)
- Returns a one-line description of the test, or None if no
description has been provided.
The default implementation of this method returns the first line of
the specified test method's docstring.
Data and other attributes inherited from unittest.TestCase:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'TestCase' objects>
- list of weak references to the object (if defined)
- failureException = <class exceptions.AssertionError>
- Assertion failed.
| |