#Contents:
Indexes LIS files.
Created on 10 Feb 2011
@author: p2ross
Specialisation of exception for the LIS file indexer.
Create an index for the LIS file, theF is a LIS File object.
xAxisIndex is the channel index that is regarded as the X axis (default 0). This is currently ignored in the absence of a reasonable use case.
Generates each index object (child class of IndexObjBase).
Yields all IndexLogPass objects in the index.
This provides the minimal information for creating a Plot. It yields a PlotRecordSet that has (tell_FILM, tell_PRES, tell_AREA, tell_PIP, IndexLogPass) objects that are not separated by delimiter records. tell_FILM is the file offset of the FILM record. tell_PRES is the file offset of the PRES record. tell_AREA is None or the file offset of the AREA record. tell_PIP is None or the file offset of the PIP record. IndexLogPass is a IndexLogPass object.
Returns a string that is the long description of this object.
Returns a list of Logical Record types (integers) that is in the index.
Returns the number of IndexLogPass objects in the index.
Indexes a File header. The full Logical record is retained.
Indexes a File header or trailer. The full Logical record is retained.
Returns a ‘pretty’ string suitable for a table of contents.
Indexes a File trailer. The full Logical record is retained.
The index of a Log Pass. This contains a LogPass object.
xAxisIndex is the channel index that is regarded as the X axis. This is the indirect axis if present or defaults to channel 0.
Add an IFLR.
Returns the IFLR type that this EFLR can describe.
Returns the IFLR type that this EFLR can describe.
The LogPass object.
Returns a ‘pretty’ string suitable for a table of contents.
Takes a full LR and assigns it to self._lr.
theClass is a cls that is use to instantiate a Logical Record object at the current file position.
Sets the logicalRecord property to an LogiRec object from theFile.
NULL class just takes the LR information and skips to next LR.
Base class for indexed objects.
tell - The file position of the Logical Record as an integer.
lrType - The Logical Record type as an integer.
theF - The LIS File object. The file ID is recorded for later error checking.
Returns True if this can accumulate another IFLR.
Returns the IFLR type that this EFLR can describe.
True if this represents a delimiter record e.g. File Head/Tail.
The underlying LogiRec object or None.
The Logical Record type, in integer.
Sets the logicalRecord property to an LogiRec object from theFile.
The file offset of the Logical Record.
Returns a ‘pretty’ string suitable for a table of contents.
Indexes a Reel header. The full Logical record is retained.
Indexes a Reel header or trailer. The full Logical record is retained.
Returns a ‘pretty’ string suitable for a table of contents.
Indexes a Reel trailer. The full Logical record is retained.
Table type logical records. Here we capture the first component block so that we know the name of the table.
The name of the table from the first component block.
Sets the logicalRecord property to an LogiRec.LrTable() object.
Returns a ‘pretty’ string suitable for a table of contents.
Indexes a Tape header. The full Logical record is retained.
Indexes a Tape header or trailer. The full Logical record is retained.
Returns a ‘pretty’ string suitable for a table of contents.
Indexes a Tape trailer. The full Logical record is retained.
Binary verbatim class for things like encrypted records, images, raw table dumps and so on.
Sets the logicalRecord property to an LogiRec.LrTable() object.
A POD class that can contain a set of references to the essential (plus optional) logical records for plotting.
True if I have a valid value that could be yielded, i.e. the minimum information from the file that allows a plot using some external definition of what has to be plotted. In practice this means a LogPass.
True if I have a valid value that could be yielded, i.e. the minimum information from the file that allows a plot. In practice this means a FILM, PRES record and a LogPass.
Source:
myFilePath = "Spam/Eggs.LIS"
# Open a LIS file
myFi = File.FileRead(myFilePath, theFileId=myFilePath, keepGoing=True)
# Index the LIS file
myIdx = FileIndexer.FileIndex(myFi)
# Ask the index for all the LogPass objects, these do not have the frameSet populated yet
for aLr in myIdx.genAll():
print(aLr)
Typical result:
tell: 0x00000000 type=128 <TotalDepth.LIS.core.FileIndexer.IndexFileHead object at 0x10197ff90>
tell: 0x00000050 type= 34 name=b'TOOL' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x10197ffd0>
tell: 0x000001ea type= 34 name=b'INPU' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x10197fd10>
tell: 0x00002342 type= 34 name=b'OUTP' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b1d0>
tell: 0x00003622 type= 34 name=b'CONS' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bed0>
tell: 0x0000456a type= 34 name=b'CONS' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b590>
tell: 0x000064aa type= 34 name=b'PRES' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b050>
tell: 0x00006efe type= 34 name=b'FILM' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bfd0>
tell: 0x00006fc6 type= 34 name=b'AREA' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bb50>
<TotalDepth.LIS.core.LogPass.LogPass object at 0x101b06490>
<TotalDepth.LIS.core.LogPass.LogPass object at 0x101b12410>
tell: 0x0017cbee type=129 <TotalDepth.LIS.core.FileIndexer.IndexFileTail object at 0x101b173d0>
The unit tests are in test/TestFileIndexer.Py