Skip to content

Commit f5870c8

Browse files
committed
heatmap: db limits
1 parent e4c1981 commit f5870c8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

heatmap/heatmap.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
help='Shift the entire frequency range, for up/down converters.')
2424
parser.add_argument('--ytick', dest='time_tick', default=None,
2525
help='Place ticks along the Y axis every N seconds.')
26+
parser.add_argument('--db', dest='db_limit', nargs=2, default=None,
27+
help='Maximum and minimum db values.')
2628
slicegroup = parser.add_argument_group('Slicing',
2729
'Efficiently render a portion of the data. (optional)')
2830
slicegroup.add_argument('--low', dest='low_freq', default=None,
@@ -144,6 +146,11 @@ def parse_time(t):
144146
min_z = 0
145147
max_z = -100
146148
start, stop = None, None
149+
150+
if args.db_limit:
151+
min_z = min(map(float, args.db_limit))
152+
max_z = max(map(float, args.db_limit))
153+
147154
for line in raw_data():
148155
line = [s.strip() for s in line.strip().split(',')]
149156
#line = [line[0], line[1]] + [float(s) for s in line[2:] if s]
@@ -168,11 +175,12 @@ def parse_time(t):
168175
t = line[0] + ' ' + line[1]
169176
times.add(t)
170177

171-
zs = line[6+start_col:6+stop_col+1]
172-
zs = [float(z) for z in zs]
173-
#zs = min_filter(line[6:])
174-
min_z = min(min_z, min(z for z in zs if not math.isinf(z)))
175-
max_z = max(max_z, max(zs))
178+
if not args.db_limit:
179+
zs = line[6+start_col:6+stop_col+1]
180+
zs = [float(z) for z in zs]
181+
#zs = min_filter(line[6:])
182+
min_z = min(min_z, min(z for z in zs if not math.isinf(z)))
183+
max_z = max(max_z, max(zs))
176184

177185
if start is None:
178186
start = parse_time(line[0] + ' ' + line[1])

0 commit comments

Comments
 (0)