TotalDepth.common.LogPass

This provides a file format agnostic representation of a LogPass.

  • A LogPass consists of a set of FrameArray(s).
  • A FrameArray consists of a set of FrameChannel(s).
  • A FrameChannel consists of a set of values in a Numpy array of any shape from a single recorded channel.
exception TotalDepth.common.LogPass.ExceptionLogPassBase

General exception for problems with this module.

exception TotalDepth.common.LogPass.ExceptionLogPass

General exception for problems with a LogPass object.

exception TotalDepth.common.LogPass.ExceptionFrameChannel

General exception for problems with a FrameChannel object.

exception TotalDepth.common.LogPass.ExceptionFrameArray

General exception for problems with a FrameArray object.

class TotalDepth.common.LogPass.FrameChannel(ident: Hashable, long_name: Union[str, bytes], units: Union[str, bytes], shape: Tuple[int, ...], np_dtype: numpy.dtype)

This represents a single channel in a frame. It is file format independent and can be used depending on the source of the information: LIS/LAS/RP66V1 file, XML index, Postgres database etc.

__init__(ident: Hashable, long_name: Union[str, bytes], units: Union[str, bytes], shape: Tuple[int, ...], np_dtype: numpy.dtype)

Constructor.

Parameters:
  • ident – Some hashable identity.
  • long_name – A description of the channel
  • units – Units of Measure.
  • shape – A list of dimensions of each value. [1] is a single value per frame. [4, 1024] is a 4 * 1024 matrix such as sonic waveform of 1024 samples with 4 waveforms per frame.
  • np_dtype – The numpy dtype to use.
ident

Overload this if necessary, for example RP66V1 has an OBNAME.

__str__() → str

Return str(self).

__getitem__(key)

Gets the value in the numpy array where key is a tuple of integers of length self.dimensions. For example this might be from self.numpy_indexes().

__setitem__(key, value)

Sets the value in the numpy array where key is a tuple of integers of length self.dimensions. For example this might be from self.numpy_indexes().

init_array(number_of_frames: int) → None

Initialises an empty Numpy array suitable to fill with <frames> number of frame data for this channel. If an array already exists of the correct length it is reused.

array_size

The number of elements in the numpy array.

sizeof_array

The size of each element of the current array as represented by numpy.

sizeof_frame

The size of a single frame in bytes as represented by numpy.

numpy_indexes(frame_number: int) → itertools.product

Returns a generator of numpy indexes for a particular frame.

Example for a 2 x 3 array, given frame index 7:

>>> list(itertools.product([7], [0,1], [0,1,2]))
[(7, 0, 0), (7, 0, 1), (7, 0, 2), (7, 1, 0), (7, 1, 1), (7, 1, 2)]
>>> list(itertools.product([7], range(2), range(3)))
[(7, 0, 0), (7, 0, 1), (7, 0, 2), (7, 1, 0), (7, 1, 1), (7, 1, 2)]

Usage, where function is a conversion function on the data:

for dim in self.numpy_indexes(frame_number):
    # dim is a tuple of length self.rank + 1
    self.array[dim] = some_value
mask_array(absent_value: Union[None, int, float]) → None

Masks the absent values.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.common.LogPass.FrameArray(ident: Hashable, description: Union[str, bytes])

Represents a set of channels recorded simultaneously. In the olden days we would record this on a single piece of continuous film.

Subclass this depending on the source of the information: LIS/LAS/DLIS file, XML index etc.

__init__(ident: Hashable, description: Union[str, bytes])

Initialize self. See help(type(self)) for accurate signature.

append(channel: TotalDepth.common.LogPass.FrameChannel) → None

Add a channel to the Array.

__str__() → str

Return str(self).

__len__() → int

The number of channels.

sizeof_array

The total of the current frame array as represented by numpy.

sizeof_frame

The size of the internal representation of a frame as represented by numpy.

shape

The shape of the frame array.

init_arrays(number_of_frames: int) → None

Initialises empty Numpy arrays for each channel suitable to fill with <frames> number of frame data.

init_arrays_partial(number_of_frames: int, channels: Set[Hashable]) → None

Initialises empty Numpy arrays for each of the specified channels suitable to fill with <frames> number of frame data. The channels parameter limits the initialisation to only those channels. Unknown channels in that parameter are ignored.

mask_array(absent_value: Union[int, float]) → None

Mask the absent values in all but the index channels.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.common.LogPass.LogPass

This represents the structure a single run of data acquisition such as ‘Repeat Section’ or ‘Main Log’. These runs have one or more independent simultaneous recordings of different sensors at different depth/time resolutions. Each of these simultaneous recordings is represented as a FrameArray object.

  • A LogPass consists of a set of FrameArray(s).
  • A FrameArray consists of a set of FrameChannel(s).
  • A FrameChannel consists of a set of values in a Numpy array of any shape from a single recorded channel (sensor).

This is a file format independent design. Different file formats use this in different ways:

  • LIS79 - The standard allows 2 simultaneous FrameArrays, IFLR type 0, 1. Type 1 has never been seen in the wild.
  • LAS (all versions) - The standard excludes simultaneous FrameArrays.
  • RP66V1 - The standard allows for any number of simultaneous FrameArrays and this is common.
  • DAT - No simultaneous FrameArrays.
  • BIT - Custom and practice shows that there can be any number of simultaneous FrameArrays.
__init__()

Initialize self. See help(type(self)) for accurate signature.

has(key: Hashable) → bool

Returns True if the key is in the Frame Array Map.

keys() → Iterable[T_co]

The identities of the Frame Arrays.

append(frame_array: TotalDepth.common.LogPass.FrameArray) → None

Add a channel to the Array.

__str__() → str

Return str(self).

__len__() → int

The number of Frame Arrays.

__getitem__(item: Union[int, str, bytes]) → TotalDepth.common.LogPass.FrameArray

The Frame Array by index or ID.

__weakref__

list of weak references to the object (if defined)