Skip to content

Commit 7e94d7d

Browse files
committed
heatmap: up/downconverters
1 parent 92a8da6 commit 7e94d7d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

heatmap/heatmap.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
# todo:
99
# matplotlib powered --interactive
10-
# longer than 24 hours stuff
1110
# arbitrary freq marker spacing
1211
# pksato's timestamps
1312
# ppm
14-
# converter shift
1513
# blue-less marker grid
1614
# fast summary thing
1715
# time-based slicing
@@ -22,6 +20,8 @@
2220
help='Input CSV file. (may be a .csv.gz)')
2321
parser.add_argument('output_path', metavar='OUTPUT', type=str,
2422
help='Output image. (various extensions supported)')
23+
parser.add_argument('--offset', dest='offset_freq', default=0,
24+
help='Shift the entire frequency range, for up/down converters.')
2525
slicegroup = parser.add_argument_group('Slicing',
2626
'Efficiently render a portion of the data. (optional)')
2727
slicegroup.add_argument('--low', dest='low_freq', default=None,
@@ -98,6 +98,8 @@ def gzip_wrap(path):
9898
args.low_freq = freq_parse(args.low_freq)
9999
if args.high_freq is not None:
100100
args.high_freq = freq_parse(args.high_freq)
101+
if args.offset_freq is not None:
102+
args.offset_freq = freq_parse(args.offset_freq)
101103

102104
print("loading")
103105

@@ -125,8 +127,8 @@ def parse_time(t):
125127
#line = [line[0], line[1]] + [float(s) for s in line[2:] if s]
126128
line = [s for s in line if s]
127129

128-
low = int(line[2])
129-
high = int(line[3])
130+
low = int(line[2]) + args.offset_freq
131+
high = int(line[3]) + args.offset_freq
130132
step = float(line[4])
131133
if args.low_freq is not None and high < args.low_freq:
132134
continue
@@ -188,8 +190,8 @@ def rgb3(z):
188190
if t not in times:
189191
continue # happens with live files
190192
y = times.index(t)
191-
low = int(line[2])
192-
high = int(line[3])
193+
low = int(line[2]) + args.offset_freq
194+
high = int(line[3]) + args.offset_freq
193195
step = float(line[4])
194196
columns = list(frange(low, high, step))
195197
start_col, stop_col = slice_columns(columns, args.low_freq, args.high_freq)

0 commit comments

Comments
 (0)