PRES Plotting Configuration

Holds all the information to draw a curve on a plot.

TODO: Split this to:

  • Generic: PRESCfg
  • LIS specific: PRESCfgLIS
  • XML specific: PRESCfgXML

Created on 20 Mar 2011

Examples of PRES records summaries:

 Table record (type 34) type: PRES

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG
-----------------------------------------------------------------------------------
                                                                      
SP    SP    ALLO  T1    LLIN  1     SHIF      0.500000      -80.0000       20.0000 
CALI  CALI  ALLO  T1    LDAS  1     SHIF      0.500000       5.00000       15.0000 
MINV  MINV  DISA  T1    LLIN  1     SHIF      0.500000       30.0000       0.00000 
MNOR  MNOR  DISA  T1    LDAS  1     SHIF      0.500000       30.0000       0.00000 
LLD   LLD   ALLO  T23   LDAS  1     GRAD      0.500000      0.200000       2000.00 
LLDB  LLD   ALLO  T2    HDAS  1     GRAD      0.500000       2000.00       200000. 
LLG   LLG   DISA  T23   LDAS  1     GRAD      0.500000      0.200000       2000.00 
LLGB  LLG   DISA  T2    HDAS  1     GRAD      0.500000       2000.00       200000. 
LLS   LLS   ALLO  T23   LSPO  1     GRAD      0.500000      0.200000       2000.00 
LLSB  LLS   ALLO  T2    HSPO  1     GRAD      0.500000       2000.00       200000. 
MSFL  MSFL  ALLO  T23   LLIN  1     GRAD      0.500000      0.200000       2000.00 
11    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
12    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
13    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
14    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
15    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
16    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
17    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
18    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 
19    DUMM  DISA  T1    LLIN  NEIT  NB        0.500000       0.00000       1.00000 

Table record (type 34) type: PRES

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG
-----------------------------------------------------------------------------------
NPHI  NPHI  ALLO  T23   LDAS  1     SHIF      0.500000      0.450000     -0.150000
DRHO  DRHO  ALLO  T3    LSPO  1     NB        0.500000     -0.250000      0.250000
PEF   PEF   ALLO  T23   LGAP  1     SHIF      0.500000       0.00000       10.0000
SGR         DISA  T1    LLIN  1     SHIF      0.500000       0.00000       300.000
CGR         DISA  T1    LGAP  1     SHIF      0.500000       0.00000       300.000
TENS  TENS  DISA  T3    LGAP  1     SHIF      0.500000       14000.0       4000.00
CAL   CALI  ALLO  T1    LSPO  1     SHIF      0.500000       5.00000       15.0000
BS    BS    DISA  T1    LGAP  1     SHIF      0.500000       5.00000       15.0000
FFLS  FFLS  DISA  T1    LLIN  2     NB        0.500000     -0.150000      0.150000
FFSS  FFSS  DISA  T1    LDAS  2     NB        0.500000     -0.150000      0.150000
LSHV  LSHV  DISA  T3    LLIN  2     WRAP      0.500000       2150.00       2250.00
SSHV  SSHV  DISA  T3    LDAS  2     WRAP      0.500000       1950.00       2050.00
FLS   FLS   DISA  T2    LLIN  2     SHIF      0.500000       0.00000       150.000
FSS   FSS   DISA  T2    LDAS  2     SHIF      0.500000       0.00000       150.000
RHOB  RHOB  ALLO  T23   LLIN  1     SHIF      0.500000       1.95000       2.95000
PHIX  PHIX  ALLO  T1    LLIN  1     NB        0.500000      0.500000       0.00000

TRAC nomenclature:

<LH | RH> T n <m>

Or as a regex: re.compile(r'^(LH|RH)*T(\d)(\d)*\s*$')

But this is handled by FILMCfg.

Example:

