diff --git a/readgssi.py b/readgssi.py index fe1106b..4acc5ef 100644 --- a/readgssi.py +++ b/readgssi.py @@ -21,7 +21,7 @@ import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as colors -from mpl_toolkits.basemap import Basemap +#from mpl_toolkits.basemap import Basemap import pandas as pd import math from decimal import Decimal @@ -132,7 +132,6 @@ def readdzg(fi, frmt, spu, traces, verbose=False): frmt = format ('dzg' = DZG file containing gps sentence strings (see below); 'csv' = comma separated file with) spu = samples per unit (second or meter) traces = the number of traces in the file - Reading DZG We need to relate gpstime to scan number then interpolate for each scan between gps measurements. @@ -259,7 +258,6 @@ def readdzg(fi, frmt, spu, traces, verbose=False): def readgssi(infile, outfile=None, antfreq=None, frmt=None, plot=False, figsize=10, stack=1, verbose=False): ''' function to unpack and return things we need from the header, and the data itself - currently unused but potentially useful lines: # headerstruct = '<5h 5f h 4s 4s 7h 3I d I 3c x 3h d 2x 2c s s 14s s s 12s h 816s 76s' # the structure of the bytewise header and "gps data" as I understand it - 1024 bytes # readsize = (2,2,2,2,2,4,4,4,4,4,2,4,4,4,2,2,2,2,2,4,4,4,8,4,3,1,2,2,2,8,1,1,14,1,1,12,2) # the variable size of bytes in the header (most of the time) - 128 bytes @@ -280,6 +278,7 @@ def readgssi(infile, outfile=None, antfreq=None, frmt=None, plot=False, figsize= rh_tag = struct.unpack(' 1: - j = round(ratio) + j = int(ratio) else: j = 1 else: @@ -585,19 +585,22 @@ def readgssi(infile, outfile=None, antfreq=None, frmt=None, plot=False, figsize= figx, figy = int(int(figsize)*int(int(img_arr[ar].shape[1])/int(img_arr[ar].shape[0]))), int(figsize) # force to integer instead of coerce print('plotting %sx%sin image...' % (figx, figy)) - fig = plt.figure(figsize=(figx, figy), dpi=150, constrained_layout=True) - img = plt.imshow(img_arr[ar], cmap='viridis', clim=(ll, ul), + fig = plt.figure()#(figsize=(figx, figy), dpi=150)#, constrained_layout=True) + img = plt.imshow(img_arr[ar], cmap='Greys', clim=(ll, ul), norm=colors.SymLogNorm(linthresh=std, linscale=1, - vmin=ll, vmax=ul),) - fig.colorbar(img) + vmin=ll, vmax=ul),) + + + plt.title('%s - %s MHz - stacking: %s' % (os.path.split(infile)[-1], ANT[r[0]['rh_antname']][fi], j)) +# plt.show() print('saving figure as %s_%sMHz.png' % (os.path.splitext(infile)[0], ANT[r[0]['rh_antname']][fi])) plt.savefig(os.path.join(os.path.splitext(infile)[0] + '_' + str(ANT[r[0]['rh_antname']][fi]) + 'MHz.png')) - plt.show() - print('drawing histogram...') - fig = plt.figure(figsize=(10,6)) - hst = plt.hist(img_arr[ar].ravel(), bins=256, range=(ll, ul), fc='k', ec='k') - plt.show() + + #3print('drawing histogram...') + #fig = plt.figure(figsize=(10,6)) + #hst = plt.hist(img_arr[ar].ravel(), bins=256, range=(ll, ul), fc='k', ec='k') + #plt.show() fi += 1 except TypeError as e: # shows up when the user selects an input file that doesn't exist