Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dspplotting.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update dspplotting.py
Fix gen_tick functions
KoenVda88 authored Mar 5, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit bdc630e8867d571355bffbcb6e55d7a07340def8
18 changes: 10 additions & 8 deletions dspplot/dspplotting.py
Original file line number Diff line number Diff line change
@@ -12,23 +12,25 @@

def gen_ticks(stop, start=10):
yield start
for s in range(0, 10):
for s in range(2, 10):
if start * s > stop:
yield stop
raise StopIteration
break
yield start * s
for t in gen_ticks(stop, start * 10):
yield t
else:
for t in gen_ticks(stop, start * 10):
yield t

def gen_tick_labels(stop, start=10):
yield (str(start) + 'Hz').replace('000Hz', 'kHz')
for s in range(0, 10):
for s in range(2, 10):
if start * s > stop:
yield (str(int(stop)) + 'Hz').replace('000Hz', 'kHz')
raise StopIteration
break
yield ''
for t in gen_tick_labels(stop, start * 10):
yield t
else:
for t in gen_tick_labels(stop, start * 10):
yield t

def smooth_colormap(colors, name='cmap1'):
to_rgb = clr.ColorConverter().to_rgb