$ python3 TableHistogram.py -k --name=PRES -l40 --col=TRAC ../../../pLogicTestData/LIS/
Cmd: TableHistogram.py -k --name=PRES -l40 --col=TRAC ../../../pLogicTestData/LIS/
2011-05-27 09:26:12,324 ERROR    Can not create Logical Record, error: can't convert negative value to unsigned int
2011-05-27 09:26:12,335 ERROR    Can not create Logical Record, error: can't convert negative value to unsigned int
2011-05-27 09:26:12,346 ERROR    Can not create Logical Record, error: can't convert negative value to unsigned int
2011-05-27 09:26:13,086 ERROR    Can not read LIS file ../../../pLogicTestData/LIS/13576.S1 with error: Can not fit integer number of frames length 120 into LR length 824, modulo 104 [indirect size 0].
2011-05-27 09:26:13,907 ERROR    Can not read LIS file ../../../pLogicTestData/LIS/13610.S1 with error: Can not fit integer number of frames length 7176 into LR length 13354, modulo 6178 [indirect size 0].
======================== Count of all table entries =======================
{"(34, b'PRES', b'TRAC', b'F1  ')": 4,
 "(34, b'PRES', b'TRAC', b'F2  ')": 4,
 "(34, b'PRES', b'TRAC', b'F3  ')": 4,
 "(34, b'PRES', b'TRAC', b'F4  ')": 3,
 "(34, b'PRES', b'TRAC', b'FD  ')": 4,
 "(34, b'PRES', b'TRAC', b'LHT1')": 4,
 "(34, b'PRES', b'TRAC', b'LHT2')": 8,
 "(34, b'PRES', b'TRAC', b'LHT3')": 59,
 "(34, b'PRES', b'TRAC', b'RHT1')": 4,
 "(34, b'PRES', b'TRAC', b'RHT2')": 22,
 "(34, b'PRES', b'TRAC', b'RHT3')": 63,
 "(34, b'PRES', b'TRAC', b'T1  ')": 2363,
 "(34, b'PRES', b'TRAC', b'T2  ')": 354,
 "(34, b'PRES', b'TRAC', b'T23 ')": 192,
 "(34, b'PRES', b'TRAC', b'T3  ')": 178,
 "(34, b'PRES', b'TRAC', b'TD  ')": 93,
 "(34, b'PRES', b'TRAC', b'XXXX')": 18}
====================== Count of all table entries END =====================

DEST:

======================== Count of all table entries =======================
{"(34, b'PRES', b'DEST', b'1   ')": 457,
 "(34, b'PRES', b'DEST', b'123 ')": 2,
 "(34, b'PRES', b'DEST', b'134 ')": 20,
 "(34, b'PRES', b'DEST', b'2   ')": 139,
 "(34, b'PRES', b'DEST', b'5   ')": 26,
 "(34, b'PRES', b'DEST', b'6   ')": 122,
 "(34, b'PRES', b'DEST', b'8   ')": 16,
 "(34, b'PRES', b'DEST', b'A   ')": 19,
 "(34, b'PRES', b'DEST', b'ALL ')": 4,
 "(34, b'PRES', b'DEST', b'BOTH')": 774,
 "(34, b'PRES', b'DEST', b'D   ')": 63,
 "(34, b'PRES', b'DEST', b'E   ')": 60,
 "(34, b'PRES', b'DEST', b'J   ')": 52,
 "(34, b'PRES', b'DEST', b'K   ')": 13,
 "(34, b'PRES', b'DEST', b'NEIT')": 1610}
====================== Count of all table entries END =====================

MODE:

