keenerd / rtl-sdr-misc

A bucket of various work-in-progress rtl-sdr ideas.
208 stars 171 forks source link

heatmap.py: NameError: name 'low' is not defined #11

Open emilburzo opened 8 years ago

emilburzo commented 8 years ago

When using heatmap.py with the --low argument, e.g.:

./heatmap.py --low 24M --high 29M data.csv all.png

I get the following:

loading
Traceback (most recent call last):
  File "./heatmap.py", line 615, in <module>
    summarize_pass(args)
  File "./heatmap.py", line 261, in summarize_pass
    start_col, stop_col = slice_columns(columns, args.low_freq, args.high_freq)
  File "./heatmap.py", line 223, in slice_columns
    if low_freq  is not None and low <= low_freq  <= high:
NameError: name 'low' is not defined
HHsty commented 7 years ago

https://github.com/HHsty/rtl-sdr-misc/commit/c03e3070bbdf0a96d5e771564979297a81298967

stillnet commented 7 years ago

@keenerd I am not a python programmer but I am a programmer. If you give me some pointers as to what you think the problem is and how to fix it, I can take a stab at it.

k9wkj commented 7 years ago

im stumbling onto this now as well

wayne-desk@wayne-desk:~$ ./heatmap.py --ytick 5m --low 144M --high 148M 2m1214162325.csv 2m1214162325.png loading Traceback (most recent call last): File "./heatmap.py", line 615, in summarize_pass(args) File "./heatmap.py", line 261, in summarize_pass start_col, stop_col = slice_columns(columns, args.low_freq, args.high_freq) File "./heatmap.py", line 223, in slice_columns if low_freq is not None and low <= low_freq <= high: NameError: global name 'low' is not defined

looking under the hood "low" seems to be defined the same (but opposite) of "high" but it could be a simple syntax error for all i know i am not a programmer nor do i play one on TV

jeffkowalski commented 3 years ago

It looks to me like the slice_columns function was factored from some inline code at some point, and care wasn't taken to make sure all the necessary variables were in scope. So, I passed in low and high from the calling context, and it appears to work OK.

Sorry to be a bit lazy and not make a pull request. Modified file attached below.

heatmap.py.txt