partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | wav2complex | Return a complex signal vector from a wav file that was used to store
the real (I) and imaginary (Q) values of a complex signal ndarray.
The rate is included as means of recalling the original signal sample
rate.
fs,x = wav2complex(filename)
Mark Wickert April 2014 | sk_dsp_comm/rtlsdr_helper.py | def wav2complex(filename):
"""
Return a complex signal vector from a wav file that was used to store
the real (I) and imaginary (Q) values of a complex signal ndarray.
The rate is included as means of recalling the original signal sample
rate.
fs,x = wav2complex(filename)
Mark W... | def wav2complex(filename):
"""
Return a complex signal vector from a wav file that was used to store
the real (I) and imaginary (Q) values of a complex signal ndarray.
The rate is included as means of recalling the original signal sample
rate.
fs,x = wav2complex(filename)
Mark W... | [
"Return",
"a",
"complex",
"signal",
"vector",
"from",
"a",
"wav",
"file",
"that",
"was",
"used",
"to",
"store",
"the",
"real",
"(",
"I",
")",
"and",
"imaginary",
"(",
"Q",
")",
"values",
"of",
"a",
"complex",
"signal",
"ndarray",
".",
"The",
"rate",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/rtlsdr_helper.py#L364-L377 | [
"def",
"wav2complex",
"(",
"filename",
")",
":",
"fs",
",",
"x_LR_cols",
"=",
"ss",
".",
"from_wav",
"(",
"filename",
")",
"x",
"=",
"x_LR_cols",
"[",
":",
",",
"0",
"]",
"+",
"1j",
"*",
"x_LR_cols",
"[",
":",
",",
"1",
"]",
"return",
"fs",
",",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | FIR_header | Write FIR Filter Header Files
Mark Wickert February 2015 | sk_dsp_comm/coeff2header.py | def FIR_header(fname_out, h):
"""
Write FIR Filter Header Files
Mark Wickert February 2015
"""
M = len(h)
N = 3 # Coefficients per line
f = open(fname_out, 'wt')
f.write('//define a FIR coefficient Array\n\n')
f.write('#include <stdint.h>\n\n')
f.write('#ifndef ... | def FIR_header(fname_out, h):
"""
Write FIR Filter Header Files
Mark Wickert February 2015
"""
M = len(h)
N = 3 # Coefficients per line
f = open(fname_out, 'wt')
f.write('//define a FIR coefficient Array\n\n')
f.write('#include <stdint.h>\n\n')
f.write('#ifndef ... | [
"Write",
"FIR",
"Filter",
"Header",
"Files",
"Mark",
"Wickert",
"February",
"2015"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L40-L72 | [
"def",
"FIR_header",
"(",
"fname_out",
",",
"h",
")",
":",
"M",
"=",
"len",
"(",
"h",
")",
"N",
"=",
"3",
"# Coefficients per line\r",
"f",
"=",
"open",
"(",
"fname_out",
",",
"'wt'",
")",
"f",
".",
"write",
"(",
"'//define a FIR coefficient Array\\n\\n'",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | FIR_fix_header | Write FIR Fixed-Point Filter Header Files
Mark Wickert February 2015 | sk_dsp_comm/coeff2header.py | def FIR_fix_header(fname_out, h):
"""
Write FIR Fixed-Point Filter Header Files
Mark Wickert February 2015
"""
M = len(h)
hq = int16(rint(h * 2 ** 15))
N = 8 # Coefficients per line
f = open(fname_out, 'wt')
f.write('//define a FIR coefficient Array\n\n')
f.writ... | def FIR_fix_header(fname_out, h):
"""
Write FIR Fixed-Point Filter Header Files
Mark Wickert February 2015
"""
M = len(h)
hq = int16(rint(h * 2 ** 15))
N = 8 # Coefficients per line
f = open(fname_out, 'wt')
f.write('//define a FIR coefficient Array\n\n')
f.writ... | [
"Write",
"FIR",
"Fixed",
"-",
"Point",
"Filter",
"Header",
"Files",
"Mark",
"Wickert",
"February",
"2015"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L75-L108 | [
"def",
"FIR_fix_header",
"(",
"fname_out",
",",
"h",
")",
":",
"M",
"=",
"len",
"(",
"h",
")",
"hq",
"=",
"int16",
"(",
"rint",
"(",
"h",
"*",
"2",
"**",
"15",
")",
")",
"N",
"=",
"8",
"# Coefficients per line\r",
"f",
"=",
"open",
"(",
"fname_ou... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | IIR_sos_header | Write IIR SOS Header Files
File format is compatible with CMSIS-DSP IIR
Directform II Filter Functions
Mark Wickert March 2015-October 2016 | sk_dsp_comm/coeff2header.py | def IIR_sos_header(fname_out, SOS_mat):
"""
Write IIR SOS Header Files
File format is compatible with CMSIS-DSP IIR
Directform II Filter Functions
Mark Wickert March 2015-October 2016
"""
Ns, Mcol = SOS_mat.shape
f = open(fname_out, 'wt')
f.write('//define a IIR SOS C... | def IIR_sos_header(fname_out, SOS_mat):
"""
Write IIR SOS Header Files
File format is compatible with CMSIS-DSP IIR
Directform II Filter Functions
Mark Wickert March 2015-October 2016
"""
Ns, Mcol = SOS_mat.shape
f = open(fname_out, 'wt')
f.write('//define a IIR SOS C... | [
"Write",
"IIR",
"SOS",
"Header",
"Files",
"File",
"format",
"is",
"compatible",
"with",
"CMSIS",
"-",
"DSP",
"IIR",
"Directform",
"II",
"Filter",
"Functions",
"Mark",
"Wickert",
"March",
"2015",
"-",
"October",
"2016"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L111-L153 | [
"def",
"IIR_sos_header",
"(",
"fname_out",
",",
"SOS_mat",
")",
":",
"Ns",
",",
"Mcol",
"=",
"SOS_mat",
".",
"shape",
"f",
"=",
"open",
"(",
"fname_out",
",",
"'wt'",
")",
"f",
".",
"write",
"(",
"'//define a IIR SOS CMSIS-DSP coefficient array\\n\\n'",
")",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | CA_code_header | Write 1023 bit CA (Gold) Code Header Files
Mark Wickert February 2015 | sk_dsp_comm/coeff2header.py | def CA_code_header(fname_out, Nca):
"""
Write 1023 bit CA (Gold) Code Header Files
Mark Wickert February 2015
"""
dir_path = os.path.dirname(os.path.realpath(__file__))
ca = loadtxt(dir_path + '/ca1thru37.txt', dtype=int16, usecols=(Nca - 1,), unpack=True)
M = 1023 # code period
... | def CA_code_header(fname_out, Nca):
"""
Write 1023 bit CA (Gold) Code Header Files
Mark Wickert February 2015
"""
dir_path = os.path.dirname(os.path.realpath(__file__))
ca = loadtxt(dir_path + '/ca1thru37.txt', dtype=int16, usecols=(Nca - 1,), unpack=True)
M = 1023 # code period
... | [
"Write",
"1023",
"bit",
"CA",
"(",
"Gold",
")",
"Code",
"Header",
"Files",
"Mark",
"Wickert",
"February",
"2015"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/coeff2header.py#L246-L286 | [
"def",
"CA_code_header",
"(",
"fname_out",
",",
"Nca",
")",
":",
"dir_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
"ca",
"=",
"loadtxt",
"(",
"dir_path",
"+",
"'/ca1thru37.txt'",
","... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | farrow_resample | Parameters
----------
x : Input list representing a signal vector needing resampling.
fs_old : Starting/old sampling frequency.
fs_new : New sampling frequency.
Returns
-------
y : List representing the signal vector resampled at the new frequency.
Notes
-----
A cubic interpol... | sk_dsp_comm/digitalcom.py | def farrow_resample(x, fs_old, fs_new):
"""
Parameters
----------
x : Input list representing a signal vector needing resampling.
fs_old : Starting/old sampling frequency.
fs_new : New sampling frequency.
Returns
-------
y : List representing the signal vector resampled at the new f... | def farrow_resample(x, fs_old, fs_new):
"""
Parameters
----------
x : Input list representing a signal vector needing resampling.
fs_old : Starting/old sampling frequency.
fs_new : New sampling frequency.
Returns
-------
y : List representing the signal vector resampled at the new f... | [
"Parameters",
"----------",
"x",
":",
"Input",
"list",
"representing",
"a",
"signal",
"vector",
"needing",
"resampling",
".",
"fs_old",
":",
"Starting",
"/",
"old",
"sampling",
"frequency",
".",
"fs_new",
":",
"New",
"sampling",
"frequency",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L50-L145 | [
"def",
"farrow_resample",
"(",
"x",
",",
"fs_old",
",",
"fs_new",
")",
":",
"#Cubic interpolator over 4 samples.",
"#The base point receives a two sample delay.",
"v3",
"=",
"signal",
".",
"lfilter",
"(",
"[",
"1",
"/",
"6.",
",",
"-",
"1",
"/",
"2.",
",",
"1"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | eye_plot | Eye pattern plot of a baseband digital communications waveform.
The signal must be real, but can be multivalued in terms of the underlying
modulation scheme. Used for BPSK eye plots in the Case Study article.
Parameters
----------
x : ndarray of the real input data vector/array
L : display len... | sk_dsp_comm/digitalcom.py | def eye_plot(x,L,S=0):
"""
Eye pattern plot of a baseband digital communications waveform.
The signal must be real, but can be multivalued in terms of the underlying
modulation scheme. Used for BPSK eye plots in the Case Study article.
Parameters
----------
x : ndarray of the real input da... | def eye_plot(x,L,S=0):
"""
Eye pattern plot of a baseband digital communications waveform.
The signal must be real, but can be multivalued in terms of the underlying
modulation scheme. Used for BPSK eye plots in the Case Study article.
Parameters
----------
x : ndarray of the real input da... | [
"Eye",
"pattern",
"plot",
"of",
"a",
"baseband",
"digital",
"communications",
"waveform",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L148-L189 | [
"def",
"eye_plot",
"(",
"x",
",",
"L",
",",
"S",
"=",
"0",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"6",
",",
"4",
")",
")",
"idx",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"L",
"+",
"1",
")",
"plt",
".",
"plot",
"(",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | scatter | Sample a baseband digital communications waveform at the symbol spacing.
Parameters
----------
x : ndarray of the input digital comm signal
Ns : number of samples per symbol (bit)
start : the array index to start the sampling
Returns
-------
xI : ndarray of the real part of x following... | sk_dsp_comm/digitalcom.py | def scatter(x,Ns,start):
"""
Sample a baseband digital communications waveform at the symbol spacing.
Parameters
----------
x : ndarray of the input digital comm signal
Ns : number of samples per symbol (bit)
start : the array index to start the sampling
Returns
-------
xI : nd... | def scatter(x,Ns,start):
"""
Sample a baseband digital communications waveform at the symbol spacing.
Parameters
----------
x : ndarray of the input digital comm signal
Ns : number of samples per symbol (bit)
start : the array index to start the sampling
Returns
-------
xI : nd... | [
"Sample",
"a",
"baseband",
"digital",
"communications",
"waveform",
"at",
"the",
"symbol",
"spacing",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L192-L234 | [
"def",
"scatter",
"(",
"x",
",",
"Ns",
",",
"start",
")",
":",
"xI",
"=",
"np",
".",
"real",
"(",
"x",
"[",
"start",
":",
":",
"Ns",
"]",
")",
"xQ",
"=",
"np",
".",
"imag",
"(",
"x",
"[",
"start",
":",
":",
"Ns",
"]",
")",
"return",
"xI",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | strips | Plots the contents of real ndarray x as a vertical stacking of
strips, each of length Nx. The default figure size is (6,4) inches.
The yaxis tick labels are the starting index of each strip. The red
dashed lines correspond to zero amplitude in each strip.
strips(x,Nx,my_figsize=(6,4))
Mark Wickert... | sk_dsp_comm/digitalcom.py | def strips(x,Nx,fig_size=(6,4)):
"""
Plots the contents of real ndarray x as a vertical stacking of
strips, each of length Nx. The default figure size is (6,4) inches.
The yaxis tick labels are the starting index of each strip. The red
dashed lines correspond to zero amplitude in each strip.
st... | def strips(x,Nx,fig_size=(6,4)):
"""
Plots the contents of real ndarray x as a vertical stacking of
strips, each of length Nx. The default figure size is (6,4) inches.
The yaxis tick labels are the starting index of each strip. The red
dashed lines correspond to zero amplitude in each strip.
st... | [
"Plots",
"the",
"contents",
"of",
"real",
"ndarray",
"x",
"as",
"a",
"vertical",
"stacking",
"of",
"strips",
"each",
"of",
"length",
"Nx",
".",
"The",
"default",
"figure",
"size",
"is",
"(",
"6",
"4",
")",
"inches",
".",
"The",
"yaxis",
"tick",
"labels... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L237-L260 | [
"def",
"strips",
"(",
"x",
",",
"Nx",
",",
"fig_size",
"=",
"(",
"6",
",",
"4",
")",
")",
":",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"fig_size",
")",
"#ax = fig.add_subplot(111)",
"N",
"=",
"len",
"(",
"x",
")",
"Mx",
"=",
"int",
"(",
"np",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | bit_errors | Count bit errors between a transmitted and received BPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\pi`, k=0,1.
The ndarray tx_data is Tx 0/1 bits as real numbers I.
The ndarray rx_data is Rx 0/1 bits as real numbers I.
... | sk_dsp_comm/digitalcom.py | def bit_errors(tx_data,rx_data,Ncorr = 1024,Ntransient = 0):
"""
Count bit errors between a transmitted and received BPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\pi`, k=0,1.
The ndarray tx_data is Tx 0/1 bits as r... | def bit_errors(tx_data,rx_data,Ncorr = 1024,Ntransient = 0):
"""
Count bit errors between a transmitted and received BPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\pi`, k=0,1.
The ndarray tx_data is Tx 0/1 bits as r... | [
"Count",
"bit",
"errors",
"between",
"a",
"transmitted",
"and",
"received",
"BPSK",
"signal",
".",
"Time",
"delay",
"between",
"streams",
"is",
"detected",
"as",
"well",
"as",
"ambiquity",
"resolution",
"due",
"to",
"carrier",
"phase",
"lock",
"offsets",
"of",... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L263-L313 | [
"def",
"bit_errors",
"(",
"tx_data",
",",
"rx_data",
",",
"Ncorr",
"=",
"1024",
",",
"Ntransient",
"=",
"0",
")",
":",
"# Remove Ntransient symbols and level shift to {-1,+1}",
"tx_data",
"=",
"2",
"*",
"tx_data",
"[",
"Ntransient",
":",
"]",
"-",
"1",
"rx_dat... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | QAM_bb | QAM_BB_TX: A complex baseband transmitter
x,b,tx_data = QAM_bb(K,Ns,M)
//////////// Inputs //////////////////////////////////////////////////
N_symb = the number of symbols to process
Ns = number of samples per symbol
mod_type = modulation type: qpsk, 16qam, 64qam, or 256qam
alpha =... | sk_dsp_comm/digitalcom.py | def QAM_bb(N_symb,Ns,mod_type='16qam',pulse='rect',alpha=0.35):
"""
QAM_BB_TX: A complex baseband transmitter
x,b,tx_data = QAM_bb(K,Ns,M)
//////////// Inputs //////////////////////////////////////////////////
N_symb = the number of symbols to process
Ns = number of samples per symbol
... | def QAM_bb(N_symb,Ns,mod_type='16qam',pulse='rect',alpha=0.35):
"""
QAM_BB_TX: A complex baseband transmitter
x,b,tx_data = QAM_bb(K,Ns,M)
//////////// Inputs //////////////////////////////////////////////////
N_symb = the number of symbols to process
Ns = number of samples per symbol
... | [
"QAM_BB_TX",
":",
"A",
"complex",
"baseband",
"transmitter",
"x",
"b",
"tx_data",
"=",
"QAM_bb",
"(",
"K",
"Ns",
"M",
")"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L316-L388 | [
"def",
"QAM_bb",
"(",
"N_symb",
",",
"Ns",
",",
"mod_type",
"=",
"'16qam'",
",",
"pulse",
"=",
"'rect'",
",",
"alpha",
"=",
"0.35",
")",
":",
"# Filter the impulse train waveform with a square root raised",
"# cosine pulse shape designed as follows:",
"# Design the filter... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | QAM_SEP | Nsymb, Nerr, SEP_hat =
QAM_symb_errors(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0)
Count symbol errors between a transmitted and received QAM signal.
The received symbols are assumed to be soft values on a unit square.
Time delay between streams is detected.
The ndarray tx_data is Tx ... | sk_dsp_comm/digitalcom.py | def QAM_SEP(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0,SEP_disp=True):
"""
Nsymb, Nerr, SEP_hat =
QAM_symb_errors(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0)
Count symbol errors between a transmitted and received QAM signal.
The received symbols are assumed to be soft values... | def QAM_SEP(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0,SEP_disp=True):
"""
Nsymb, Nerr, SEP_hat =
QAM_symb_errors(tx_data,rx_data,mod_type,Ncorr = 1024,Ntransient = 0)
Count symbol errors between a transmitted and received QAM signal.
The received symbols are assumed to be soft values... | [
"Nsymb",
"Nerr",
"SEP_hat",
"=",
"QAM_symb_errors",
"(",
"tx_data",
"rx_data",
"mod_type",
"Ncorr",
"=",
"1024",
"Ntransient",
"=",
"0",
")",
"Count",
"symbol",
"errors",
"between",
"a",
"transmitted",
"and",
"received",
"QAM",
"signal",
".",
"The",
"received"... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L391-L478 | [
"def",
"QAM_SEP",
"(",
"tx_data",
",",
"rx_data",
",",
"mod_type",
",",
"Ncorr",
"=",
"1024",
",",
"Ntransient",
"=",
"0",
",",
"SEP_disp",
"=",
"True",
")",
":",
"#Remove Ntransient symbols and makes lengths equal",
"tx_data",
"=",
"tx_data",
"[",
"Ntransient",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | GMSK_bb | MSK/GMSK Complex Baseband Modulation
x,data = gmsk(N_bits, Ns, BT = 0.35, MSK = 0)
Parameters
----------
N_bits : number of symbols processed
Ns : the number of samples per bit
MSK : 0 for no shaping which is standard MSK, MSK <> 0 --> GMSK is generated.
BT : premodulation Bb*T product whic... | sk_dsp_comm/digitalcom.py | def GMSK_bb(N_bits, Ns, MSK = 0,BT = 0.35):
"""
MSK/GMSK Complex Baseband Modulation
x,data = gmsk(N_bits, Ns, BT = 0.35, MSK = 0)
Parameters
----------
N_bits : number of symbols processed
Ns : the number of samples per bit
MSK : 0 for no shaping which is standard MSK, MSK <> 0 --> GMS... | def GMSK_bb(N_bits, Ns, MSK = 0,BT = 0.35):
"""
MSK/GMSK Complex Baseband Modulation
x,data = gmsk(N_bits, Ns, BT = 0.35, MSK = 0)
Parameters
----------
N_bits : number of symbols processed
Ns : the number of samples per bit
MSK : 0 for no shaping which is standard MSK, MSK <> 0 --> GMS... | [
"MSK",
"/",
"GMSK",
"Complex",
"Baseband",
"Modulation",
"x",
"data",
"=",
"gmsk",
"(",
"N_bits",
"Ns",
"BT",
"=",
"0",
".",
"35",
"MSK",
"=",
"0",
")"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L481-L506 | [
"def",
"GMSK_bb",
"(",
"N_bits",
",",
"Ns",
",",
"MSK",
"=",
"0",
",",
"BT",
"=",
"0.35",
")",
":",
"x",
",",
"b",
",",
"data",
"=",
"NRZ_bits",
"(",
"N_bits",
",",
"Ns",
")",
"# pulse length 2*M*Ns",
"M",
"=",
"4",
"n",
"=",
"np",
".",
"arange... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | MPSK_bb | Generate a complex baseband MPSK signal with pulse shaping.
Parameters
----------
N_symb : number of MPSK symbols to produce
Ns : the number of samples per bit,
M : MPSK modulation order, e.g., 4, 8, 16, ...
pulse_type : 'rect' , 'rc', 'src' (default 'rect')
alpha : excess bandwidth factor(... | sk_dsp_comm/digitalcom.py | def MPSK_bb(N_symb,Ns,M,pulse='rect',alpha = 0.25,MM=6):
"""
Generate a complex baseband MPSK signal with pulse shaping.
Parameters
----------
N_symb : number of MPSK symbols to produce
Ns : the number of samples per bit,
M : MPSK modulation order, e.g., 4, 8, 16, ...
pulse_type : 'rect... | def MPSK_bb(N_symb,Ns,M,pulse='rect',alpha = 0.25,MM=6):
"""
Generate a complex baseband MPSK signal with pulse shaping.
Parameters
----------
N_symb : number of MPSK symbols to produce
Ns : the number of samples per bit,
M : MPSK modulation order, e.g., 4, 8, 16, ...
pulse_type : 'rect... | [
"Generate",
"a",
"complex",
"baseband",
"MPSK",
"signal",
"with",
"pulse",
"shaping",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L509-L565 | [
"def",
"MPSK_bb",
"(",
"N_symb",
",",
"Ns",
",",
"M",
",",
"pulse",
"=",
"'rect'",
",",
"alpha",
"=",
"0.25",
",",
"MM",
"=",
"6",
")",
":",
"data",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"0",
",",
"M",
",",
"N_symb",
")",
"xs",
"=",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | QPSK_rx | This function generates | sk_dsp_comm/digitalcom.py | def QPSK_rx(fc,N_symb,Rs,EsN0=100,fs=125,lfsr_len=10,phase=0,pulse='src'):
"""
This function generates
"""
Ns = int(np.round(fs/Rs))
print('Ns = ', Ns)
print('Rs = ', fs/float(Ns))
print('EsN0 = ', EsN0, 'dB')
print('phase = ', phase, 'degrees')
print('pulse = ', pulse)
x, b, dat... | def QPSK_rx(fc,N_symb,Rs,EsN0=100,fs=125,lfsr_len=10,phase=0,pulse='src'):
"""
This function generates
"""
Ns = int(np.round(fs/Rs))
print('Ns = ', Ns)
print('Rs = ', fs/float(Ns))
print('EsN0 = ', EsN0, 'dB')
print('phase = ', phase, 'degrees')
print('pulse = ', pulse)
x, b, dat... | [
"This",
"function",
"generates"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L568-L583 | [
"def",
"QPSK_rx",
"(",
"fc",
",",
"N_symb",
",",
"Rs",
",",
"EsN0",
"=",
"100",
",",
"fs",
"=",
"125",
",",
"lfsr_len",
"=",
"10",
",",
"phase",
"=",
"0",
",",
"pulse",
"=",
"'src'",
")",
":",
"Ns",
"=",
"int",
"(",
"np",
".",
"round",
"(",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | QPSK_BEP | Count bit errors between a transmitted and received QPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\frac{\\pi}{4}`, k=0,1,2,3.
The ndarray sdata is Tx +/-1 symbols as complex numbers I + j*Q.
The ndarray data is Rx +/-1 ... | sk_dsp_comm/digitalcom.py | def QPSK_BEP(tx_data,rx_data,Ncorr = 1024,Ntransient = 0):
"""
Count bit errors between a transmitted and received QPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\frac{\\pi}{4}`, k=0,1,2,3.
The ndarray sdata is Tx +/... | def QPSK_BEP(tx_data,rx_data,Ncorr = 1024,Ntransient = 0):
"""
Count bit errors between a transmitted and received QPSK signal.
Time delay between streams is detected as well as ambiquity resolution
due to carrier phase lock offsets of :math:`k*\\frac{\\pi}{4}`, k=0,1,2,3.
The ndarray sdata is Tx +/... | [
"Count",
"bit",
"errors",
"between",
"a",
"transmitted",
"and",
"received",
"QPSK",
"signal",
".",
"Time",
"delay",
"between",
"streams",
"is",
"detected",
"as",
"well",
"as",
"ambiquity",
"resolution",
"due",
"to",
"carrier",
"phase",
"lock",
"offsets",
"of",... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L619-L686 | [
"def",
"QPSK_BEP",
"(",
"tx_data",
",",
"rx_data",
",",
"Ncorr",
"=",
"1024",
",",
"Ntransient",
"=",
"0",
")",
":",
"#Remove Ntransient symbols",
"tx_data",
"=",
"tx_data",
"[",
"Ntransient",
":",
"]",
"rx_data",
"=",
"rx_data",
"[",
"Ntransient",
":",
"]... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | BPSK_tx | Generates biphase shift keyed (BPSK) transmitter with adjacent channel interference.
Generates three BPSK signals with rectangular or square root raised cosine (SRC)
pulse shaping of duration N_bits and Ns samples per bit. The desired signal is
centered on f = 0, which the adjacent channel signals to the ... | sk_dsp_comm/digitalcom.py | def BPSK_tx(N_bits,Ns,ach_fc=2.0,ach_lvl_dB=-100,pulse='rect',alpha = 0.25,M=6):
"""
Generates biphase shift keyed (BPSK) transmitter with adjacent channel interference.
Generates three BPSK signals with rectangular or square root raised cosine (SRC)
pulse shaping of duration N_bits and Ns samples per... | def BPSK_tx(N_bits,Ns,ach_fc=2.0,ach_lvl_dB=-100,pulse='rect',alpha = 0.25,M=6):
"""
Generates biphase shift keyed (BPSK) transmitter with adjacent channel interference.
Generates three BPSK signals with rectangular or square root raised cosine (SRC)
pulse shaping of duration N_bits and Ns samples per... | [
"Generates",
"biphase",
"shift",
"keyed",
"(",
"BPSK",
")",
"transmitter",
"with",
"adjacent",
"channel",
"interference",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L745-L785 | [
"def",
"BPSK_tx",
"(",
"N_bits",
",",
"Ns",
",",
"ach_fc",
"=",
"2.0",
",",
"ach_lvl_dB",
"=",
"-",
"100",
",",
"pulse",
"=",
"'rect'",
",",
"alpha",
"=",
"0.25",
",",
"M",
"=",
"6",
")",
":",
"x0",
",",
"b",
",",
"data0",
"=",
"NRZ_bits",
"(",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | rc_imp | A truncated raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------
Ns : number of samples per symbol
alpha : excess ban... | sk_dsp_comm/digitalcom.py | def rc_imp(Ns,alpha,M=6):
"""
A truncated raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------
Ns : number of sam... | def rc_imp(Ns,alpha,M=6):
"""
A truncated raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------
Ns : number of sam... | [
"A",
"truncated",
"raised",
"cosine",
"pulse",
"used",
"in",
"digital",
"communications",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L788-L836 | [
"def",
"rc_imp",
"(",
"Ns",
",",
"alpha",
",",
"M",
"=",
"6",
")",
":",
"# Design the filter",
"n",
"=",
"np",
".",
"arange",
"(",
"-",
"M",
"*",
"Ns",
",",
"M",
"*",
"Ns",
"+",
"1",
")",
"b",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"n",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | sqrt_rc_imp | A truncated square root raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------
Ns : number of samples per symbol
... | sk_dsp_comm/digitalcom.py | def sqrt_rc_imp(Ns,alpha,M=6):
"""
A truncated square root raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------... | def sqrt_rc_imp(Ns,alpha,M=6):
"""
A truncated square root raised cosine pulse used in digital communications.
The pulse shaping factor :math:`0 < \\alpha < 1` is required as well as the
truncation factor M which sets the pulse duration to be :math:`2*M*T_{symbol}`.
Parameters
----------... | [
"A",
"truncated",
"square",
"root",
"raised",
"cosine",
"pulse",
"used",
"in",
"digital",
"communications",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L839-L890 | [
"def",
"sqrt_rc_imp",
"(",
"Ns",
",",
"alpha",
",",
"M",
"=",
"6",
")",
":",
"# Design the filter",
"n",
"=",
"np",
".",
"arange",
"(",
"-",
"M",
"*",
"Ns",
",",
"M",
"*",
"Ns",
"+",
"1",
")",
"b",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | RZ_bits | Generate return-to-zero (RZ) data bits with pulse shaping.
A baseband digital data signal using +/-1 amplitude signal values
and including pulse shaping.
Parameters
----------
N_bits : number of RZ {0,1} data bits to produce
Ns : the number of samples per bit,
pulse_type : 'rect' , 'rc', '... | sk_dsp_comm/digitalcom.py | def RZ_bits(N_bits,Ns,pulse='rect',alpha = 0.25,M=6):
"""
Generate return-to-zero (RZ) data bits with pulse shaping.
A baseband digital data signal using +/-1 amplitude signal values
and including pulse shaping.
Parameters
----------
N_bits : number of RZ {0,1} data bits to produce
Ns ... | def RZ_bits(N_bits,Ns,pulse='rect',alpha = 0.25,M=6):
"""
Generate return-to-zero (RZ) data bits with pulse shaping.
A baseband digital data signal using +/-1 amplitude signal values
and including pulse shaping.
Parameters
----------
N_bits : number of RZ {0,1} data bits to produce
Ns ... | [
"Generate",
"return",
"-",
"to",
"-",
"zero",
"(",
"RZ",
")",
"data",
"bits",
"with",
"pulse",
"shaping",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L893-L943 | [
"def",
"RZ_bits",
"(",
"N_bits",
",",
"Ns",
",",
"pulse",
"=",
"'rect'",
",",
"alpha",
"=",
"0.25",
",",
"M",
"=",
"6",
")",
":",
"data",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"0",
",",
"2",
",",
"N_bits",
")",
"x",
"=",
"np",
".",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | my_psd | A local version of NumPy's PSD function that returns the plot arrays.
A mlab.psd wrapper function that returns two ndarrays;
makes no attempt to auto plot anything.
Parameters
----------
x : ndarray input signal
NFFT : a power of two, e.g., 2**10 = 1024
Fs : the sampling rate in Hz
Re... | sk_dsp_comm/digitalcom.py | def my_psd(x,NFFT=2**10,Fs=1):
"""
A local version of NumPy's PSD function that returns the plot arrays.
A mlab.psd wrapper function that returns two ndarrays;
makes no attempt to auto plot anything.
Parameters
----------
x : ndarray input signal
NFFT : a power of two, e.g., 2**10 = 10... | def my_psd(x,NFFT=2**10,Fs=1):
"""
A local version of NumPy's PSD function that returns the plot arrays.
A mlab.psd wrapper function that returns two ndarrays;
makes no attempt to auto plot anything.
Parameters
----------
x : ndarray input signal
NFFT : a power of two, e.g., 2**10 = 10... | [
"A",
"local",
"version",
"of",
"NumPy",
"s",
"PSD",
"function",
"that",
"returns",
"the",
"plot",
"arrays",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L946-L981 | [
"def",
"my_psd",
"(",
"x",
",",
"NFFT",
"=",
"2",
"**",
"10",
",",
"Fs",
"=",
"1",
")",
":",
"Px",
",",
"f",
"=",
"pylab",
".",
"mlab",
".",
"psd",
"(",
"x",
",",
"NFFT",
",",
"Fs",
")",
"return",
"Px",
".",
"flatten",
"(",
")",
",",
"f"
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | time_delay | A time varying time delay which takes advantage of the Farrow structure
for cubic interpolation:
y = time_delay(x,D,N = 3)
Note that D is an array of the same length as the input signal x. This
allows you to make the delay a function of time. If you want a constant
delay just use D*zeros(len(x)).... | sk_dsp_comm/digitalcom.py | def time_delay(x,D,N=4):
"""
A time varying time delay which takes advantage of the Farrow structure
for cubic interpolation:
y = time_delay(x,D,N = 3)
Note that D is an array of the same length as the input signal x. This
allows you to make the delay a function of time. If you want a constant... | def time_delay(x,D,N=4):
"""
A time varying time delay which takes advantage of the Farrow structure
for cubic interpolation:
y = time_delay(x,D,N = 3)
Note that D is an array of the same length as the input signal x. This
allows you to make the delay a function of time. If you want a constant... | [
"A",
"time",
"varying",
"time",
"delay",
"which",
"takes",
"advantage",
"of",
"the",
"Farrow",
"structure",
"for",
"cubic",
"interpolation",
":"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L984-L1055 | [
"def",
"time_delay",
"(",
"x",
",",
"D",
",",
"N",
"=",
"4",
")",
":",
"if",
"type",
"(",
"D",
")",
"==",
"float",
"or",
"type",
"(",
"D",
")",
"==",
"int",
":",
"#Make sure D stays with in the tapped delay line bounds",
"if",
"int",
"(",
"np",
".",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | xcorr | r12, k = xcorr(x1,x2,Nlags), r12 and k are ndarray's
Compute the energy normalized cross correlation between the sequences
x1 and x2. If x1 = x2 the cross correlation is the autocorrelation.
The number of lags sets how many lags to return centered about zero | sk_dsp_comm/digitalcom.py | def xcorr(x1,x2,Nlags):
"""
r12, k = xcorr(x1,x2,Nlags), r12 and k are ndarray's
Compute the energy normalized cross correlation between the sequences
x1 and x2. If x1 = x2 the cross correlation is the autocorrelation.
The number of lags sets how many lags to return centered about zero
"""
K... | def xcorr(x1,x2,Nlags):
"""
r12, k = xcorr(x1,x2,Nlags), r12 and k are ndarray's
Compute the energy normalized cross correlation between the sequences
x1 and x2. If x1 = x2 the cross correlation is the autocorrelation.
The number of lags sets how many lags to return centered about zero
"""
K... | [
"r12",
"k",
"=",
"xcorr",
"(",
"x1",
"x2",
"Nlags",
")",
"r12",
"and",
"k",
"are",
"ndarray",
"s",
"Compute",
"the",
"energy",
"normalized",
"cross",
"correlation",
"between",
"the",
"sequences",
"x1",
"and",
"x2",
".",
"If",
"x1",
"=",
"x2",
"the",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1058-L1074 | [
"def",
"xcorr",
"(",
"x1",
",",
"x2",
",",
"Nlags",
")",
":",
"K",
"=",
"2",
"*",
"(",
"int",
"(",
"np",
".",
"floor",
"(",
"len",
"(",
"x1",
")",
"/",
"2",
")",
")",
")",
"X1",
"=",
"fft",
".",
"fft",
"(",
"x1",
"[",
":",
"K",
"]",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | PCM_encode | Parameters
----------
x : signal samples to be PCM encoded
N_bits ; bit precision of PCM samples
Returns
-------
x_bits = encoded serial bit stream of 0/1 values. MSB first.
Mark Wickert, Mark 2015 | sk_dsp_comm/digitalcom.py | def PCM_encode(x,N_bits):
"""
Parameters
----------
x : signal samples to be PCM encoded
N_bits ; bit precision of PCM samples
Returns
-------
x_bits = encoded serial bit stream of 0/1 values. MSB first.
Mark Wickert, Mark 2015
"""
xq = np.int16(np.rint(x*2**(N_bits-1)))
... | def PCM_encode(x,N_bits):
"""
Parameters
----------
x : signal samples to be PCM encoded
N_bits ; bit precision of PCM samples
Returns
-------
x_bits = encoded serial bit stream of 0/1 values. MSB first.
Mark Wickert, Mark 2015
"""
xq = np.int16(np.rint(x*2**(N_bits-1)))
... | [
"Parameters",
"----------",
"x",
":",
"signal",
"samples",
"to",
"be",
"PCM",
"encoded",
"N_bits",
";",
"bit",
"precision",
"of",
"PCM",
"samples"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1084-L1103 | [
"def",
"PCM_encode",
"(",
"x",
",",
"N_bits",
")",
":",
"xq",
"=",
"np",
".",
"int16",
"(",
"np",
".",
"rint",
"(",
"x",
"*",
"2",
"**",
"(",
"N_bits",
"-",
"1",
")",
")",
")",
"x_bits",
"=",
"np",
".",
"zeros",
"(",
"(",
"N_bits",
",",
"le... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | to_bin | Convert an unsigned integer to a numpy binary array with the first
element the MSB and the last element the LSB. | sk_dsp_comm/digitalcom.py | def to_bin(data, width):
"""
Convert an unsigned integer to a numpy binary array with the first
element the MSB and the last element the LSB.
"""
data_str = bin(data & (2**width-1))[2:].zfill(width)
return [int(x) for x in tuple(data_str)] | def to_bin(data, width):
"""
Convert an unsigned integer to a numpy binary array with the first
element the MSB and the last element the LSB.
"""
data_str = bin(data & (2**width-1))[2:].zfill(width)
return [int(x) for x in tuple(data_str)] | [
"Convert",
"an",
"unsigned",
"integer",
"to",
"a",
"numpy",
"binary",
"array",
"with",
"the",
"first",
"element",
"the",
"MSB",
"and",
"the",
"last",
"element",
"the",
"LSB",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1107-L1113 | [
"def",
"to_bin",
"(",
"data",
",",
"width",
")",
":",
"data_str",
"=",
"bin",
"(",
"data",
"&",
"(",
"2",
"**",
"width",
"-",
"1",
")",
")",
"[",
"2",
":",
"]",
".",
"zfill",
"(",
"width",
")",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | from_bin | Convert binary array back a nonnegative integer. The array length is
the bit width. The first input index holds the MSB and the last holds the LSB. | sk_dsp_comm/digitalcom.py | def from_bin(bin_array):
"""
Convert binary array back a nonnegative integer. The array length is
the bit width. The first input index holds the MSB and the last holds the LSB.
"""
width = len(bin_array)
bin_wgts = 2**np.arange(width-1,-1,-1)
return int(np.dot(bin_array,bin_wgts)) | def from_bin(bin_array):
"""
Convert binary array back a nonnegative integer. The array length is
the bit width. The first input index holds the MSB and the last holds the LSB.
"""
width = len(bin_array)
bin_wgts = 2**np.arange(width-1,-1,-1)
return int(np.dot(bin_array,bin_wgts)) | [
"Convert",
"binary",
"array",
"back",
"a",
"nonnegative",
"integer",
".",
"The",
"array",
"length",
"is",
"the",
"bit",
"width",
".",
"The",
"first",
"input",
"index",
"holds",
"the",
"MSB",
"and",
"the",
"last",
"holds",
"the",
"LSB",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1116-L1123 | [
"def",
"from_bin",
"(",
"bin_array",
")",
":",
"width",
"=",
"len",
"(",
"bin_array",
")",
"bin_wgts",
"=",
"2",
"**",
"np",
".",
"arange",
"(",
"width",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
"return",
"int",
"(",
"np",
".",
"dot",
"(",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | PCM_decode | Parameters
----------
x_bits : serial bit stream of 0/1 values. The length of
x_bits must be a multiple of N_bits
N_bits : bit precision of PCM samples
Returns
-------
xhat : decoded PCM signal samples
Mark Wickert, March 2015 | sk_dsp_comm/digitalcom.py | def PCM_decode(x_bits,N_bits):
"""
Parameters
----------
x_bits : serial bit stream of 0/1 values. The length of
x_bits must be a multiple of N_bits
N_bits : bit precision of PCM samples
Returns
-------
xhat : decoded PCM signal samples
Mark Wickert, March 2015
"... | def PCM_decode(x_bits,N_bits):
"""
Parameters
----------
x_bits : serial bit stream of 0/1 values. The length of
x_bits must be a multiple of N_bits
N_bits : bit precision of PCM samples
Returns
-------
xhat : decoded PCM signal samples
Mark Wickert, March 2015
"... | [
"Parameters",
"----------",
"x_bits",
":",
"serial",
"bit",
"stream",
"of",
"0",
"/",
"1",
"values",
".",
"The",
"length",
"of",
"x_bits",
"must",
"be",
"a",
"multiple",
"of",
"N_bits",
"N_bits",
":",
"bit",
"precision",
"of",
"PCM",
"samples"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1126-L1151 | [
"def",
"PCM_decode",
"(",
"x_bits",
",",
"N_bits",
")",
":",
"N_samples",
"=",
"len",
"(",
"x_bits",
")",
"//",
"N_bits",
"# Convert serial bit stream into parallel words with each ",
"# column holdingthe N_bits binary sample value",
"xrs_bits",
"=",
"x_bits",
".",
"copy"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | mux_pilot_blocks | Parameters
----------
IQ_data : a 2D array of input QAM symbols with the columns
representing the NF carrier frequencies and each
row the QAM symbols used to form an OFDM symbol
Np : the period of the pilot blocks; e.g., a pilot block is
inserted every Np OFDM sy... | sk_dsp_comm/digitalcom.py | def mux_pilot_blocks(IQ_data, Np):
"""
Parameters
----------
IQ_data : a 2D array of input QAM symbols with the columns
representing the NF carrier frequencies and each
row the QAM symbols used to form an OFDM symbol
Np : the period of the pilot blocks; e.g., a pilot bl... | def mux_pilot_blocks(IQ_data, Np):
"""
Parameters
----------
IQ_data : a 2D array of input QAM symbols with the columns
representing the NF carrier frequencies and each
row the QAM symbols used to form an OFDM symbol
Np : the period of the pilot blocks; e.g., a pilot bl... | [
"Parameters",
"----------",
"IQ_data",
":",
"a",
"2D",
"array",
"of",
"input",
"QAM",
"symbols",
"with",
"the",
"columns",
"representing",
"the",
"NF",
"carrier",
"frequencies",
"and",
"each",
"row",
"the",
"QAM",
"symbols",
"used",
"to",
"form",
"an",
"OFDM... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/digitalcom.py#L1179-L1214 | [
"def",
"mux_pilot_blocks",
"(",
"IQ_data",
",",
"Np",
")",
":",
"N_OFDM",
"=",
"IQ_data",
".",
"shape",
"[",
"0",
"]",
"Npb",
"=",
"N_OFDM",
"//",
"(",
"Np",
"-",
"1",
")",
"N_OFDM_rem",
"=",
"N_OFDM",
"-",
"Npb",
"*",
"(",
"Np",
"-",
"1",
")",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | NDA_symb_sync | zz,e_tau = NDA_symb_sync(z,Ns,L,BnTs,zeta=0.707,I_ord=3)
z = complex baseband input signal at nominally Ns samples
per symbol
Ns = Nominal number of samples per symbol (Ts/T) in the symbol
tracking loop, often 4
BnTs = time bandwidth product of loop bandwidth... | sk_dsp_comm/synchronization.py | def NDA_symb_sync(z,Ns,L,BnTs,zeta=0.707,I_ord=3):
"""
zz,e_tau = NDA_symb_sync(z,Ns,L,BnTs,zeta=0.707,I_ord=3)
z = complex baseband input signal at nominally Ns samples
per symbol
Ns = Nominal number of samples per symbol (Ts/T) in the symbol
tracking loop, ... | def NDA_symb_sync(z,Ns,L,BnTs,zeta=0.707,I_ord=3):
"""
zz,e_tau = NDA_symb_sync(z,Ns,L,BnTs,zeta=0.707,I_ord=3)
z = complex baseband input signal at nominally Ns samples
per symbol
Ns = Nominal number of samples per symbol (Ts/T) in the symbol
tracking loop, ... | [
"zz",
"e_tau",
"=",
"NDA_symb_sync",
"(",
"z",
"Ns",
"L",
"BnTs",
"zeta",
"=",
"0",
".",
"707",
"I_ord",
"=",
"3",
")"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L49-L172 | [
"def",
"NDA_symb_sync",
"(",
"z",
",",
"Ns",
",",
"L",
",",
"BnTs",
",",
"zeta",
"=",
"0.707",
",",
"I_ord",
"=",
"3",
")",
":",
"# Loop filter parameters",
"K0",
"=",
"-",
"1.0",
"# The modulo 1 counter counts down so a sign change in loop",
"Kp",
"=",
"1.0",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | DD_carrier_sync | z_prime,a_hat,e_phi = DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0)
Decision directed carrier phase tracking
z = complex baseband PSK signal at one sample per symbol
M = The PSK modulation order, i.e., 2, 8, or 8.
BnTs = time bandwidth product of loop bandwidth and the symbol period... | sk_dsp_comm/synchronization.py | def DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0):
"""
z_prime,a_hat,e_phi = DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0)
Decision directed carrier phase tracking
z = complex baseband PSK signal at one sample per symbol
M = The PSK modulation order, i.e., 2, 8, or 8.
BnTs = t... | def DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0):
"""
z_prime,a_hat,e_phi = DD_carrier_sync(z,M,BnTs,zeta=0.707,type=0)
Decision directed carrier phase tracking
z = complex baseband PSK signal at one sample per symbol
M = The PSK modulation order, i.e., 2, 8, or 8.
BnTs = t... | [
"z_prime",
"a_hat",
"e_phi",
"=",
"DD_carrier_sync",
"(",
"z",
"M",
"BnTs",
"zeta",
"=",
"0",
".",
"707",
"type",
"=",
"0",
")",
"Decision",
"directed",
"carrier",
"phase",
"tracking",
"z",
"=",
"complex",
"baseband",
"PSK",
"signal",
"at",
"one",
"sampl... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L174-L252 | [
"def",
"DD_carrier_sync",
"(",
"z",
",",
"M",
",",
"BnTs",
",",
"zeta",
"=",
"0.707",
",",
"type",
"=",
"0",
")",
":",
"Ns",
"=",
"1",
"Kp",
"=",
"np",
".",
"sqrt",
"(",
"2.",
")",
"# for type 0",
"z_prime",
"=",
"np",
".",
"zeros_like",
"(",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | time_step | Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param t_step: in samples relative to Ns
:param Nstep: symbol sample location where the step turns on
:re... | sk_dsp_comm/synchronization.py | def time_step(z,Ns,t_step,Nstep):
"""
Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param t_step: in samples relative to Ns
:param Nstep: symbol s... | def time_step(z,Ns,t_step,Nstep):
"""
Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param t_step: in samples relative to Ns
:param Nstep: symbol s... | [
"Create",
"a",
"one",
"sample",
"per",
"symbol",
"signal",
"containing",
"a",
"phase",
"rotation",
"step",
"Nsymb",
"into",
"the",
"waveform",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L255-L269 | [
"def",
"time_step",
"(",
"z",
",",
"Ns",
",",
"t_step",
",",
"Nstep",
")",
":",
"z_step",
"=",
"np",
".",
"hstack",
"(",
"(",
"z",
"[",
":",
"Ns",
"*",
"Nstep",
"]",
",",
"z",
"[",
"(",
"Ns",
"*",
"Nstep",
"+",
"t_step",
")",
":",
"]",
",",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | phase_step | Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param p_step: size in radians of the phase step
:param Nstep: symbol sample location where the step turns on... | sk_dsp_comm/synchronization.py | def phase_step(z,Ns,p_step,Nstep):
"""
Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param p_step: size in radians of the phase step
:param Nstep:... | def phase_step(z,Ns,p_step,Nstep):
"""
Create a one sample per symbol signal containing a phase rotation
step Nsymb into the waveform.
:param z: complex baseband signal after matched filter
:param Ns: number of sample per symbol
:param p_step: size in radians of the phase step
:param Nstep:... | [
"Create",
"a",
"one",
"sample",
"per",
"symbol",
"signal",
"containing",
"a",
"phase",
"rotation",
"step",
"Nsymb",
"into",
"the",
"waveform",
"."
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L272-L290 | [
"def",
"phase_step",
"(",
"z",
",",
"Ns",
",",
"p_step",
",",
"Nstep",
")",
":",
"nn",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"len",
"(",
"z",
"[",
":",
":",
"Ns",
"]",
")",
")",
"theta",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"nn",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | PLL1 | Baseband Analog PLL Simulation Model
:param theta: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F(s) = (1 + s tau2)/(s tau1),
i.e., a type II,... | sk_dsp_comm/synchronization.py | def PLL1(theta,fs,loop_type,Kv,fn,zeta,non_lin):
"""
Baseband Analog PLL Simulation Model
:param theta: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F... | def PLL1(theta,fs,loop_type,Kv,fn,zeta,non_lin):
"""
Baseband Analog PLL Simulation Model
:param theta: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F... | [
"Baseband",
"Analog",
"PLL",
"Simulation",
"Model"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L293-L395 | [
"def",
"PLL1",
"(",
"theta",
",",
"fs",
",",
"loop_type",
",",
"Kv",
",",
"fn",
",",
"zeta",
",",
"non_lin",
")",
":",
"T",
"=",
"1",
"/",
"float",
"(",
"fs",
")",
"Kv",
"=",
"2",
"*",
"np",
".",
"pi",
"*",
"Kv",
"# convert Kv in Hz/v to rad/s/v"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | PLL_cbb | Baseband Analog PLL Simulation Model
:param x: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F(s) = (1 + s tau2)/(s tau1),
i.e., a type II, or ... | sk_dsp_comm/synchronization.py | def PLL_cbb(x,fs,loop_type,Kv,fn,zeta):
"""
Baseband Analog PLL Simulation Model
:param x: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F(s) = (1 + s ... | def PLL_cbb(x,fs,loop_type,Kv,fn,zeta):
"""
Baseband Analog PLL Simulation Model
:param x: input phase deviation in radians
:param fs: sampling rate in sample per second or Hz
:param loop_type: 1, first-order loop filter F(s)=K_LF; 2, integrator
with lead compensation F(s) = (1 + s ... | [
"Baseband",
"Analog",
"PLL",
"Simulation",
"Model"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/synchronization.py#L398-L491 | [
"def",
"PLL_cbb",
"(",
"x",
",",
"fs",
",",
"loop_type",
",",
"Kv",
",",
"fn",
",",
"zeta",
")",
":",
"T",
"=",
"1",
"/",
"float",
"(",
"fs",
")",
"Kv",
"=",
"2",
"*",
"np",
".",
"pi",
"*",
"Kv",
"# convert Kv in Hz/v to rad/s/v",
"if",
"loop_typ... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | conv_Pb_bound | Coded bit error probabilty
Convolution coding bit error probability upper bound
according to Ziemer & Peterson 7-16, p. 507
Mark Wickert November 2014
Parameters
----------
R: Code rate
dfree: Free distance of the code
Ck: Weight coefficient
SNRdB: Signal to noise ... | sk_dsp_comm/fec_conv.py | def conv_Pb_bound(R,dfree,Ck,SNRdB,hard_soft,M=2):
"""
Coded bit error probabilty
Convolution coding bit error probability upper bound
according to Ziemer & Peterson 7-16, p. 507
Mark Wickert November 2014
Parameters
----------
R: Code rate
dfree: Free distance of ... | def conv_Pb_bound(R,dfree,Ck,SNRdB,hard_soft,M=2):
"""
Coded bit error probabilty
Convolution coding bit error probability upper bound
according to Ziemer & Peterson 7-16, p. 507
Mark Wickert November 2014
Parameters
----------
R: Code rate
dfree: Free distance of ... | [
"Coded",
"bit",
"error",
"probabilty",
"Convolution",
"coding",
"bit",
"error",
"probability",
"upper",
"bound",
"according",
"to",
"Ziemer",
"&",
"Peterson",
"7",
"-",
"16",
"p",
".",
"507",
"Mark",
"Wickert",
"November",
"2014",
"Parameters",
"----------",
"... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L790-L847 | [
"def",
"conv_Pb_bound",
"(",
"R",
",",
"dfree",
",",
"Ck",
",",
"SNRdB",
",",
"hard_soft",
",",
"M",
"=",
"2",
")",
":",
"Pb",
"=",
"np",
".",
"zeros_like",
"(",
"SNRdB",
")",
"SNR",
"=",
"10.",
"**",
"(",
"SNRdB",
"/",
"10.",
")",
"for",
"n",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | hard_Pk | Pk = hard_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-12, p.505
Mark Wickert and Andrew Smit 2018 | sk_dsp_comm/fec_conv.py | def hard_Pk(k,R,SNR,M=2):
"""
Pk = hard_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-12, p.505
Mark Wickert and Andrew Smit 2018
"""
k = int(k)
if M == 2:
p = Q_fctn(np.sqrt(2.*R*SNR))
else:
p = 4./np.log2(M)*(1 - 1./np.sqrt(M))*... | def hard_Pk(k,R,SNR,M=2):
"""
Pk = hard_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-12, p.505
Mark Wickert and Andrew Smit 2018
"""
k = int(k)
if M == 2:
p = Q_fctn(np.sqrt(2.*R*SNR))
else:
p = 4./np.log2(M)*(1 - 1./np.sqrt(M))*... | [
"Pk",
"=",
"hard_Pk",
"(",
"k",
"R",
"SNR",
")",
"Calculates",
"Pk",
"as",
"found",
"in",
"Ziemer",
"&",
"Peterson",
"eq",
".",
"7",
"-",
"12",
"p",
".",
"505",
"Mark",
"Wickert",
"and",
"Andrew",
"Smit",
"2018"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L849-L877 | [
"def",
"hard_Pk",
"(",
"k",
",",
"R",
",",
"SNR",
",",
"M",
"=",
"2",
")",
":",
"k",
"=",
"int",
"(",
"k",
")",
"if",
"M",
"==",
"2",
":",
"p",
"=",
"Q_fctn",
"(",
"np",
".",
"sqrt",
"(",
"2.",
"*",
"R",
"*",
"SNR",
")",
")",
"else",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | soft_Pk | Pk = soft_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-13, p.505
Mark Wickert November 2014 | sk_dsp_comm/fec_conv.py | def soft_Pk(k,R,SNR,M=2):
"""
Pk = soft_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-13, p.505
Mark Wickert November 2014
"""
if M == 2:
Pk = Q_fctn(np.sqrt(2.*k*R*SNR))
else:
Pk = 4./np.log2(M)*(1 - 1./np.sqrt(M))*\
Q_fctn(... | def soft_Pk(k,R,SNR,M=2):
"""
Pk = soft_Pk(k,R,SNR)
Calculates Pk as found in Ziemer & Peterson eq. 7-13, p.505
Mark Wickert November 2014
"""
if M == 2:
Pk = Q_fctn(np.sqrt(2.*k*R*SNR))
else:
Pk = 4./np.log2(M)*(1 - 1./np.sqrt(M))*\
Q_fctn(... | [
"Pk",
"=",
"soft_Pk",
"(",
"k",
"R",
"SNR",
")",
"Calculates",
"Pk",
"as",
"found",
"in",
"Ziemer",
"&",
"Peterson",
"eq",
".",
"7",
"-",
"13",
"p",
".",
"505",
"Mark",
"Wickert",
"November",
"2014"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L879-L893 | [
"def",
"soft_Pk",
"(",
"k",
",",
"R",
",",
"SNR",
",",
"M",
"=",
"2",
")",
":",
"if",
"M",
"==",
"2",
":",
"Pk",
"=",
"Q_fctn",
"(",
"np",
".",
"sqrt",
"(",
"2.",
"*",
"k",
"*",
"R",
"*",
"SNR",
")",
")",
"else",
":",
"Pk",
"=",
"4.",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.viterbi_decoder | A method which performs Viterbi decoding of noisy bit stream,
taking as input soft bit values centered on +/-1 and returning
hard decision 0/1 bits.
Parameters
----------
x: Received noisy bit values centered on +/-1 at one sample per bit
metric_type:
... | sk_dsp_comm/fec_conv.py | def viterbi_decoder(self,x,metric_type='soft',quant_level=3):
"""
A method which performs Viterbi decoding of noisy bit stream,
taking as input soft bit values centered on +/-1 and returning
hard decision 0/1 bits.
Parameters
----------
x: Received noisy... | def viterbi_decoder(self,x,metric_type='soft',quant_level=3):
"""
A method which performs Viterbi decoding of noisy bit stream,
taking as input soft bit values centered on +/-1 and returning
hard decision 0/1 bits.
Parameters
----------
x: Received noisy... | [
"A",
"method",
"which",
"performs",
"Viterbi",
"decoding",
"of",
"noisy",
"bit",
"stream",
"taking",
"as",
"input",
"soft",
"bit",
"values",
"centered",
"on",
"+",
"/",
"-",
"1",
"and",
"returning",
"hard",
"decision",
"0",
"/",
"1",
"bits",
".",
"Parame... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L248-L469 | [
"def",
"viterbi_decoder",
"(",
"self",
",",
"x",
",",
"metric_type",
"=",
"'soft'",
",",
"quant_level",
"=",
"3",
")",
":",
"if",
"metric_type",
"==",
"'hard'",
":",
"# If hard decision must have 0/1 integers for input else float\r",
"if",
"np",
".",
"issubdtype",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.bm_calc | distance = bm_calc(ref_code_bits, rec_code_bits, metric_type)
Branch metrics calculation
Mark Wickert and Andrew Smit October 2018 | sk_dsp_comm/fec_conv.py | def bm_calc(self,ref_code_bits, rec_code_bits, metric_type, quant_level):
"""
distance = bm_calc(ref_code_bits, rec_code_bits, metric_type)
Branch metrics calculation
Mark Wickert and Andrew Smit October 2018
"""
distance = 0
if metric_type == 'soft': # s... | def bm_calc(self,ref_code_bits, rec_code_bits, metric_type, quant_level):
"""
distance = bm_calc(ref_code_bits, rec_code_bits, metric_type)
Branch metrics calculation
Mark Wickert and Andrew Smit October 2018
"""
distance = 0
if metric_type == 'soft': # s... | [
"distance",
"=",
"bm_calc",
"(",
"ref_code_bits",
"rec_code_bits",
"metric_type",
")",
"Branch",
"metrics",
"calculation",
"Mark",
"Wickert",
"and",
"Andrew",
"Smit",
"October",
"2018"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L471-L495 | [
"def",
"bm_calc",
"(",
"self",
",",
"ref_code_bits",
",",
"rec_code_bits",
",",
"metric_type",
",",
"quant_level",
")",
":",
"distance",
"=",
"0",
"if",
"metric_type",
"==",
"'soft'",
":",
"# squared distance metric\r",
"bits",
"=",
"binary",
"(",
"int",
"(",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.conv_encoder | output, state = conv_encoder(input,state)
We get the 1/2 or 1/3 rate from self.rate
Polys G1 and G2 are entered as binary strings, e.g,
G1 = '111' and G2 = '101' for K = 3
G1 = '1011011' and G2 = '1111001' for K = 7
G3 is also included for rate 1/3
Input state as a ... | sk_dsp_comm/fec_conv.py | def conv_encoder(self,input,state):
"""
output, state = conv_encoder(input,state)
We get the 1/2 or 1/3 rate from self.rate
Polys G1 and G2 are entered as binary strings, e.g,
G1 = '111' and G2 = '101' for K = 3
G1 = '1011011' and G2 = '1111001' for K = 7
G... | def conv_encoder(self,input,state):
"""
output, state = conv_encoder(input,state)
We get the 1/2 or 1/3 rate from self.rate
Polys G1 and G2 are entered as binary strings, e.g,
G1 = '111' and G2 = '101' for K = 3
G1 = '1011011' and G2 = '1111001' for K = 7
G... | [
"output",
"state",
"=",
"conv_encoder",
"(",
"input",
"state",
")",
"We",
"get",
"the",
"1",
"/",
"2",
"or",
"1",
"/",
"3",
"rate",
"from",
"self",
".",
"rate",
"Polys",
"G1",
"and",
"G2",
"are",
"entered",
"as",
"binary",
"strings",
"e",
".",
"g",... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L497-L551 | [
"def",
"conv_encoder",
"(",
"self",
",",
"input",
",",
"state",
")",
":",
"output",
"=",
"[",
"]",
"if",
"(",
"self",
".",
"rate",
"==",
"Fraction",
"(",
"1",
",",
"2",
")",
")",
":",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"input",
")",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.puncture | Apply puncturing to the serial bits produced by convolutionally
encoding.
:param code_bits:
:param puncture_pattern:
:return:
Examples
--------
This example uses the following puncture matrix:
.. math::
\\begin{align*}
... | sk_dsp_comm/fec_conv.py | def puncture(self,code_bits,puncture_pattern = ('110','101')):
"""
Apply puncturing to the serial bits produced by convolutionally
encoding.
:param code_bits:
:param puncture_pattern:
:return:
Examples
--------
This example uses the fo... | def puncture(self,code_bits,puncture_pattern = ('110','101')):
"""
Apply puncturing to the serial bits produced by convolutionally
encoding.
:param code_bits:
:param puncture_pattern:
:return:
Examples
--------
This example uses the fo... | [
"Apply",
"puncturing",
"to",
"the",
"serial",
"bits",
"produced",
"by",
"convolutionally",
"encoding",
".",
":",
"param",
"code_bits",
":",
":",
"param",
"puncture_pattern",
":",
":",
"return",
":",
"Examples",
"--------",
"This",
"example",
"uses",
"the",
"fo... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L553-L619 | [
"def",
"puncture",
"(",
"self",
",",
"code_bits",
",",
"puncture_pattern",
"=",
"(",
"'110'",
",",
"'101'",
")",
")",
":",
"# Check to see that the length of code_bits is consistent with a rate\r",
"# 1/2 code.\r",
"L_pp",
"=",
"len",
"(",
"puncture_pattern",
"[",
"0"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.depuncture | Apply de-puncturing to the soft bits coming from the channel. Erasure bits
are inserted to return the soft bit values back to a form that can be
Viterbi decoded.
:param soft_bits:
:param puncture_pattern:
:param erase_value:
:return:
Examples
-... | sk_dsp_comm/fec_conv.py | def depuncture(self,soft_bits,puncture_pattern = ('110','101'),
erase_value = 3.5):
"""
Apply de-puncturing to the soft bits coming from the channel. Erasure bits
are inserted to return the soft bit values back to a form that can be
Viterbi decoded.
:pa... | def depuncture(self,soft_bits,puncture_pattern = ('110','101'),
erase_value = 3.5):
"""
Apply de-puncturing to the soft bits coming from the channel. Erasure bits
are inserted to return the soft bit values back to a form that can be
Viterbi decoded.
:pa... | [
"Apply",
"de",
"-",
"puncturing",
"to",
"the",
"soft",
"bits",
"coming",
"from",
"the",
"channel",
".",
"Erasure",
"bits",
"are",
"inserted",
"to",
"return",
"the",
"soft",
"bit",
"values",
"back",
"to",
"a",
"form",
"that",
"can",
"be",
"Viterbi",
"deco... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L621-L708 | [
"def",
"depuncture",
"(",
"self",
",",
"soft_bits",
",",
"puncture_pattern",
"=",
"(",
"'110'",
",",
"'101'",
")",
",",
"erase_value",
"=",
"3.5",
")",
":",
"# Check to see that the length of soft_bits is consistent with a rate\r",
"# 1/2 code.\r",
"L_pp",
"=",
"len",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.trellis_plot | Plots a trellis diagram of the possible state transitions.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_conv import fec_conv
>>> cc = fec_conv()
... | sk_dsp_comm/fec_conv.py | def trellis_plot(self,fsize=(6,4)):
"""
Plots a trellis diagram of the possible state transitions.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_c... | def trellis_plot(self,fsize=(6,4)):
"""
Plots a trellis diagram of the possible state transitions.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_c... | [
"Plots",
"a",
"trellis",
"diagram",
"of",
"the",
"possible",
"state",
"transitions",
".",
"Parameters",
"----------",
"fsize",
":",
"Plot",
"size",
"for",
"matplotlib",
".",
"Examples",
"--------",
">>>",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
">>... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L710-L749 | [
"def",
"trellis_plot",
"(",
"self",
",",
"fsize",
"=",
"(",
"6",
",",
"4",
")",
")",
":",
"branches_from",
"=",
"self",
".",
"branches",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"fsize",
")",
"plt",
".",
"plot",
"(",
"0",
",",
"0",
",",
"'.'",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_conv.traceback_plot | Plots a path of the possible last 4 states.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_conv import fec_conv
>>> from sk_dsp_comm import digitalcom as dc... | sk_dsp_comm/fec_conv.py | def traceback_plot(self,fsize=(6,4)):
"""
Plots a path of the possible last 4 states.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_conv import fe... | def traceback_plot(self,fsize=(6,4)):
"""
Plots a path of the possible last 4 states.
Parameters
----------
fsize : Plot size for matplotlib.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm.fec_conv import fe... | [
"Plots",
"a",
"path",
"of",
"the",
"possible",
"last",
"4",
"states",
".",
"Parameters",
"----------",
"fsize",
":",
"Plot",
"size",
"for",
"matplotlib",
".",
"Examples",
"--------",
">>>",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
">>>",
"from",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_conv.py#L751-L788 | [
"def",
"traceback_plot",
"(",
"self",
",",
"fsize",
"=",
"(",
"6",
",",
"4",
")",
")",
":",
"traceback_states",
"=",
"self",
".",
"paths",
".",
"traceback_states",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"fsize",
")",
"plt",
".",
"axis",
"(",
"[",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | rate_change.up | Upsample and filter the signal | sk_dsp_comm/multirate_helper.py | def up(self,x):
"""
Upsample and filter the signal
"""
y = self.M*ssd.upsample(x,self.M)
y = signal.lfilter(self.b,self.a,y)
return y | def up(self,x):
"""
Upsample and filter the signal
"""
y = self.M*ssd.upsample(x,self.M)
y = signal.lfilter(self.b,self.a,y)
return y | [
"Upsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L68-L74 | [
"def",
"up",
"(",
"self",
",",
"x",
")",
":",
"y",
"=",
"self",
".",
"M",
"*",
"ssd",
".",
"upsample",
"(",
"x",
",",
"self",
".",
"M",
")",
"y",
"=",
"signal",
".",
"lfilter",
"(",
"self",
".",
"b",
",",
"self",
".",
"a",
",",
"y",
")",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | rate_change.dn | Downsample and filter the signal | sk_dsp_comm/multirate_helper.py | def dn(self,x):
"""
Downsample and filter the signal
"""
y = signal.lfilter(self.b,self.a,x)
y = ssd.downsample(y,self.M)
return y | def dn(self,x):
"""
Downsample and filter the signal
"""
y = signal.lfilter(self.b,self.a,x)
y = ssd.downsample(y,self.M)
return y | [
"Downsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L76-L82 | [
"def",
"dn",
"(",
"self",
",",
"x",
")",
":",
"y",
"=",
"signal",
".",
"lfilter",
"(",
"self",
".",
"b",
",",
"self",
".",
"a",
",",
"x",
")",
"y",
"=",
"ssd",
".",
"downsample",
"(",
"y",
",",
"self",
".",
"M",
")",
"return",
"y"
] | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_FIR.filter | Filter the signal | sk_dsp_comm/multirate_helper.py | def filter(self,x):
"""
Filter the signal
"""
y = signal.lfilter(self.b,[1],x)
return y | def filter(self,x):
"""
Filter the signal
"""
y = signal.lfilter(self.b,[1],x)
return y | [
"Filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L103-L108 | [
"def",
"filter",
"(",
"self",
",",
"x",
")",
":",
"y",
"=",
"signal",
".",
"lfilter",
"(",
"self",
".",
"b",
",",
"[",
"1",
"]",
",",
"x",
")",
"return",
"y"
] | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_FIR.up | Upsample and filter the signal | sk_dsp_comm/multirate_helper.py | def up(self,x,L_change = 12):
"""
Upsample and filter the signal
"""
y = L_change*ssd.upsample(x,L_change)
y = signal.lfilter(self.b,[1],y)
return y | def up(self,x,L_change = 12):
"""
Upsample and filter the signal
"""
y = L_change*ssd.upsample(x,L_change)
y = signal.lfilter(self.b,[1],y)
return y | [
"Upsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L111-L117 | [
"def",
"up",
"(",
"self",
",",
"x",
",",
"L_change",
"=",
"12",
")",
":",
"y",
"=",
"L_change",
"*",
"ssd",
".",
"upsample",
"(",
"x",
",",
"L_change",
")",
"y",
"=",
"signal",
".",
"lfilter",
"(",
"self",
".",
"b",
",",
"[",
"1",
"]",
",",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_FIR.dn | Downsample and filter the signal | sk_dsp_comm/multirate_helper.py | def dn(self,x,M_change = 12):
"""
Downsample and filter the signal
"""
y = signal.lfilter(self.b,[1],x)
y = ssd.downsample(y,M_change)
return y | def dn(self,x,M_change = 12):
"""
Downsample and filter the signal
"""
y = signal.lfilter(self.b,[1],x)
y = ssd.downsample(y,M_change)
return y | [
"Downsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L120-L126 | [
"def",
"dn",
"(",
"self",
",",
"x",
",",
"M_change",
"=",
"12",
")",
":",
"y",
"=",
"signal",
".",
"lfilter",
"(",
"self",
".",
"b",
",",
"[",
"1",
"]",
",",
"x",
")",
"y",
"=",
"ssd",
".",
"downsample",
"(",
"y",
",",
"M_change",
")",
"ret... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_FIR.zplane | Plot the poles and zeros of the FIR filter in the z-plane | sk_dsp_comm/multirate_helper.py | def zplane(self,auto_scale=True,size=2,detect_mult=True,tol=0.001):
"""
Plot the poles and zeros of the FIR filter in the z-plane
"""
ssd.zplane(self.b,[1],auto_scale,size,tol) | def zplane(self,auto_scale=True,size=2,detect_mult=True,tol=0.001):
"""
Plot the poles and zeros of the FIR filter in the z-plane
"""
ssd.zplane(self.b,[1],auto_scale,size,tol) | [
"Plot",
"the",
"poles",
"and",
"zeros",
"of",
"the",
"FIR",
"filter",
"in",
"the",
"z",
"-",
"plane"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L138-L142 | [
"def",
"zplane",
"(",
"self",
",",
"auto_scale",
"=",
"True",
",",
"size",
"=",
"2",
",",
"detect_mult",
"=",
"True",
",",
"tol",
"=",
"0.001",
")",
":",
"ssd",
".",
"zplane",
"(",
"self",
".",
"b",
",",
"[",
"1",
"]",
",",
"auto_scale",
",",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_IIR.filter | Filter the signal using second-order sections | sk_dsp_comm/multirate_helper.py | def filter(self,x):
"""
Filter the signal using second-order sections
"""
y = signal.sosfilt(self.sos,x)
return y | def filter(self,x):
"""
Filter the signal using second-order sections
"""
y = signal.sosfilt(self.sos,x)
return y | [
"Filter",
"the",
"signal",
"using",
"second",
"-",
"order",
"sections"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L168-L173 | [
"def",
"filter",
"(",
"self",
",",
"x",
")",
":",
"y",
"=",
"signal",
".",
"sosfilt",
"(",
"self",
".",
"sos",
",",
"x",
")",
"return",
"y"
] | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_IIR.up | Upsample and filter the signal | sk_dsp_comm/multirate_helper.py | def up(self,x,L_change = 12):
"""
Upsample and filter the signal
"""
y = L_change*ssd.upsample(x,L_change)
y = signal.sosfilt(self.sos,y)
return y | def up(self,x,L_change = 12):
"""
Upsample and filter the signal
"""
y = L_change*ssd.upsample(x,L_change)
y = signal.sosfilt(self.sos,y)
return y | [
"Upsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L176-L182 | [
"def",
"up",
"(",
"self",
",",
"x",
",",
"L_change",
"=",
"12",
")",
":",
"y",
"=",
"L_change",
"*",
"ssd",
".",
"upsample",
"(",
"x",
",",
"L_change",
")",
"y",
"=",
"signal",
".",
"sosfilt",
"(",
"self",
".",
"sos",
",",
"y",
")",
"return",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_IIR.dn | Downsample and filter the signal | sk_dsp_comm/multirate_helper.py | def dn(self,x,M_change = 12):
"""
Downsample and filter the signal
"""
y = signal.sosfilt(self.sos,x)
y = ssd.downsample(y,M_change)
return y | def dn(self,x,M_change = 12):
"""
Downsample and filter the signal
"""
y = signal.sosfilt(self.sos,x)
y = ssd.downsample(y,M_change)
return y | [
"Downsample",
"and",
"filter",
"the",
"signal"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L185-L191 | [
"def",
"dn",
"(",
"self",
",",
"x",
",",
"M_change",
"=",
"12",
")",
":",
"y",
"=",
"signal",
".",
"sosfilt",
"(",
"self",
".",
"sos",
",",
"x",
")",
"y",
"=",
"ssd",
".",
"downsample",
"(",
"y",
",",
"M_change",
")",
"return",
"y"
] | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_IIR.freq_resp | Frequency response plot | sk_dsp_comm/multirate_helper.py | def freq_resp(self, mode= 'dB', fs = 8000, ylim = [-100,2]):
"""
Frequency response plot
"""
iir_d.freqz_resp_cas_list([self.sos],mode,fs=fs)
pylab.grid()
pylab.ylim(ylim) | def freq_resp(self, mode= 'dB', fs = 8000, ylim = [-100,2]):
"""
Frequency response plot
"""
iir_d.freqz_resp_cas_list([self.sos],mode,fs=fs)
pylab.grid()
pylab.ylim(ylim) | [
"Frequency",
"response",
"plot"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L194-L200 | [
"def",
"freq_resp",
"(",
"self",
",",
"mode",
"=",
"'dB'",
",",
"fs",
"=",
"8000",
",",
"ylim",
"=",
"[",
"-",
"100",
",",
"2",
"]",
")",
":",
"iir_d",
".",
"freqz_resp_cas_list",
"(",
"[",
"self",
".",
"sos",
"]",
",",
"mode",
",",
"fs",
"=",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | multirate_IIR.zplane | Plot the poles and zeros of the FIR filter in the z-plane | sk_dsp_comm/multirate_helper.py | def zplane(self,auto_scale=True,size=2,detect_mult=True,tol=0.001):
"""
Plot the poles and zeros of the FIR filter in the z-plane
"""
iir_d.sos_zplane(self.sos,auto_scale,size,tol) | def zplane(self,auto_scale=True,size=2,detect_mult=True,tol=0.001):
"""
Plot the poles and zeros of the FIR filter in the z-plane
"""
iir_d.sos_zplane(self.sos,auto_scale,size,tol) | [
"Plot",
"the",
"poles",
"and",
"zeros",
"of",
"the",
"FIR",
"filter",
"in",
"the",
"z",
"-",
"plane"
] | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/multirate_helper.py#L203-L207 | [
"def",
"zplane",
"(",
"self",
",",
"auto_scale",
"=",
"True",
",",
"size",
"=",
"2",
",",
"detect_mult",
"=",
"True",
",",
"tol",
"=",
"0.001",
")",
":",
"iir_d",
".",
"sos_zplane",
"(",
"self",
".",
"sos",
",",
"auto_scale",
",",
"size",
",",
"tol... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | ser2ber | Converts symbol error rate to bit error rate. Taken from Ziemer and
Tranter page 650. Necessary when comparing different types of block codes.
parameters
----------
q: size of the code alphabet for given modulation type (BPSK=2)
n: number of channel bits
d: distance (2e+1) where e is the ... | sk_dsp_comm/fec_block.py | def ser2ber(q,n,d,t,ps):
"""
Converts symbol error rate to bit error rate. Taken from Ziemer and
Tranter page 650. Necessary when comparing different types of block codes.
parameters
----------
q: size of the code alphabet for given modulation type (BPSK=2)
n: number of channel bits
... | def ser2ber(q,n,d,t,ps):
"""
Converts symbol error rate to bit error rate. Taken from Ziemer and
Tranter page 650. Necessary when comparing different types of block codes.
parameters
----------
q: size of the code alphabet for given modulation type (BPSK=2)
n: number of channel bits
... | [
"Converts",
"symbol",
"error",
"rate",
"to",
"bit",
"error",
"rate",
".",
"Taken",
"from",
"Ziemer",
"and",
"Tranter",
"page",
"650",
".",
"Necessary",
"when",
"comparing",
"different",
"types",
"of",
"block",
"codes",
".",
"parameters",
"----------",
"q",
"... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L424-L457 | [
"def",
"ser2ber",
"(",
"q",
",",
"n",
",",
"d",
",",
"t",
",",
"ps",
")",
":",
"lnps",
"=",
"len",
"(",
"ps",
")",
"# len of error vector",
"ber",
"=",
"np",
".",
"zeros",
"(",
"lnps",
")",
"# inialize output vector",
"for",
"k",
"in",
"range",
"("... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | block_single_error_Pb_bound | Finds the bit error probability bounds according to Ziemer and Tranter
page 656.
parameters:
-----------
j: number of parity bits used in single error correction block code
SNRdB: Eb/N0 values in dB
coded: Select single error correction code (True) or uncoded (False)
M: modulation orde... | sk_dsp_comm/fec_block.py | def block_single_error_Pb_bound(j,SNRdB,coded=True,M=2):
"""
Finds the bit error probability bounds according to Ziemer and Tranter
page 656.
parameters:
-----------
j: number of parity bits used in single error correction block code
SNRdB: Eb/N0 values in dB
coded: Select single e... | def block_single_error_Pb_bound(j,SNRdB,coded=True,M=2):
"""
Finds the bit error probability bounds according to Ziemer and Tranter
page 656.
parameters:
-----------
j: number of parity bits used in single error correction block code
SNRdB: Eb/N0 values in dB
coded: Select single e... | [
"Finds",
"the",
"bit",
"error",
"probability",
"bounds",
"according",
"to",
"Ziemer",
"and",
"Tranter",
"page",
"656",
".",
"parameters",
":",
"-----------",
"j",
":",
"number",
"of",
"parity",
"bits",
"used",
"in",
"single",
"error",
"correction",
"block",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L459-L499 | [
"def",
"block_single_error_Pb_bound",
"(",
"j",
",",
"SNRdB",
",",
"coded",
"=",
"True",
",",
"M",
"=",
"2",
")",
":",
"Pb",
"=",
"np",
".",
"zeros_like",
"(",
"SNRdB",
")",
"Ps",
"=",
"np",
".",
"zeros_like",
"(",
"SNRdB",
")",
"SNR",
"=",
"10.",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_hamming.hamm_gen | Generates parity check matrix (H) and generator
matrix (G).
Parameters
----------
j: Number of Hamming code parity bits with n = 2^j-1 and k = n-j
returns
-------
G: Systematic generator matrix with left-side identity matrix
H: Systemati... | sk_dsp_comm/fec_block.py | def hamm_gen(self,j):
"""
Generates parity check matrix (H) and generator
matrix (G).
Parameters
----------
j: Number of Hamming code parity bits with n = 2^j-1 and k = n-j
returns
-------
G: Systematic generator matrix with left... | def hamm_gen(self,j):
"""
Generates parity check matrix (H) and generator
matrix (G).
Parameters
----------
j: Number of Hamming code parity bits with n = 2^j-1 and k = n-j
returns
-------
G: Systematic generator matrix with left... | [
"Generates",
"parity",
"check",
"matrix",
"(",
"H",
")",
"and",
"generator",
"matrix",
"(",
"G",
")",
".",
"Parameters",
"----------",
"j",
":",
"Number",
"of",
"Hamming",
"code",
"parity",
"bits",
"with",
"n",
"=",
"2^j",
"-",
"1",
"and",
"k",
"=",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L86-L149 | [
"def",
"hamm_gen",
"(",
"self",
",",
"j",
")",
":",
"if",
"(",
"j",
"<",
"3",
")",
":",
"raise",
"ValueError",
"(",
"'j must be > 2'",
")",
"# calculate codeword length",
"n",
"=",
"2",
"**",
"j",
"-",
"1",
"# calculate source bit length",
"k",
"=",
"n",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_hamming.hamm_encoder | Encodes input bit array x using hamming block code.
parameters
----------
x: array of source bits to be encoded by block encoder.
returns
-------
codewords: array of code words generated by generator
matrix G and input x.
Andrew ... | sk_dsp_comm/fec_block.py | def hamm_encoder(self,x):
"""
Encodes input bit array x using hamming block code.
parameters
----------
x: array of source bits to be encoded by block encoder.
returns
-------
codewords: array of code words generated by generator
... | def hamm_encoder(self,x):
"""
Encodes input bit array x using hamming block code.
parameters
----------
x: array of source bits to be encoded by block encoder.
returns
-------
codewords: array of code words generated by generator
... | [
"Encodes",
"input",
"bit",
"array",
"x",
"using",
"hamming",
"block",
"code",
".",
"parameters",
"----------",
"x",
":",
"array",
"of",
"source",
"bits",
"to",
"be",
"encoded",
"by",
"block",
"encoder",
".",
"returns",
"-------",
"codewords",
":",
"array",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L151-L178 | [
"def",
"hamm_encoder",
"(",
"self",
",",
"x",
")",
":",
"if",
"(",
"np",
".",
"dtype",
"(",
"x",
"[",
"0",
"]",
")",
"!=",
"int",
")",
":",
"raise",
"ValueError",
"(",
"'Error: Invalid data type. Input must be a vector of ints'",
")",
"if",
"(",
"len",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_hamming.hamm_decoder | Decode hamming encoded codewords. Make sure code words are of
the appropriate length for the object.
parameters
---------
codewords: bit array of codewords
returns
-------
decoded_bits: bit array of decoded source bits
Andrew Sm... | sk_dsp_comm/fec_block.py | def hamm_decoder(self,codewords):
"""
Decode hamming encoded codewords. Make sure code words are of
the appropriate length for the object.
parameters
---------
codewords: bit array of codewords
returns
-------
decoded_bits: bit a... | def hamm_decoder(self,codewords):
"""
Decode hamming encoded codewords. Make sure code words are of
the appropriate length for the object.
parameters
---------
codewords: bit array of codewords
returns
-------
decoded_bits: bit a... | [
"Decode",
"hamming",
"encoded",
"codewords",
".",
"Make",
"sure",
"code",
"words",
"are",
"of",
"the",
"appropriate",
"length",
"for",
"the",
"object",
".",
"parameters",
"---------",
"codewords",
":",
"bit",
"array",
"of",
"codewords",
"returns",
"-------",
"... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L180-L235 | [
"def",
"hamm_decoder",
"(",
"self",
",",
"codewords",
")",
":",
"if",
"(",
"np",
".",
"dtype",
"(",
"codewords",
"[",
"0",
"]",
")",
"!=",
"int",
")",
":",
"raise",
"ValueError",
"(",
"'Error: Invalid data type. Input must be a vector of ints'",
")",
"if",
"... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_cyclic.cyclic_encoder | Encodes input bit array x using cyclic block code.
parameters
----------
x: vector of source bits to be encoded by block encoder. Numpy array
of integers expected.
returns
-------
codewords: vector of code words generated from input vector
... | sk_dsp_comm/fec_block.py | def cyclic_encoder(self,x,G='1011'):
"""
Encodes input bit array x using cyclic block code.
parameters
----------
x: vector of source bits to be encoded by block encoder. Numpy array
of integers expected.
returns
-------
codewo... | def cyclic_encoder(self,x,G='1011'):
"""
Encodes input bit array x using cyclic block code.
parameters
----------
x: vector of source bits to be encoded by block encoder. Numpy array
of integers expected.
returns
-------
codewo... | [
"Encodes",
"input",
"bit",
"array",
"x",
"using",
"cyclic",
"block",
"code",
".",
"parameters",
"----------",
"x",
":",
"vector",
"of",
"source",
"bits",
"to",
"be",
"encoded",
"by",
"block",
"encoder",
".",
"Numpy",
"array",
"of",
"integers",
"expected",
... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L291-L353 | [
"def",
"cyclic_encoder",
"(",
"self",
",",
"x",
",",
"G",
"=",
"'1011'",
")",
":",
"# Check block length",
"if",
"(",
"len",
"(",
"x",
")",
"%",
"self",
".",
"k",
"or",
"len",
"(",
"x",
")",
"<",
"self",
".",
"k",
")",
":",
"raise",
"ValueError",... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | fec_cyclic.cyclic_decoder | Decodes a vector of cyclic coded codewords.
parameters
----------
codewords: vector of codewords to be decoded. Numpy array of integers expected.
returns
-------
decoded_blocks: vector of decoded bits
Andrew Smit November 2018 | sk_dsp_comm/fec_block.py | def cyclic_decoder(self,codewords):
"""
Decodes a vector of cyclic coded codewords.
parameters
----------
codewords: vector of codewords to be decoded. Numpy array of integers expected.
returns
-------
decoded_blocks: vector of decoded bi... | def cyclic_decoder(self,codewords):
"""
Decodes a vector of cyclic coded codewords.
parameters
----------
codewords: vector of codewords to be decoded. Numpy array of integers expected.
returns
-------
decoded_blocks: vector of decoded bi... | [
"Decodes",
"a",
"vector",
"of",
"cyclic",
"coded",
"codewords",
".",
"parameters",
"----------",
"codewords",
":",
"vector",
"of",
"codewords",
"to",
"be",
"decoded",
".",
"Numpy",
"array",
"of",
"integers",
"expected",
".",
"returns",
"-------",
"decoded_blocks... | mwickert/scikit-dsp-comm | python | https://github.com/mwickert/scikit-dsp-comm/blob/5c1353412a4d81a8d7da169057564ecf940f8b5b/sk_dsp_comm/fec_block.py#L356-L422 | [
"def",
"cyclic_decoder",
"(",
"self",
",",
"codewords",
")",
":",
"# Check block length",
"if",
"(",
"len",
"(",
"codewords",
")",
"%",
"self",
".",
"n",
"or",
"len",
"(",
"codewords",
")",
"<",
"self",
".",
"n",
")",
":",
"raise",
"ValueError",
"(",
... | 5c1353412a4d81a8d7da169057564ecf940f8b5b |
valid | _select_manager | Select the proper LockManager based on the current backend used by Celery.
:raise NotImplementedError: If Celery is using an unsupported backend.
:param str backend_name: Class name of the current Celery backend. Usually value of
current_app.extensions['celery'].celery.backend.__class__.__name__.
... | flask_celery.py | def _select_manager(backend_name):
"""Select the proper LockManager based on the current backend used by Celery.
:raise NotImplementedError: If Celery is using an unsupported backend.
:param str backend_name: Class name of the current Celery backend. Usually value of
current_app.extensions['celery... | def _select_manager(backend_name):
"""Select the proper LockManager based on the current backend used by Celery.
:raise NotImplementedError: If Celery is using an unsupported backend.
:param str backend_name: Class name of the current Celery backend. Usually value of
current_app.extensions['celery... | [
"Select",
"the",
"proper",
"LockManager",
"based",
"on",
"the",
"current",
"backend",
"used",
"by",
"Celery",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L139-L155 | [
"def",
"_select_manager",
"(",
"backend_name",
")",
":",
"if",
"backend_name",
"==",
"'RedisBackend'",
":",
"lock_manager",
"=",
"_LockManagerRedis",
"elif",
"backend_name",
"==",
"'DatabaseBackend'",
":",
"lock_manager",
"=",
"_LockManagerDB",
"else",
":",
"raise",
... | 92bd3b02954422665260116adda8eb899546c365 |
valid | single_instance | Celery task decorator. Forces the task to have only one running instance at a time.
Use with binded tasks (@celery.task(bind=True)).
Modeled after:
http://loose-bits.com/2010/10/distributed-task-locking-in-celery.html
http://blogs.it.ox.ac.uk/inapickle/2012/01/05/python-decorators-with-optional-argume... | flask_celery.py | def single_instance(func=None, lock_timeout=None, include_args=False):
"""Celery task decorator. Forces the task to have only one running instance at a time.
Use with binded tasks (@celery.task(bind=True)).
Modeled after:
http://loose-bits.com/2010/10/distributed-task-locking-in-celery.html
http:/... | def single_instance(func=None, lock_timeout=None, include_args=False):
"""Celery task decorator. Forces the task to have only one running instance at a time.
Use with binded tasks (@celery.task(bind=True)).
Modeled after:
http://loose-bits.com/2010/10/distributed-task-locking-in-celery.html
http:/... | [
"Celery",
"task",
"decorator",
".",
"Forces",
"the",
"task",
"to",
"have",
"only",
"one",
"running",
"instance",
"at",
"a",
"time",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L228-L269 | [
"def",
"single_instance",
"(",
"func",
"=",
"None",
",",
"lock_timeout",
"=",
"None",
",",
"include_args",
"=",
"False",
")",
":",
"if",
"func",
"is",
"None",
":",
"return",
"partial",
"(",
"single_instance",
",",
"lock_timeout",
"=",
"lock_timeout",
",",
... | 92bd3b02954422665260116adda8eb899546c365 |
valid | _LockManager.task_identifier | Return the unique identifier (string) of a task instance. | flask_celery.py | def task_identifier(self):
"""Return the unique identifier (string) of a task instance."""
task_id = self.celery_self.name
if self.include_args:
merged_args = str(self.args) + str([(k, self.kwargs[k]) for k in sorted(self.kwargs)])
task_id += '.args.{0}'.format(hashlib.md... | def task_identifier(self):
"""Return the unique identifier (string) of a task instance."""
task_id = self.celery_self.name
if self.include_args:
merged_args = str(self.args) + str([(k, self.kwargs[k]) for k in sorted(self.kwargs)])
task_id += '.args.{0}'.format(hashlib.md... | [
"Return",
"the",
"unique",
"identifier",
"(",
"string",
")",
"of",
"a",
"task",
"instance",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L46-L52 | [
"def",
"task_identifier",
"(",
"self",
")",
":",
"task_id",
"=",
"self",
".",
"celery_self",
".",
"name",
"if",
"self",
".",
"include_args",
":",
"merged_args",
"=",
"str",
"(",
"self",
".",
"args",
")",
"+",
"str",
"(",
"[",
"(",
"k",
",",
"self",
... | 92bd3b02954422665260116adda8eb899546c365 |
valid | _LockManagerRedis.is_already_running | Return True if lock exists and has not timed out. | flask_celery.py | def is_already_running(self):
"""Return True if lock exists and has not timed out."""
redis_key = self.CELERY_LOCK.format(task_id=self.task_identifier)
return self.celery_self.backend.client.exists(redis_key) | def is_already_running(self):
"""Return True if lock exists and has not timed out."""
redis_key = self.CELERY_LOCK.format(task_id=self.task_identifier)
return self.celery_self.backend.client.exists(redis_key) | [
"Return",
"True",
"if",
"lock",
"exists",
"and",
"has",
"not",
"timed",
"out",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L82-L85 | [
"def",
"is_already_running",
"(",
"self",
")",
":",
"redis_key",
"=",
"self",
".",
"CELERY_LOCK",
".",
"format",
"(",
"task_id",
"=",
"self",
".",
"task_identifier",
")",
"return",
"self",
".",
"celery_self",
".",
"backend",
".",
"client",
".",
"exists",
"... | 92bd3b02954422665260116adda8eb899546c365 |
valid | _LockManagerRedis.reset_lock | Removed the lock regardless of timeout. | flask_celery.py | def reset_lock(self):
"""Removed the lock regardless of timeout."""
redis_key = self.CELERY_LOCK.format(task_id=self.task_identifier)
self.celery_self.backend.client.delete(redis_key) | def reset_lock(self):
"""Removed the lock regardless of timeout."""
redis_key = self.CELERY_LOCK.format(task_id=self.task_identifier)
self.celery_self.backend.client.delete(redis_key) | [
"Removed",
"the",
"lock",
"regardless",
"of",
"timeout",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L87-L90 | [
"def",
"reset_lock",
"(",
"self",
")",
":",
"redis_key",
"=",
"self",
".",
"CELERY_LOCK",
".",
"format",
"(",
"task_id",
"=",
"self",
".",
"task_identifier",
")",
"self",
".",
"celery_self",
".",
"backend",
".",
"client",
".",
"delete",
"(",
"redis_key",
... | 92bd3b02954422665260116adda8eb899546c365 |
valid | _LockManagerDB.is_already_running | Return True if lock exists and has not timed out. | flask_celery.py | def is_already_running(self):
"""Return True if lock exists and has not timed out."""
date_done = (self.restore_group(self.task_identifier) or dict()).get('date_done')
if not date_done:
return False
difference = datetime.utcnow() - date_done
return difference < timede... | def is_already_running(self):
"""Return True if lock exists and has not timed out."""
date_done = (self.restore_group(self.task_identifier) or dict()).get('date_done')
if not date_done:
return False
difference = datetime.utcnow() - date_done
return difference < timede... | [
"Return",
"True",
"if",
"lock",
"exists",
"and",
"has",
"not",
"timed",
"out",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L126-L132 | [
"def",
"is_already_running",
"(",
"self",
")",
":",
"date_done",
"=",
"(",
"self",
".",
"restore_group",
"(",
"self",
".",
"task_identifier",
")",
"or",
"dict",
"(",
")",
")",
".",
"get",
"(",
"'date_done'",
")",
"if",
"not",
"date_done",
":",
"return",
... | 92bd3b02954422665260116adda8eb899546c365 |
valid | Celery.init_app | Actual method to read celery settings from app configuration and initialize the celery instance.
:param app: Flask application instance. | flask_celery.py | def init_app(self, app):
"""Actual method to read celery settings from app configuration and initialize the celery instance.
:param app: Flask application instance.
"""
_state._register_app = self.original_register_app # Restore Celery app registration function.
if not hasattr(... | def init_app(self, app):
"""Actual method to read celery settings from app configuration and initialize the celery instance.
:param app: Flask application instance.
"""
_state._register_app = self.original_register_app # Restore Celery app registration function.
if not hasattr(... | [
"Actual",
"method",
"to",
"read",
"celery",
"settings",
"from",
"app",
"configuration",
"and",
"initialize",
"the",
"celery",
"instance",
"."
] | Robpol86/Flask-Celery-Helper | python | https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L197-L225 | [
"def",
"init_app",
"(",
"self",
",",
"app",
")",
":",
"_state",
".",
"_register_app",
"=",
"self",
".",
"original_register_app",
"# Restore Celery app registration function.",
"if",
"not",
"hasattr",
"(",
"app",
",",
"'extensions'",
")",
":",
"app",
".",
"extens... | 92bd3b02954422665260116adda8eb899546c365 |
valid | iter_chunksize | Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns `chunksize` except for the last iteration. | pybromo/iter_chunks.py | def iter_chunksize(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns `chunksize` except for the last iteration.
"""
last_chunksize = int(np.mod(num_samples, chunksize))
chunksize = int(chunksize)
for _ in range(int(num_s... | def iter_chunksize(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns `chunksize` except for the last iteration.
"""
last_chunksize = int(np.mod(num_samples, chunksize))
chunksize = int(chunksize)
for _ in range(int(num_s... | [
"Iterator",
"used",
"to",
"iterate",
"in",
"chunks",
"over",
"an",
"array",
"of",
"size",
"num_samples",
".",
"At",
"each",
"iteration",
"returns",
"chunksize",
"except",
"for",
"the",
"last",
"iteration",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L18-L27 | [
"def",
"iter_chunksize",
"(",
"num_samples",
",",
"chunksize",
")",
":",
"last_chunksize",
"=",
"int",
"(",
"np",
".",
"mod",
"(",
"num_samples",
",",
"chunksize",
")",
")",
"chunksize",
"=",
"int",
"(",
"chunksize",
")",
"for",
"_",
"in",
"range",
"(",
... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | iter_chunk_slice | Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a slice of size `chunksize`. In the last
iteration the slice may be smaller. | pybromo/iter_chunks.py | def iter_chunk_slice(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a slice of size `chunksize`. In the last
iteration the slice may be smaller.
"""
i = 0
for c_size in iter_chunksize(num_samples, chunksize):
... | def iter_chunk_slice(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a slice of size `chunksize`. In the last
iteration the slice may be smaller.
"""
i = 0
for c_size in iter_chunksize(num_samples, chunksize):
... | [
"Iterator",
"used",
"to",
"iterate",
"in",
"chunks",
"over",
"an",
"array",
"of",
"size",
"num_samples",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L30-L39 | [
"def",
"iter_chunk_slice",
"(",
"num_samples",
",",
"chunksize",
")",
":",
"i",
"=",
"0",
"for",
"c_size",
"in",
"iter_chunksize",
"(",
"num_samples",
",",
"chunksize",
")",
":",
"yield",
"slice",
"(",
"i",
",",
"i",
"+",
"c_size",
")",
"i",
"+=",
"c_s... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | iter_chunk_index | Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a start and stop index for a slice of size
`chunksize`. In the last iteration the slice may be smaller. | pybromo/iter_chunks.py | def iter_chunk_index(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a start and stop index for a slice of size
`chunksize`. In the last iteration the slice may be smaller.
"""
i = 0
for c_size in iter_chunksize(num_s... | def iter_chunk_index(num_samples, chunksize):
"""Iterator used to iterate in chunks over an array of size `num_samples`.
At each iteration returns a start and stop index for a slice of size
`chunksize`. In the last iteration the slice may be smaller.
"""
i = 0
for c_size in iter_chunksize(num_s... | [
"Iterator",
"used",
"to",
"iterate",
"in",
"chunks",
"over",
"an",
"array",
"of",
"size",
"num_samples",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L42-L51 | [
"def",
"iter_chunk_index",
"(",
"num_samples",
",",
"chunksize",
")",
":",
"i",
"=",
"0",
"for",
"c_size",
"in",
"iter_chunksize",
"(",
"num_samples",
",",
"chunksize",
")",
":",
"yield",
"i",
",",
"i",
"+",
"c_size",
"i",
"+=",
"c_size"
] | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | reduce_chunk | Reduce with `func`, chunk by chunk, the passed pytable `array`. | pybromo/iter_chunks.py | def reduce_chunk(func, array):
"""Reduce with `func`, chunk by chunk, the passed pytable `array`.
"""
res = []
for slice in iter_chunk_slice(array.shape[-1], array.chunkshape[-1]):
res.append(func(array[..., slice]))
return func(res) | def reduce_chunk(func, array):
"""Reduce with `func`, chunk by chunk, the passed pytable `array`.
"""
res = []
for slice in iter_chunk_slice(array.shape[-1], array.chunkshape[-1]):
res.append(func(array[..., slice]))
return func(res) | [
"Reduce",
"with",
"func",
"chunk",
"by",
"chunk",
"the",
"passed",
"pytable",
"array",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L54-L60 | [
"def",
"reduce_chunk",
"(",
"func",
",",
"array",
")",
":",
"res",
"=",
"[",
"]",
"for",
"slice",
"in",
"iter_chunk_slice",
"(",
"array",
".",
"shape",
"[",
"-",
"1",
"]",
",",
"array",
".",
"chunkshape",
"[",
"-",
"1",
"]",
")",
":",
"res",
".",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | map_chunk | Map with `func`, chunk by chunk, the input pytable `array`.
The result is stored in the output pytable array `out_array`. | pybromo/iter_chunks.py | def map_chunk(func, array, out_array):
"""Map with `func`, chunk by chunk, the input pytable `array`.
The result is stored in the output pytable array `out_array`.
"""
for slice in iter_chunk_slice(array.shape[-1], array.chunkshape[-1]):
out_array.append(func(array[..., slice]))
return out_a... | def map_chunk(func, array, out_array):
"""Map with `func`, chunk by chunk, the input pytable `array`.
The result is stored in the output pytable array `out_array`.
"""
for slice in iter_chunk_slice(array.shape[-1], array.chunkshape[-1]):
out_array.append(func(array[..., slice]))
return out_a... | [
"Map",
"with",
"func",
"chunk",
"by",
"chunk",
"the",
"input",
"pytable",
"array",
".",
"The",
"result",
"is",
"stored",
"in",
"the",
"output",
"pytable",
"array",
"out_array",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/iter_chunks.py#L63-L69 | [
"def",
"map_chunk",
"(",
"func",
",",
"array",
",",
"out_array",
")",
":",
"for",
"slice",
"in",
"iter_chunk_slice",
"(",
"array",
".",
"shape",
"[",
"-",
"1",
"]",
",",
"array",
".",
"chunkshape",
"[",
"-",
"1",
"]",
")",
":",
"out_array",
".",
"a... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | parallel_gen_timestamps | Generate timestamps from a set of remote simulations in `dview`.
Assumes that all the engines have an `S` object already containing
an emission trace (`S.em`). The "photons" timestamps are generated
from these emission traces and merged into a single array of timestamps.
`max_em_rate` and `bg_rate` are ... | pybromo/legacy.py | def parallel_gen_timestamps(dview, max_em_rate, bg_rate):
"""Generate timestamps from a set of remote simulations in `dview`.
Assumes that all the engines have an `S` object already containing
an emission trace (`S.em`). The "photons" timestamps are generated
from these emission traces and merged into a... | def parallel_gen_timestamps(dview, max_em_rate, bg_rate):
"""Generate timestamps from a set of remote simulations in `dview`.
Assumes that all the engines have an `S` object already containing
an emission trace (`S.em`). The "photons" timestamps are generated
from these emission traces and merged into a... | [
"Generate",
"timestamps",
"from",
"a",
"set",
"of",
"remote",
"simulations",
"in",
"dview",
".",
"Assumes",
"that",
"all",
"the",
"engines",
"have",
"an",
"S",
"object",
"already",
"containing",
"an",
"emission",
"trace",
"(",
"S",
".",
"em",
")",
".",
"... | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L13-L34 | [
"def",
"parallel_gen_timestamps",
"(",
"dview",
",",
"max_em_rate",
",",
"bg_rate",
")",
":",
"dview",
".",
"execute",
"(",
"'S.sim_timestamps_em_store(max_rate=%d, bg_rate=%d, '",
"'seed=S.EID, overwrite=True)'",
"%",
"(",
"max_em_rate",
",",
"bg_rate",
")",
")",
"dvie... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | merge_ph_times | Build an array of timestamps joining the arrays in `ph_times_list`.
`time_block` is the duration of each array of timestamps. | pybromo/legacy.py | def merge_ph_times(times_list, times_par_list, time_block):
"""Build an array of timestamps joining the arrays in `ph_times_list`.
`time_block` is the duration of each array of timestamps.
"""
offsets = np.arange(len(times_list)) * time_block
cum_sizes = np.cumsum([ts.size for ts in times_list])
... | def merge_ph_times(times_list, times_par_list, time_block):
"""Build an array of timestamps joining the arrays in `ph_times_list`.
`time_block` is the duration of each array of timestamps.
"""
offsets = np.arange(len(times_list)) * time_block
cum_sizes = np.cumsum([ts.size for ts in times_list])
... | [
"Build",
"an",
"array",
"of",
"timestamps",
"joining",
"the",
"arrays",
"in",
"ph_times_list",
".",
"time_block",
"is",
"the",
"duration",
"of",
"each",
"array",
"of",
"timestamps",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L39-L53 | [
"def",
"merge_ph_times",
"(",
"times_list",
",",
"times_par_list",
",",
"time_block",
")",
":",
"offsets",
"=",
"np",
".",
"arange",
"(",
"len",
"(",
"times_list",
")",
")",
"*",
"time_block",
"cum_sizes",
"=",
"np",
".",
"cumsum",
"(",
"[",
"ts",
".",
... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | merge_DA_ph_times | Returns a merged timestamp array for Donor+Accept. and bool mask for A. | pybromo/legacy.py | def merge_DA_ph_times(ph_times_d, ph_times_a):
"""Returns a merged timestamp array for Donor+Accept. and bool mask for A.
"""
ph_times = np.hstack([ph_times_d, ph_times_a])
a_em = np.hstack([np.zeros(ph_times_d.size, dtype=np.bool),
np.ones(ph_times_a.size, dtype=np.bool)])
ind... | def merge_DA_ph_times(ph_times_d, ph_times_a):
"""Returns a merged timestamp array for Donor+Accept. and bool mask for A.
"""
ph_times = np.hstack([ph_times_d, ph_times_a])
a_em = np.hstack([np.zeros(ph_times_d.size, dtype=np.bool),
np.ones(ph_times_a.size, dtype=np.bool)])
ind... | [
"Returns",
"a",
"merged",
"timestamp",
"array",
"for",
"Donor",
"+",
"Accept",
".",
"and",
"bool",
"mask",
"for",
"A",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L55-L62 | [
"def",
"merge_DA_ph_times",
"(",
"ph_times_d",
",",
"ph_times_a",
")",
":",
"ph_times",
"=",
"np",
".",
"hstack",
"(",
"[",
"ph_times_d",
",",
"ph_times_a",
"]",
")",
"a_em",
"=",
"np",
".",
"hstack",
"(",
"[",
"np",
".",
"zeros",
"(",
"ph_times_d",
".... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | merge_particle_emission | Returns a sim object summing the emissions and particles in SS (list). | pybromo/legacy.py | def merge_particle_emission(SS):
"""Returns a sim object summing the emissions and particles in SS (list).
"""
# Merge all the particles
P = reduce(lambda x, y: x + y, [Si.particles for Si in SS])
s = SS[0]
S = ParticlesSimulation(t_step=s.t_step, t_max=s.t_max,
parti... | def merge_particle_emission(SS):
"""Returns a sim object summing the emissions and particles in SS (list).
"""
# Merge all the particles
P = reduce(lambda x, y: x + y, [Si.particles for Si in SS])
s = SS[0]
S = ParticlesSimulation(t_step=s.t_step, t_max=s.t_max,
parti... | [
"Returns",
"a",
"sim",
"object",
"summing",
"the",
"emissions",
"and",
"particles",
"in",
"SS",
"(",
"list",
")",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/legacy.py#L64-L75 | [
"def",
"merge_particle_emission",
"(",
"SS",
")",
":",
"# Merge all the particles",
"P",
"=",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"+",
"y",
",",
"[",
"Si",
".",
"particles",
"for",
"Si",
"in",
"SS",
"]",
")",
"s",
"=",
"SS",
"[",
"0",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | load_PSFLab_file | Load the array `data` in the .mat file `fname`. | pybromo/psflib.py | def load_PSFLab_file(fname):
"""Load the array `data` in the .mat file `fname`."""
if os.path.exists(fname) or os.path.exists(fname + '.mat'):
return loadmat(fname)['data']
else:
raise IOError("Can't find PSF file '%s'" % fname) | def load_PSFLab_file(fname):
"""Load the array `data` in the .mat file `fname`."""
if os.path.exists(fname) or os.path.exists(fname + '.mat'):
return loadmat(fname)['data']
else:
raise IOError("Can't find PSF file '%s'" % fname) | [
"Load",
"the",
"array",
"data",
"in",
"the",
".",
"mat",
"file",
"fname",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L132-L137 | [
"def",
"load_PSFLab_file",
"(",
"fname",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
"or",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
"+",
"'.mat'",
")",
":",
"return",
"loadmat",
"(",
"fname",
")",
"[",
"'data'",
"]",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | convert_PSFLab_xz | Process a 2D array (from PSFLab .mat file) containing a x-z PSF slice.
The input data is the raw array saved by PSFLab. The returned array has
the x axis cut in half (only positive x) to take advantage of the
rotational symmetry around z. Pysical dimensions (`x_step` and `z_step)
are also assigned.
... | pybromo/psflib.py | def convert_PSFLab_xz(data, x_step=0.5, z_step=0.5, normalize=False):
"""Process a 2D array (from PSFLab .mat file) containing a x-z PSF slice.
The input data is the raw array saved by PSFLab. The returned array has
the x axis cut in half (only positive x) to take advantage of the
rotational symmetry a... | def convert_PSFLab_xz(data, x_step=0.5, z_step=0.5, normalize=False):
"""Process a 2D array (from PSFLab .mat file) containing a x-z PSF slice.
The input data is the raw array saved by PSFLab. The returned array has
the x axis cut in half (only positive x) to take advantage of the
rotational symmetry a... | [
"Process",
"a",
"2D",
"array",
"(",
"from",
"PSFLab",
".",
"mat",
"file",
")",
"containing",
"a",
"x",
"-",
"z",
"PSF",
"slice",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L139-L160 | [
"def",
"convert_PSFLab_xz",
"(",
"data",
",",
"x_step",
"=",
"0.5",
",",
"z_step",
"=",
"0.5",
",",
"normalize",
"=",
"False",
")",
":",
"z_len",
",",
"x_len",
"=",
"data",
".",
"shape",
"hdata",
"=",
"data",
"[",
":",
",",
"(",
"x_len",
"-",
"1",
... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | GaussianPSF.eval | Evaluate the function in (x, y, z). | pybromo/psflib.py | def eval(self, x, y, z):
"""Evaluate the function in (x, y, z)."""
xc, yc, zc = self.rc
sx, sy, sz = self.s
## Method1: direct evaluation
#return exp(-(((x-xc)**2)/(2*sx**2) + ((y-yc)**2)/(2*sy**2) +\
# ((z-zc)**2)/(2*sz**2)))
## Method2: evaluation using... | def eval(self, x, y, z):
"""Evaluate the function in (x, y, z)."""
xc, yc, zc = self.rc
sx, sy, sz = self.s
## Method1: direct evaluation
#return exp(-(((x-xc)**2)/(2*sx**2) + ((y-yc)**2)/(2*sy**2) +\
# ((z-zc)**2)/(2*sz**2)))
## Method2: evaluation using... | [
"Evaluate",
"the",
"function",
"in",
"(",
"x",
"y",
"z",
")",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L38-L51 | [
"def",
"eval",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
")",
":",
"xc",
",",
"yc",
",",
"zc",
"=",
"self",
".",
"rc",
"sx",
",",
"sy",
",",
"sz",
"=",
"self",
".",
"s",
"## Method1: direct evaluation",
"#return exp(-(((x-xc)**2)/(2*sx**2) + ((y-yc)**2)... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | NumericPSF.eval | Evaluate the function in (x, y, z).
The function is rotationally symmetric around z. | pybromo/psflib.py | def eval(self, x, y, z):
"""Evaluate the function in (x, y, z).
The function is rotationally symmetric around z.
"""
ro = np.sqrt(x**2 + y**2)
zs, xs = ro.shape
v = self.eval_xz(ro.ravel(), z.ravel())
return v.reshape(zs, xs) | def eval(self, x, y, z):
"""Evaluate the function in (x, y, z).
The function is rotationally symmetric around z.
"""
ro = np.sqrt(x**2 + y**2)
zs, xs = ro.shape
v = self.eval_xz(ro.ravel(), z.ravel())
return v.reshape(zs, xs) | [
"Evaluate",
"the",
"function",
"in",
"(",
"x",
"y",
"z",
")",
".",
"The",
"function",
"is",
"rotationally",
"symmetric",
"around",
"z",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L98-L105 | [
"def",
"eval",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
")",
":",
"ro",
"=",
"np",
".",
"sqrt",
"(",
"x",
"**",
"2",
"+",
"y",
"**",
"2",
")",
"zs",
",",
"xs",
"=",
"ro",
".",
"shape",
"v",
"=",
"self",
".",
"eval_xz",
"(",
"ro",
".",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | NumericPSF.to_hdf5 | Store the PSF data in `file_handle` (pytables) in `parent_node`.
The raw PSF array name is stored with same name as the original fname.
Also, the following attribues are set: fname, dir_, x_step, z_step. | pybromo/psflib.py | def to_hdf5(self, file_handle, parent_node='/'):
"""Store the PSF data in `file_handle` (pytables) in `parent_node`.
The raw PSF array name is stored with same name as the original fname.
Also, the following attribues are set: fname, dir_, x_step, z_step.
"""
tarray = file_handl... | def to_hdf5(self, file_handle, parent_node='/'):
"""Store the PSF data in `file_handle` (pytables) in `parent_node`.
The raw PSF array name is stored with same name as the original fname.
Also, the following attribues are set: fname, dir_, x_step, z_step.
"""
tarray = file_handl... | [
"Store",
"the",
"PSF",
"data",
"in",
"file_handle",
"(",
"pytables",
")",
"in",
"parent_node",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L107-L118 | [
"def",
"to_hdf5",
"(",
"self",
",",
"file_handle",
",",
"parent_node",
"=",
"'/'",
")",
":",
"tarray",
"=",
"file_handle",
".",
"create_array",
"(",
"parent_node",
",",
"name",
"=",
"self",
".",
"fname",
",",
"obj",
"=",
"self",
".",
"psflab_psf_raw",
",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | NumericPSF.hash | Return an hash string computed on the PSF data. | pybromo/psflib.py | def hash(self):
"""Return an hash string computed on the PSF data."""
hash_list = []
for key, value in sorted(self.__dict__.items()):
if not callable(value):
if isinstance(value, np.ndarray):
hash_list.append(value.tostring())
else:... | def hash(self):
"""Return an hash string computed on the PSF data."""
hash_list = []
for key, value in sorted(self.__dict__.items()):
if not callable(value):
if isinstance(value, np.ndarray):
hash_list.append(value.tostring())
else:... | [
"Return",
"an",
"hash",
"string",
"computed",
"on",
"the",
"PSF",
"data",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/psflib.py#L120-L129 | [
"def",
"hash",
"(",
"self",
")",
":",
"hash_list",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"sorted",
"(",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
")",
":",
"if",
"not",
"callable",
"(",
"value",
")",
":",
"if",
"isinstance",
"("... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | git_path_valid | Check whether the git executable is found. | pybromo/utils/git.py | def git_path_valid(git_path=None):
"""
Check whether the git executable is found.
"""
if git_path is None and GIT_PATH is None:
return False
if git_path is None: git_path = GIT_PATH
try:
call([git_path, '--version'])
return True
except OSError:
return False | def git_path_valid(git_path=None):
"""
Check whether the git executable is found.
"""
if git_path is None and GIT_PATH is None:
return False
if git_path is None: git_path = GIT_PATH
try:
call([git_path, '--version'])
return True
except OSError:
return False | [
"Check",
"whether",
"the",
"git",
"executable",
"is",
"found",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L43-L54 | [
"def",
"git_path_valid",
"(",
"git_path",
"=",
"None",
")",
":",
"if",
"git_path",
"is",
"None",
"and",
"GIT_PATH",
"is",
"None",
":",
"return",
"False",
"if",
"git_path",
"is",
"None",
":",
"git_path",
"=",
"GIT_PATH",
"try",
":",
"call",
"(",
"[",
"g... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | get_git_version | Get the Git version. | pybromo/utils/git.py | def get_git_version(git_path=None):
"""
Get the Git version.
"""
if git_path is None: git_path = GIT_PATH
git_version = check_output([git_path, "--version"]).split()[2]
return git_version | def get_git_version(git_path=None):
"""
Get the Git version.
"""
if git_path is None: git_path = GIT_PATH
git_version = check_output([git_path, "--version"]).split()[2]
return git_version | [
"Get",
"the",
"Git",
"version",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L56-L62 | [
"def",
"get_git_version",
"(",
"git_path",
"=",
"None",
")",
":",
"if",
"git_path",
"is",
"None",
":",
"git_path",
"=",
"GIT_PATH",
"git_version",
"=",
"check_output",
"(",
"[",
"git_path",
",",
"\"--version\"",
"]",
")",
".",
"split",
"(",
")",
"[",
"2"... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | check_clean_status | Returns whether there are uncommitted changes in the working dir. | pybromo/utils/git.py | def check_clean_status(git_path=None):
"""
Returns whether there are uncommitted changes in the working dir.
"""
output = get_status(git_path)
is_unmodified = (len(output.strip()) == 0)
return is_unmodified | def check_clean_status(git_path=None):
"""
Returns whether there are uncommitted changes in the working dir.
"""
output = get_status(git_path)
is_unmodified = (len(output.strip()) == 0)
return is_unmodified | [
"Returns",
"whether",
"there",
"are",
"uncommitted",
"changes",
"in",
"the",
"working",
"dir",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L72-L78 | [
"def",
"check_clean_status",
"(",
"git_path",
"=",
"None",
")",
":",
"output",
"=",
"get_status",
"(",
"git_path",
")",
"is_unmodified",
"=",
"(",
"len",
"(",
"output",
".",
"strip",
"(",
")",
")",
"==",
"0",
")",
"return",
"is_unmodified"
] | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | get_last_commit_line | Get one-line description of HEAD commit for repository in current dir. | pybromo/utils/git.py | def get_last_commit_line(git_path=None):
"""
Get one-line description of HEAD commit for repository in current dir.
"""
if git_path is None: git_path = GIT_PATH
output = check_output([git_path, "log", "--pretty=format:'%ad %h %s'",
"--date=short", "-n1"])
return output... | def get_last_commit_line(git_path=None):
"""
Get one-line description of HEAD commit for repository in current dir.
"""
if git_path is None: git_path = GIT_PATH
output = check_output([git_path, "log", "--pretty=format:'%ad %h %s'",
"--date=short", "-n1"])
return output... | [
"Get",
"one",
"-",
"line",
"description",
"of",
"HEAD",
"commit",
"for",
"repository",
"in",
"current",
"dir",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L80-L87 | [
"def",
"get_last_commit_line",
"(",
"git_path",
"=",
"None",
")",
":",
"if",
"git_path",
"is",
"None",
":",
"git_path",
"=",
"GIT_PATH",
"output",
"=",
"check_output",
"(",
"[",
"git_path",
",",
"\"log\"",
",",
"\"--pretty=format:'%ad %h %s'\"",
",",
"\"--date=s... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | get_last_commit | Get the HEAD commit SHA1 of repository in current dir. | pybromo/utils/git.py | def get_last_commit(git_path=None):
"""
Get the HEAD commit SHA1 of repository in current dir.
"""
if git_path is None: git_path = GIT_PATH
line = get_last_commit_line(git_path)
revision_id = line.split()[1]
return revision_id | def get_last_commit(git_path=None):
"""
Get the HEAD commit SHA1 of repository in current dir.
"""
if git_path is None: git_path = GIT_PATH
line = get_last_commit_line(git_path)
revision_id = line.split()[1]
return revision_id | [
"Get",
"the",
"HEAD",
"commit",
"SHA1",
"of",
"repository",
"in",
"current",
"dir",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L89-L96 | [
"def",
"get_last_commit",
"(",
"git_path",
"=",
"None",
")",
":",
"if",
"git_path",
"is",
"None",
":",
"git_path",
"=",
"GIT_PATH",
"line",
"=",
"get_last_commit_line",
"(",
"git_path",
")",
"revision_id",
"=",
"line",
".",
"split",
"(",
")",
"[",
"1",
"... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | print_summary | Print the last commit line and eventual uncommitted changes. | pybromo/utils/git.py | def print_summary(string='Repository', git_path=None):
"""
Print the last commit line and eventual uncommitted changes.
"""
if git_path is None: git_path = GIT_PATH
# If git is available, check fretbursts version
if not git_path_valid():
print('\n%s revision unknown (git not found).' % ... | def print_summary(string='Repository', git_path=None):
"""
Print the last commit line and eventual uncommitted changes.
"""
if git_path is None: git_path = GIT_PATH
# If git is available, check fretbursts version
if not git_path_valid():
print('\n%s revision unknown (git not found).' % ... | [
"Print",
"the",
"last",
"commit",
"line",
"and",
"eventual",
"uncommitted",
"changes",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/utils/git.py#L98-L112 | [
"def",
"print_summary",
"(",
"string",
"=",
"'Repository'",
",",
"git_path",
"=",
"None",
")",
":",
"if",
"git_path",
"is",
"None",
":",
"git_path",
"=",
"GIT_PATH",
"# If git is available, check fretbursts version",
"if",
"not",
"git_path_valid",
"(",
")",
":",
... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | get_bromo_fnames_da | Get filenames for donor and acceptor timestamps for the given parameters | pybromo/loadutils.py | def get_bromo_fnames_da(d_em_kHz, d_bg_kHz, a_em_kHz, a_bg_kHz,
ID='1+2+3+4+5+6', t_tot='480', num_p='30', pM='64',
t_step=0.5e-6, D=1.2e-11, dir_=''):
"""Get filenames for donor and acceptor timestamps for the given parameters
"""
clk_p = t_step/32. # with t_step=0.5us -> 156.25 ns
E_s... | def get_bromo_fnames_da(d_em_kHz, d_bg_kHz, a_em_kHz, a_bg_kHz,
ID='1+2+3+4+5+6', t_tot='480', num_p='30', pM='64',
t_step=0.5e-6, D=1.2e-11, dir_=''):
"""Get filenames for donor and acceptor timestamps for the given parameters
"""
clk_p = t_step/32. # with t_step=0.5us -> 156.25 ns
E_s... | [
"Get",
"filenames",
"for",
"donor",
"and",
"acceptor",
"timestamps",
"for",
"the",
"given",
"parameters"
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/loadutils.py#L34-L69 | [
"def",
"get_bromo_fnames_da",
"(",
"d_em_kHz",
",",
"d_bg_kHz",
",",
"a_em_kHz",
",",
"a_bg_kHz",
",",
"ID",
"=",
"'1+2+3+4+5+6'",
",",
"t_tot",
"=",
"'480'",
",",
"num_p",
"=",
"'30'",
",",
"pM",
"=",
"'64'",
",",
"t_step",
"=",
"0.5e-6",
",",
"D",
"=... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | BaseStore.set_sim_params | Store parameters in `params` in `h5file.root.parameters`.
`nparams` (dict)
A dict as returned by `get_params()` in `ParticlesSimulation()`
The format is:
keys:
used as parameter name
values: (2-elements tuple)
first element is the ... | pybromo/storage.py | def set_sim_params(self, nparams, attr_params):
"""Store parameters in `params` in `h5file.root.parameters`.
`nparams` (dict)
A dict as returned by `get_params()` in `ParticlesSimulation()`
The format is:
keys:
used as parameter name
value... | def set_sim_params(self, nparams, attr_params):
"""Store parameters in `params` in `h5file.root.parameters`.
`nparams` (dict)
A dict as returned by `get_params()` in `ParticlesSimulation()`
The format is:
keys:
used as parameter name
value... | [
"Store",
"parameters",
"in",
"params",
"in",
"h5file",
".",
"root",
".",
"parameters",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L89-L108 | [
"def",
"set_sim_params",
"(",
"self",
",",
"nparams",
",",
"attr_params",
")",
":",
"for",
"name",
",",
"value",
"in",
"nparams",
".",
"items",
"(",
")",
":",
"val",
"=",
"value",
"[",
"0",
"]",
"if",
"value",
"[",
"0",
"]",
"is",
"not",
"None",
... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | BaseStore.numeric_params | Return a dict containing all (key, values) stored in '/parameters' | pybromo/storage.py | def numeric_params(self):
"""Return a dict containing all (key, values) stored in '/parameters'
"""
nparams = dict()
for p in self.h5file.root.parameters:
nparams[p.name] = p.read()
return nparams | def numeric_params(self):
"""Return a dict containing all (key, values) stored in '/parameters'
"""
nparams = dict()
for p in self.h5file.root.parameters:
nparams[p.name] = p.read()
return nparams | [
"Return",
"a",
"dict",
"containing",
"all",
"(",
"key",
"values",
")",
"stored",
"in",
"/",
"parameters"
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L111-L117 | [
"def",
"numeric_params",
"(",
"self",
")",
":",
"nparams",
"=",
"dict",
"(",
")",
"for",
"p",
"in",
"self",
".",
"h5file",
".",
"root",
".",
"parameters",
":",
"nparams",
"[",
"p",
".",
"name",
"]",
"=",
"p",
".",
"read",
"(",
")",
"return",
"npa... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | BaseStore.numeric_params_meta | Return a dict with all parameters and metadata in '/parameters'.
This returns the same dict format as returned by get_params() method
in ParticlesSimulation(). | pybromo/storage.py | def numeric_params_meta(self):
"""Return a dict with all parameters and metadata in '/parameters'.
This returns the same dict format as returned by get_params() method
in ParticlesSimulation().
"""
nparams = dict()
for p in self.h5file.root.parameters:
nparam... | def numeric_params_meta(self):
"""Return a dict with all parameters and metadata in '/parameters'.
This returns the same dict format as returned by get_params() method
in ParticlesSimulation().
"""
nparams = dict()
for p in self.h5file.root.parameters:
nparam... | [
"Return",
"a",
"dict",
"with",
"all",
"parameters",
"and",
"metadata",
"in",
"/",
"parameters",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L120-L129 | [
"def",
"numeric_params_meta",
"(",
"self",
")",
":",
"nparams",
"=",
"dict",
"(",
")",
"for",
"p",
"in",
"self",
".",
"h5file",
".",
"root",
".",
"parameters",
":",
"nparams",
"[",
"p",
".",
"name",
"]",
"=",
"(",
"p",
".",
"read",
"(",
")",
",",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | TrajectoryStore.add_trajectory | Add an trajectory array in '/trajectories'. | pybromo/storage.py | def add_trajectory(self, name, overwrite=False, shape=(0,), title='',
chunksize=2**19, comp_filter=default_compression,
atom=tables.Float64Atom(), params=dict(),
chunkslice='bytes'):
"""Add an trajectory array in '/trajectories'.
"""
... | def add_trajectory(self, name, overwrite=False, shape=(0,), title='',
chunksize=2**19, comp_filter=default_compression,
atom=tables.Float64Atom(), params=dict(),
chunkslice='bytes'):
"""Add an trajectory array in '/trajectories'.
"""
... | [
"Add",
"an",
"trajectory",
"array",
"in",
"/",
"trajectories",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L154-L187 | [
"def",
"add_trajectory",
"(",
"self",
",",
"name",
",",
"overwrite",
"=",
"False",
",",
"shape",
"=",
"(",
"0",
",",
")",
",",
"title",
"=",
"''",
",",
"chunksize",
"=",
"2",
"**",
"19",
",",
"comp_filter",
"=",
"default_compression",
",",
"atom",
"=... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | TrajectoryStore.add_emission_tot | Add the `emission_tot` array in '/trajectories'. | pybromo/storage.py | def add_emission_tot(self, chunksize=2**19, comp_filter=default_compression,
overwrite=False, params=dict(),
chunkslice='bytes'):
"""Add the `emission_tot` array in '/trajectories'.
"""
kwargs = dict(overwrite=overwrite, chunksize=chunksize, para... | def add_emission_tot(self, chunksize=2**19, comp_filter=default_compression,
overwrite=False, params=dict(),
chunkslice='bytes'):
"""Add the `emission_tot` array in '/trajectories'.
"""
kwargs = dict(overwrite=overwrite, chunksize=chunksize, para... | [
"Add",
"the",
"emission_tot",
"array",
"in",
"/",
"trajectories",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L189-L197 | [
"def",
"add_emission_tot",
"(",
"self",
",",
"chunksize",
"=",
"2",
"**",
"19",
",",
"comp_filter",
"=",
"default_compression",
",",
"overwrite",
"=",
"False",
",",
"params",
"=",
"dict",
"(",
")",
",",
"chunkslice",
"=",
"'bytes'",
")",
":",
"kwargs",
"... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | TrajectoryStore.add_emission | Add the `emission` array in '/trajectories'. | pybromo/storage.py | def add_emission(self, chunksize=2**19, comp_filter=default_compression,
overwrite=False, params=dict(), chunkslice='bytes'):
"""Add the `emission` array in '/trajectories'.
"""
nparams = self.numeric_params
num_particles = nparams['np']
return self.add_traj... | def add_emission(self, chunksize=2**19, comp_filter=default_compression,
overwrite=False, params=dict(), chunkslice='bytes'):
"""Add the `emission` array in '/trajectories'.
"""
nparams = self.numeric_params
num_particles = nparams['np']
return self.add_traj... | [
"Add",
"the",
"emission",
"array",
"in",
"/",
"trajectories",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L199-L211 | [
"def",
"add_emission",
"(",
"self",
",",
"chunksize",
"=",
"2",
"**",
"19",
",",
"comp_filter",
"=",
"default_compression",
",",
"overwrite",
"=",
"False",
",",
"params",
"=",
"dict",
"(",
")",
",",
"chunkslice",
"=",
"'bytes'",
")",
":",
"nparams",
"=",... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | TrajectoryStore.add_position | Add the `position` array in '/trajectories'. | pybromo/storage.py | def add_position(self, radial=False, chunksize=2**19, chunkslice='bytes',
comp_filter=default_compression, overwrite=False,
params=dict()):
"""Add the `position` array in '/trajectories'.
"""
nparams = self.numeric_params
num_particles = nparams[... | def add_position(self, radial=False, chunksize=2**19, chunkslice='bytes',
comp_filter=default_compression, overwrite=False,
params=dict()):
"""Add the `position` array in '/trajectories'.
"""
nparams = self.numeric_params
num_particles = nparams[... | [
"Add",
"the",
"position",
"array",
"in",
"/",
"trajectories",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/storage.py#L213-L230 | [
"def",
"add_position",
"(",
"self",
",",
"radial",
"=",
"False",
",",
"chunksize",
"=",
"2",
"**",
"19",
",",
"chunkslice",
"=",
"'bytes'",
",",
"comp_filter",
"=",
"default_compression",
",",
"overwrite",
"=",
"False",
",",
"params",
"=",
"dict",
"(",
"... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | wrap_periodic | Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply periodic boundary conditions. | pybromo/diffusion.py | def wrap_periodic(a, a1, a2):
"""Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply periodic boundary conditions.
"""
a -= a1
wrapped = np.mod(a, a2 - a1) + a1
return wrapped | def wrap_periodic(a, a1, a2):
"""Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply periodic boundary conditions.
"""
a -= a1
wrapped = np.mod(a, a2 - a1) + a1
return wrapped | [
"Folds",
"all",
"the",
"values",
"of",
"a",
"outside",
"[",
"a1",
"..",
"a2",
"]",
"inside",
"that",
"interval",
".",
"This",
"function",
"is",
"used",
"to",
"apply",
"periodic",
"boundary",
"conditions",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L192-L198 | [
"def",
"wrap_periodic",
"(",
"a",
",",
"a1",
",",
"a2",
")",
":",
"a",
"-=",
"a1",
"wrapped",
"=",
"np",
".",
"mod",
"(",
"a",
",",
"a2",
"-",
"a1",
")",
"+",
"a1",
"return",
"wrapped"
] | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
valid | wrap_mirror | Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply mirror-like boundary conditions. | pybromo/diffusion.py | def wrap_mirror(a, a1, a2):
"""Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply mirror-like boundary conditions.
"""
a[a > a2] = a2 - (a[a > a2] - a2)
a[a < a1] = a1 + (a1 - a[a < a1])
return a | def wrap_mirror(a, a1, a2):
"""Folds all the values of `a` outside [a1..a2] inside that interval.
This function is used to apply mirror-like boundary conditions.
"""
a[a > a2] = a2 - (a[a > a2] - a2)
a[a < a1] = a1 + (a1 - a[a < a1])
return a | [
"Folds",
"all",
"the",
"values",
"of",
"a",
"outside",
"[",
"a1",
"..",
"a2",
"]",
"inside",
"that",
"interval",
".",
"This",
"function",
"is",
"used",
"to",
"apply",
"mirror",
"-",
"like",
"boundary",
"conditions",
"."
] | tritemio/PyBroMo | python | https://github.com/tritemio/PyBroMo/blob/b75f82a4551ff37e7c7a7e6954c536451f3e6d06/pybromo/diffusion.py#L201-L207 | [
"def",
"wrap_mirror",
"(",
"a",
",",
"a1",
",",
"a2",
")",
":",
"a",
"[",
"a",
">",
"a2",
"]",
"=",
"a2",
"-",
"(",
"a",
"[",
"a",
">",
"a2",
"]",
"-",
"a2",
")",
"a",
"[",
"a",
"<",
"a1",
"]",
"=",
"a1",
"+",
"(",
"a1",
"-",
"a",
"... | b75f82a4551ff37e7c7a7e6954c536451f3e6d06 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.