$ python3 TableHistogram.py -k --name=PRES -l40 --col=MODE ../../../pLogicTestData/LIS/
Cmd: TableHistogram.py -k --name=PRES -l40 --col=MODE ../../../pLogicTestData/LIS/
2011-06-02 08:22:54,839 ERROR    Can not read LIS file ../../../pLogicTestData/LIS/13576.S1 with error: Can not fit integer number of frames length 120 into LR length 824, modulo 104 [indirect size 0].
2011-06-02 08:22:55,671 ERROR    Can not read LIS file ../../../pLogicTestData/LIS/13610.S1 with error: Can not fit integer number of frames length 7176 into LR length 13354, modulo 6178 [indirect size 0].
======================== Count of all table entries =======================
{"(34, b'PRES', b'MODE', b'GRAD')": 245,
 "(34, b'PRES', b'MODE', b'NB  ')": 2329,
 "(34, b'PRES', b'MODE', b'SHIF')": 597,
 "(34, b'PRES', b'MODE', b'SWF ')": 3,
 "(34, b'PRES', b'MODE', b'VDLN')": 3,
 "(34, b'PRES', b'MODE', b'WRAP')": 186,
 "(34, b'PRES', b'MODE', b'X10 ')": 10}
====================== Count of all table entries END =====================

COLO:

======================== Count of all table entries =======================
{"(34, b'PRES', b'COLO', b'000 ')": 173,
 "(34, b'PRES', b'COLO', b'002 ')": 3,
 "(34, b'PRES', b'COLO', b'003 ')": 6,
 "(34, b'PRES', b'COLO', b'004 ')": 33,
 "(34, b'PRES', b'COLO', b'014 ')": 6,
 "(34, b'PRES', b'COLO', b'020 ')": 9,
 "(34, b'PRES', b'COLO', b'021 ')": 8,
 "(34, b'PRES', b'COLO', b'030 ')": 34,
 "(34, b'PRES', b'COLO', b'034 ')": 2,
 "(34, b'PRES', b'COLO', b'044 ')": 6,
 "(34, b'PRES', b'COLO', b'104 ')": 3,
 "(34, b'PRES', b'COLO', b'134 ')": 14,
 "(34, b'PRES', b'COLO', b'203 ')": 3,
 "(34, b'PRES', b'COLO', b'221 ')": 3,
 "(34, b'PRES', b'COLO', b'312 ')": 10,
 "(34, b'PRES', b'COLO', b'400 ')": 44,
 "(34, b'PRES', b'COLO', b'404 ')": 6,
 "(34, b'PRES', b'COLO', b'420 ')": 9,
 "(34, b'PRES', b'COLO', b'430 ')": 17,
 "(34, b'PRES', b'COLO', b'AQUA')": 3,
 "(34, b'PRES', b'COLO', b'BLAC')": 1260,
 "(34, b'PRES', b'COLO', b'BLUE')": 8,
 "(34, b'PRES', b'COLO', b'GREE')": 37,
 "(34, b'PRES', b'COLO', b'RED ')": 12}
====================== Count of all table entries END =====================

What are these numbers, RGB Base 5?

Track names F1 to F4 and FD.

This seems to be the nomenclature for four track plots. For example:

Table record (type 34) type: FILM

MNEM  GCOD  GDEC  DEST  DSCA
-----------------------------
                        
8     EB0   ---   PF8   D200
A     LLLL  1111  PFA   DM  
E     E4E   -4-   PFE   D200
K     E4E   -4-   PFK   D500

