readgssi.functions (reusables)

A number of helper functions used by readgssi.

readgssi.functions.dzterror(e='')

Prints an error message then calls gpx2dzg.functions.genericerror() and passes filetype=’DZT’.

estr

The error message to print.

readgssi.functions.dzxerror(e='')

Prints an error message then calls gpx2dzg.functions.genericerror() and passes filetype=’DZX’.

estr

The error message to print.

readgssi.functions.genericerror(filetype='file')

Prints a standard message for a generic error using the gpx2dzg.functions.printmsg() function. This is called from functions in gpx2dzg.io.

filetypestr

The type of file this message is about. Used to format error string.

readgssi.functions.naming(outfile=None, infile_basename=None, chans=[1], chan=0, normalize=False, zero=None, stack=1, reverse=False, bgr=False, win=None, gain=None, dewow=None, freqmin=None, freqmax=None, plotting=None, zoom=None, absval=False)

The Dr. Seth W. Campbell Honorary Naming Scheme

Descriptive naming, used to indicate the processing steps done on each file, if a specific output filename is not given. The theory behind this naming scheme is simple: it can be tough to remember how you made that plot!

Named for my graduate advisor, whom I love and cherish, who introduced me to this way of naming outputs.

naming scheme for exports:
  CHARACTERS    |      MEANING
    Ch0         |  Profile from channel 0 (can range from 0 - 3)
    Dn          |  Distance normalization
    Tz233       |  Time zero at 233 samples
    S8          |  Stacked 8 times
    Rv          |  Profile read in reverse (flipped horizontally)
    Bgr75       |  Background removal filter with window size of 75
    Dw          |  Dewow filter
    Bp70-130    |  triangular FIR filter applied from 70 to 130 MHz
    G30         |  30x contrast gain
    Abs         |  Color scale represents absolute value of vertical gradient
    Z10.20.7.5  |  zoom from 10-20 axis units on the x-axis and 5-7 on the z-axis
Parameters
  • outfile (str) – The base output filename. If None, a new outfile will be generated from the input file basename. If it already exists, subsequent arguments will be appended. Defaults to None.

  • infile_basename (str) – The input file basename (without file extension). Defaults to None.

  • chans (list[int,int,int,int]) – A list of channels, which is converted to the number of channels using len(). Defaults to [1].

  • chan (int) – The current channel number. Defaults to 0.

  • normalize (bool) – Whether or not the array is distance-normalized. Defaults to False.

  • zero (int) – The zero point for this particular channel. Defaults to None.

  • stack (int) – The number of times the array was stacked. Defaults to 1.

  • reverse (bool) – Whether or not the file was reversed. Defaults to False.

  • bgr (bool) – Whether or not BGR was applied. Defaults to False.

  • win (int) – The BGR window size if applicable. 0 is full-width BGR, greater than 0 is window size. Defaults to None.

  • gain (float) – The gain value applied to the plot. Defaults to None.

  • dewow (bool) – Whether or not dewow was applied. Defaults to None.

  • freqmin (int) – The lower corner of the bandpass filter if applicable. Defaults to None.

  • freqmax (int) – The upper corner of the bandpass filter if applicable. Defaults to None.

  • plotting (int) – Stand-in for whether or not a plot was generated. The integer represents the plot height. Defaults to None.

  • zoom (list[int,int,int,int]) – The zoom extents applied to the image. Defaults to None.

  • absval (bool) – Whether or not the plot is displayed with absolute value of gradient. Defaults to False.

readgssi.functions.printmsg(msg)

Prints with date/timestamp.

Parameters

msg (str) – Message to print

readgssi.functions.zoom(zoom, extent, x, z, verbose=False)

Logic to figure out how to set zoom extents. If specified limits are out of bounds, they are set back to boundary extents. If limits of a specified axis are equal, they are expanded to the full extent of that axis.

Parameters
  • zoom (list[int,int,int,int]) – Zoom extents to set programmatically for matplotlib plots. Must pass a list of four integers: [left, right, up, down]. Since the z-axis begins at the top, the “up” value is actually the one that displays lower on the page. All four values are axis units, so if you are working in nanoseconds, 10 will set a limit 10 nanoseconds down. If your x-axis is in seconds, 6 will set a limit 6 seconds from the start of the survey. It may be helpful to display the matplotlib interactive window at full extents first, to determine appropriate extents to set for this parameter. If extents are set outside the boundaries of the image, they will be set back to the boundaries. If two extents on the same axis are the same, the program will default to plotting full extents for that axis.

  • extent (list[int,int,int,int]) – Full extent boundaries of the image, in the style [left, right, up, down].

  • x (str) – X axis units

  • z (str) – Z axis units

  • verbose (bool) – Verbose, defaults to False