Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Remove six dependency #332

Merged
merged 4 commits into from
Mar 3, 2021
Merged
Changes from 2 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
25 changes: 11 additions & 14 deletions python/cusignal/waveforms/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import cupy as cp
import numpy as np

from six import string_types


_square_kernel = cp.ElementwiseKernel(
"T t, T w",
Expand Down Expand Up @@ -234,18 +232,17 @@ def gausspulse(
# pi^2/a * fc^2 * bw^2 /4=-log(ref)
a = -((np.pi * fc * bw) ** 2) / (4.0 * np.log(ref))

if isinstance(t, string_types):
if t == "cutoff": # compute cut_off point
# Solve exp(-a tc**2) = tref for tc
# tc = sqrt(-log(tref) / a) where tref = 10^(tpr/20)
if tpr >= 0:
raise ValueError(
"Reference level for time cutoff must " "be < 0 dB"
)
tref = pow(10.0, tpr / 20.0)
return np.sqrt(-np.log(tref) / a)
else:
raise ValueError("If `t` is a string, it must be 'cutoff'")
if t == "cutoff": # compute cut_off point
# Solve exp(-a tc**2) = tref for tc
# tc = sqrt(-log(tref) / a) where tref = 10^(tpr/20)
if tpr >= 0:
raise ValueError(
"Reference level for time cutoff must " "be < 0 dB"
)
tref = pow(10.0, tpr / 20.0)
return np.sqrt(-np.log(tref) / a)
else:
raise ValueError("If `t` is a string, it must be 'cutoff'")

t = cp.asarray(t)

Expand Down