Table record (type 34) type: PRES

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG      COLO
-----------------------------------------------------------------------------------------                                                                                    
...
AX1A  AX    ALLO  F2    LLIN  A     SHIF      0.500000      -9.00000       9.00000  400 
AY1A  AY    ALLO  F2    LSPO  A     SHIF      0.500000      -9.00000       9.00000  400 
AZ1A  AZ    ALLO  F2    LGAP  A     NB        0.500000      -9.00000       9.00000  400 
AN1A  ANOR  ALLO  F4    HDAS  A     NB        0.500000       9.00000       11.0000  420 
CS1A  CS    DISA  F1    LDAS  A     NB        0.500000       0.00000       150000.  000 
FX1A  FX    ALLO  F3    LLIN  A     NB        0.500000     -0.700000      0.700000  003 
FY1A  FY    ALLO  F3    LGAP  A     NB        0.500000     -0.700000      0.700000  003 
FZ1A  FZ    ALLO  F3    LSPO  A     NB        0.500000     -0.700000      0.700000  003 
FN1A  FNOR  ALLO  F4    LLIN  A     NB        0.500000      0.200000      0.700000  420 
FI1A  FINC  ALLO  F4    LGAP  A     NB         1.00000       0.00000       90.0000  420 
GA1A  GADZ  DISA  F1    LLIN  A     NB         1.00000      -1.00000       1.00000  020 
GP1A  GPV   DISA  F1    LGAP  A     NB         1.00000       14.0000       16.0000  020 
GN1A  GNV   DISA  F1    LDAS  A     NB         1.00000      -16.0000      -14.0000  020 
GM1A  GMT   DISA  F3    HDAS  A     SHIF       1.00000       80.0000       130.000  020 
GA2A  GAT   DISA  F2    HDAS  A     SHIF       1.00000       80.0000       130.000  020 
SI1A  SILO  DISA  FD    HLIN  A     NB         1.00000       0.00000       20.0000  000 
ST1A  STIT  DISA  FD    LLIN  A     NB         1.00000       0.00000       20.0000  000 
ST2A  STIA  ALLO  FD    LLIN  A     NB         1.00000       0.00000       20.0000  000 
TE1A  TENS  DISA  FD    LDAS  A     WRAP      0.500000       2000.00       7000.00  000 
...
exception TotalDepth.util.plot.PRESCfg.ExceptionPRESCfg

Specialisation of exception for this module.

exception TotalDepth.util.plot.PRESCfg.ExceptionLineTransBase

Specialisation of exception for LineTransBase and descendants.

exception TotalDepth.util.plot.PRESCfg.ExceptionLineTransBaseMath

For LineTransBase and descendants where math errors occur.

exception TotalDepth.util.plot.PRESCfg.ExceptionPRESCfgLISRead

Specialisation of exception for this module.

exception TotalDepth.util.plot.PRESCfg.ExceptionPresCfg

Specialisation of exception for PresCfg.

exception TotalDepth.util.plot.PRESCfg.ExceptionCurveCfg

Specialisation of exception for CurveCfg.

exception TotalDepth.util.plot.PRESCfg.ExceptionCurveCfgCtor

Construction exception when making a CurveCfg object or descendant.

exception TotalDepth.util.plot.PRESCfg.ExceptionCurveCfgLISRead

Specialisation of exception for CurveCfgLISRead and its travails.

TotalDepth.util.plot.PRESCfg.DEFAULT_LLINE_WIDTH_PX = 0.5

Deafult light line width in pixels

TotalDepth.util.plot.PRESCfg.DEFAULT_HLINE_WIDTH_PX = 1.5

Deafult heavy line width in pixels

TotalDepth.util.plot.PRESCfg.LIS_CODI_MAP = {b'HGAP': Stroke(width=1.5, colour='black', coding=(6, 2), opacity=1.0), b'LSPO': Stroke(width=0.5, colour='black', coding=(2, 2), opacity=1.0), b'HLIN': Stroke(width=1.5, colour='black', coding=None, opacity=1.0), b'LLIN': Stroke(width=0.5, colour='black', coding=None, opacity=1.0), b'HSPO': Stroke(width=1.5, colour='black', coding=(2, 2), opacity=1.0), b'SFLN': Stroke(width=0.0625, colour='black', coding=None, opacity=1.0), None: Stroke(width=0.5, colour='black', coding=None, opacity=1.0), b'LGAP': Stroke(width=0.5, colour='black', coding=(6, 2), opacity=1.0), b'SFDA': Stroke(width=0.0625, colour='black', coding=(4, 4), opacity=1.0), b'HDAS': Stroke(width=1.5, colour='black', coding=(4, 4), opacity=1.0), b'LDAS': Stroke(width=0.5, colour='black', coding=(4, 4), opacity=1.0)}

