class SEGYTraceHeader(header=None, endian='>', unpack_headers=False)[source]

Bases: object

Convenience class that handles reading and writing of the trace headers.

Public Methods


Writes the header to an open file like object.

Private Methods


Private methods are mainly for internal/developer use and their API might change without notice.


Init the trace header with zeros.


Reads the 240 byte long header and unpacks all values into corresponding class attributes.

SEGYTraceHeader._repr_pretty_(p, cycle)[source]

Special Methods

SEGYTraceHeader.__delattr__(name, /)

Implement delattr(self, name).


Default dir() implementation.

SEGYTraceHeader.__eq__(value, /)

Return self==value.

SEGYTraceHeader.__format__(format_spec, /)

Default object formatter.

SEGYTraceHeader.__ge__(value, /)

Return self>=value.


This method is only called if the attribute is not found in the usual places (i.e. not an instance attribute or not found in the class tree for self).

SEGYTraceHeader.__getattribute__(name, /)

Return getattr(self, name).

SEGYTraceHeader.__gt__(value, /)

Return self>value.


Return hash(self).

SEGYTraceHeader.__init__(header=None, endian='>', unpack_headers=False)[source]

Will take the 240 byte of the trace header and unpack all values with the given endianness.

  • header (str) – String that contains the packed binary header values. If header is None, a trace header with all values set to 0 will be created

  • big_endian (bool) – True means the header is encoded in big endian and False corresponds to a little endian header.

  • unpack_headers (bool) – Determines whether or not all headers will be unpacked during reading the file. Has a huge impact on the memory usage and the performance. They can be unpacked on-the-fly after being read. Defaults to False.


This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

SEGYTraceHeader.__le__(value, /)

Return self<=value.

SEGYTraceHeader.__lt__(value, /)

Return self<value.

SEGYTraceHeader.__ne__(value, /)

Return self!=value.


Helper for pickle.

SEGYTraceHeader.__reduce_ex__(protocol, /)

Helper for pickle.


Return repr(self).

SEGYTraceHeader.__setattr__(name, value, /)

Implement setattr(self, name, value).


Size of object in memory, in bytes.


Just returns all header values.


Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).