keenerd / rtl-sdr-misc

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

list index out of range in summarize_pass #12

Open ghost opened 8 years ago

ghost commented 8 years ago
pi@pi:~/heatmaps $ python heatmap.py --ytick 15m 20160823_000001-24M-1700M-500k-30-1430m.csv 20160823_000001-24M-1700M-500k-30-1430m.png 
loading
Traceback (most recent call last):
  File "heatmap.py", line 615, in <module>
    summarize_pass(args)
  File "heatmap.py", line 244, in summarize_pass
    low  = int(line[2]) + args.offset_freq
IndexError: list index out of range

This happens to all my csv files. I loaded one of them up in http://heat.wq.lc and they seem to work fine. This is being run on a Raspberry Pi 1...

rtl_power output files can be found here: https://files.fm/u/ynpq9pnj

bogdanr commented 7 years ago

It happens for me too but in a different function:

loading
x: 76801, y: 10, z: (-46.080000, -19.740000)
drawing
Traceback (most recent call last):
  File "/usr/bin/heatmap.py", line 618, in <module>
    img = push_pixels(args)
  File "/usr/bin/heatmap.py", line 420, in push_pixels
    pix[x,y+tape_height] = rgb(zs[x])
  File "/usr/bin/heatmap.py", line 360, in rgb_inner
    return palette[tone_scaled]
IndexError: list index out of range

The file will be here for a few more days: https://ufile.io/e18c4 After generating the file I actually did a head -n 1234 original.csv > smaller.csv to shorten the file.

JamesTheHacker commented 7 years ago

Did you ever solve the issue @bodganr ... I'm having the exact same issue. If I can solve it I'll do a PR.

For anyone else facing the same issue this might help: https://www.reddit.com/r/RTLSDR/comments/220ph0/heatmappy_problems/

arkadiam commented 5 years ago

As a workaround for @bogdanr case I've changed rgb_inner function to look like:

def rgb_fn(palette, min_z, max_z):
    "palette is a list of tuples, returns a function of z"
    def rgb_inner(z):
        tone = (z - min_z) / (max_z - min_z)
        tone_scaled = int(tone * (len(palette)-1))
        if tone_scaled >= len(palette):
            tone_scaled = len(palette)-1
        return palette[tone_scaled]
    return rgb_inner