Skip to content

Commit

Permalink
addressing #33
Browse files Browse the repository at this point in the history
  • Loading branch information
iannesbitt committed Aug 11, 2021
1 parent 951fe19 commit 74a8fc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
3 changes: 2 additions & 1 deletion readgssi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'100MHz': 100,
'200MHz': 200,
'270MHz': 270,
'300/800D': 300, # technically two separate antennas and therefore, I think, a bug. users of this antenna will have to use `-a 300,800`
'350MHz': 350,
'400MHz': 400,
'500MHz': 500,
Expand Down Expand Up @@ -81,14 +82,14 @@
'51600': 1600,
'51600S': 1600,
'SS MINI': 1600,
'42000S': 2000,
'62000': 2000,
'62000-003': 2000,
'62300': 2300,
'62300XT': 2300,
'52600': 2600,
'52600S': 2600,
'SSMINIXT': 2700,
'42000S': 2000
}

# whether or not the file is GPS-enabled (does not guarantee presence of GPS data in file)
Expand Down
23 changes: 7 additions & 16 deletions readgssi/readgssi.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ def readgssi(infile, outfile=None, verbose=False, antfreq=None, frmt='python',
else:
raise IOError('ERROR: no input file specified')

rhf_sps = header['rhf_sps']
rhf_spm = header['rhf_spm']
line_dur = header['sec']
for chan in list(range(header['rh_nchan'])):
try:
ANT[header['rh_antname'][chan]]
Expand All @@ -127,6 +124,7 @@ def readgssi(infile, outfile=None, verbose=False, antfreq=None, frmt='python',
print('--------------------------------------------------------------')

chans = list(range(header['rh_nchan']))
outfiles = {}

if (pausecorrect) and (not gps.empty):
fx.printmsg('correcting GPS errors created by user-initiated recording pauses...')
Expand Down Expand Up @@ -177,21 +175,14 @@ def readgssi(infile, outfile=None, verbose=False, antfreq=None, frmt='python',
else:
outfile = orig_outfile # recover the original

if outfile:
outfile_ext = os.path.splitext(outfile)[1]
outfile = '%s' % (os.path.join(os.path.splitext(outfile)[0]))
if len(chans) > 1:
outfile = '%sc%s' % (outfile, ar) # avoid naming conflicts
else:
outfile = fx.naming(infile_basename=infile_basename, chans=chans, chan=ar, normalize=normalize,
zero=header['timezero'][ar], stack=stack, reverse=reverse, bgr=bgr, win=win,
dewow=dewow, freqmin=freqmin, freqmax=freqmax, plotting=plotting,
gain=gain, absval=absval)

outfiles[ar] = fx.naming(outfile=outfile, infile_basename=infile_basename, chans=chans, chan=ar,
normalize=normalize, zero=header['timezero'][ar], stack=stack, reverse=reverse,
bgr=bgr, win=win, dewow=dewow, freqmin=freqmin, freqmax=freqmax, plotting=plotting,
gain=gain, absval=absval)
if plotting:
plot.radargram(ar=data[ar], ant=ar, header=header, freq=header['antfreq'][ar], verbose=verbose,
figsize=figsize, dpi=dpi, stack=stack, x=x, z=z, gain=gain, colormap=colormap,
colorbar=colorbar, noshow=noshow, outfile=outfile, fmt=frmt, win=win, title=title,
colorbar=colorbar, noshow=noshow, outfile=outfiles[ar], fmt=frmt, win=win, title=title,
zero=header['timezero'][ar], zoom=zoom, absval=absval, showmarks=showmarks)

if histogram:
Expand All @@ -205,7 +196,7 @@ def readgssi(infile, outfile=None, verbose=False, antfreq=None, frmt='python',
fx.printmsg('outputting to %s...' % frmt)
for ar in data:
# is there an output filepath given?
outfile_abspath = os.path.abspath(outfile) # set output to given location
outfile_abspath = os.path.abspath(outfiles[ar]) # set output to given location

# what is the output format
if frmt in 'csv':
Expand Down

2 comments on commit 74a8fc7

@iannesbitt
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix to #33 also deals with a previously unknown bug that did not separate channel outputs into separate files, since the naming convention had been made static.

@iannesbitt
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit also addresses #37.

Please sign in to comment.