Maps LIS CODI mnemonics to a Stroke object: If either value is None an SVG attribute is not needed i.e. default SVG behaviour

TotalDepth.util.plot.PRESCfg.LIS_COLO_MAP = {Mnem(b'BLUE'): 'blue', Mnem(b'GREE'): 'green', Mnem(b'RED\x00'): 'red', Mnem(b'CYAN'): 'cyan', Mnem(b'BLAC'): 'black', Mnem(b'AQUA'): 'aqua', Mnem(b'YELL'): 'yellow', Mnem(b'MAGE'): 'magenta', Mnem(b'GREY'): 'grey'}

Maps LIS COLO mnemonics to CSS/SVG style colour specifications.

TotalDepth.util.plot.PRESCfg.lisColo(theMnem)

Returns a SVG colour as a string from a Mnem or None on failure.

TotalDepth.util.plot.PRESCfg.coloStroke(theSt, theCm)

Takes a Stroke object and returns a new stroke object with the colour replaced with the Color Mnem looked up, or determined from, the LIS_COLO_MAP.

TotalDepth.util.plot.PRESCfg.BACKUP_NONE = (1, -1)

No backup

TotalDepth.util.plot.PRESCfg.BACKUP_ALL = (0, 0)

Every backup i.e. ‘wrap’ Note: Plot.py has a way of limiting ludicrous backup lines to a sensible number; say 8

TotalDepth.util.plot.PRESCfg.BACKUP_ONCE = (-1, 1)

Single backup to left or right

TotalDepth.util.plot.PRESCfg.BACKUP_TWICE = (-2, 2)

Two backups to left or right

TotalDepth.util.plot.PRESCfg.BACKUP_LEFT = (0, -1)

Single backup to left only

TotalDepth.util.plot.PRESCfg.BACKUP_RIGHT = (1, 0)

Single backup to right only

TotalDepth.util.plot.PRESCfg.BACKUP_FROM_MODE_MAP = {None: (0, 0), b'GRAD': (1, -1), b'WRAP': (0, 0), b'SHIF': (-1, 1), b'NB ': (1, -1)}

Map of backup mode to internal representation

class TotalDepth.util.plot.PRESCfg.LineTransBase(leftP, rightP, leftL, rightL, backup)

Base class for line generators.

__init__(leftP, rightP, leftL, rightL, backup)

Ctor with values; leftP, rightP are physical positions as numbers. leftL, rightL are logical scales as numbers. backup is a pair (left, right). Will raise a ExceptionLineTransBase if leftP >= rightP.

leftL

The left value of the curve scale as a number.

rightL

The right value of the curve scale as a number.

L2P(val)

Scale a given value to a dimension.

wrapPos(val)

For a given value returns a pair (wrap, pos). wrap is an integer number of times the curve is wrapped. pos is a float that is the physical plot position of the value. TODO: Benchmark this, it could be slow.

offScale(w)

Returns 0 if wrap integer is on scale depending on the backup setting. Returns -1 if off scale low, +1 if off scale high.

isOffScaleLeft(w)

True is wrap integer is off-scale low according to the backup setting.

isOffScaleRight(w)

True is wrap integer is off-scale high according to the backup setting.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.util.plot.PRESCfg.LineTransLin(leftP, rightP, leftL, rightL, backup=(0, 0))

Linear grid.

__init__(leftP, rightP, leftL, rightL, backup=(0, 0))

Ctor with values; leftP, rightP are physical positions as numbers. leftL, rightL are logical scales as numbers. backup is a pair (left, right).

L2P(val)

Scale a given value to a dimension.

wrapPos(val)

For a given value returns a pair (wrap, pos). wrap is an integer number of times the curve is wrapped. pos is a float that is the physical plot position of the value. TODO: Benchmark this, it could be slow.

class TotalDepth.util.plot.PRESCfg.LineTransLog10(leftP, rightP, leftL, rightR, backup=(0, 0))

Logrithmic grid.

__init__(leftP, rightP, leftL, rightR, backup=(0, 0))

Ctor with values; leftP, rightP are physical positions as numbers. leftL, rightL are logical scales as numbers. backup is a pair (left, right).

L2P(val)

Scale a given value to a dimension.

wrapPos(val)

For a given value returns a pair (wrap, pos). wrap is an integer number of times the curve is wrapped. pos is a float that is the physical plot position of the value. TODO: Benchmark this, it could be slow.

class TotalDepth.util.plot.PRESCfg.TrackWidthData

Used to record the physical width data of a track leftP, rightP are Coord.Dim objects. halfTrackStart, halfTracks are integers

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, leftP, rightP, halfTrackStart, halfTracks)

Create new instance of TrackWidthData(leftP, rightP, halfTrackStart, halfTracks)

__repr__()

Return a nicely formatted representation string

halfTrackStart

Alias for field number 2

halfTracks

Alias for field number 3

leftP

Alias for field number 0

rightP

Alias for field number 1

class TotalDepth.util.plot.PRESCfg.CurveCfg

Contains the configuration of a single curve.

__init__()

Populate attribute with reasonable default values. Second stage is to set: self.mnem, self.outp, self.trac, self.dest. Optionally other properties as well.

longStr()

Returns a long descriptive string of the internal state.

tracWidthData(theFilmID)

Returns a TrackWidthData object for the film ID.

tracValueFunction(theFilmID)

Given a FILM ID (a Mnem() object) this returns a LineTransBase or derivation that describes how this curve is plotted on that film. In particular the return value will have a function wrapPos() for generating track positions from a value.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.util.plot.PRESCfg.PresCfg

Contains the configuration equivalent to a complete PRES table.

add(theCurveCfg, theFilmDestS)

Adds to the IR. theCurveCfg is a CurvCfg object, theFilmDestS is a list of film destinations expanded from the FILM table e.g. if the destination is b’ALL’ then all FILM destination mnemonics should be in the list.

keys()

Returns the curve mnemonics.

__len__()

Number of curves in this table.

__getitem__(theCurvID)

Returns the CurveCfg object corresponding to curve ID, a Mnem.Mnem object.

__contains__(theCurvID)

Returns True if I have an entry for the curve ID, a Mnem.Mnem object.

__weakref__

list of weak references to the object (if defined)

hasCurvesForDest(theDest)

Returns True if there are curves that go to theDest i.e. FILM ID.

outpChIDs(theDest)

Returns a list of output channel IDs for a given film destination, a Mnem.Mnem object.

outpCurveIDs(theDest, theOutp)

Returns a list of channel IDs for a given film destination and output that feeds those curves. The curve data is accessible by __getitem__(). Arguments should be Mnem.Mnem objects

usesOutpChannel(theDest, theOutp)

Returns True if this PRES table + FILM destination uses theOutp ID. Arguments should be , a Mnem.Mnem objects.

class TotalDepth.util.plot.PRESCfg.PresCfgLISRead(theLr, theFILMCfg)

Information from a complete LIS PRES table.

__init__(theLr, theFILMCfg)

Reads a LogiRec.Table object of type PRES and creates a CurveCfgLISRead for each row. theFILMCfg is expected to be a FILMCfgLISRead object.

Typical PRES table:

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG
-----------------------------------------------------------------------------------
NPHI  NPHI  ALLO  T23   LDAS  1     SHIF      0.500000      0.450000     -0.150000
DRHO  DRHO  ALLO  T3    LSPO  1     NB        0.500000     -0.250000      0.250000
PEF   PEF   ALLO  T23   LGAP  1     SHIF      0.500000       0.00000       10.0000

Previous topic

FILM Plotting Configuration from XML files

Next topic

PRES Plotting Configuration from XML files

This Page