hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
20e951a058c67973e4da072e74fa873a2038fdde
binggu56/lime
lime/ToBeErased/FranckCondon/ParallelModes.py
[ "MIT" ]
Python
depthFirstSearch
<not_specific>
def depthFirstSearch(threshold, Modes, values, E_electronic): """ Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have (e.g. n = 0,1,2,3) Returns a tuple (ListOfEnergies, ListOfIntensities). ...
Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have (e.g. n = 0,1,2,3) Returns a tuple (ListOfEnergies, ListOfIntensities).
Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have
[ "Threshold", "is", "the", "threshold", "Franck", "-", "Condon", "after", "which", "we", "assign", "the", "value", "0", ".", "Modes", "is", "a", "list", "of", "modes", ".", "values", "is", "a", "list", "of", "values", "the", "modes", "can", "have" ]
def depthFirstSearch(threshold, Modes, values, E_electronic): ListOfIntensities = [] ListOfEnergies = [] jobserver = pp.Server() mode0 = Modes[0] jobs = [0]*len(values) print "NumModes =", len(Modes) for n in values: FC = mode0.FrankCondons[n] if FC >= threshold: ...
[ "def", "depthFirstSearch", "(", "threshold", ",", "Modes", ",", "values", ",", "E_electronic", ")", ":", "ListOfIntensities", "=", "[", "]", "ListOfEnergies", "=", "[", "]", "jobserver", "=", "pp", ".", "Server", "(", ")", "mode0", "=", "Modes", "[", "0"...
Threshold is the threshold Franck-Condon after which we assign the value 0.
[ "Threshold", "is", "the", "threshold", "Franck", "-", "Condon", "after", "which", "we", "assign", "the", "value", "0", "." ]
[ "\"\"\" Threshold is the threshold Franck-Condon after which we assign the value 0. \n Modes is a list of modes.\n values is a list of values the modes can have (e.g. n = 0,1,2,3)\n\n Returns a tuple (ListOfEnergies, ListOfIntensities).\n \"\"\"", "# will store jobs" ]
[ { "param": "threshold", "type": null }, { "param": "Modes", "type": null }, { "param": "values", "type": null }, { "param": "E_electronic", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "threshold", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Modes", "type": null, "docstring": null, "docstring_toke...
230172d88b5be4ba0ecb956c90729a36ce55463e
binggu56/lime
lime/ToBeErased/FranckCondon/Plots.py
[ "MIT" ]
Python
genSpectrum
<not_specific>
def genSpectrum(energies, intensities, widths): """ Gaussianifies the points on the spectrum using the input widths """ maxE = max(energies) minE = min(energies) print("maxE", maxE) print("minE", minE) energyRange = np.linspace(minE-1000, maxE+1000, 10000) intensityRange = [0]*len(ener...
Gaussianifies the points on the spectrum using the input widths
Gaussianifies the points on the spectrum using the input widths
[ "Gaussianifies", "the", "points", "on", "the", "spectrum", "using", "the", "input", "widths" ]
def genSpectrum(energies, intensities, widths): maxE = max(energies) minE = min(energies) print("maxE", maxE) print("minE", minE) energyRange = np.linspace(minE-1000, maxE+1000, 10000) intensityRange = [0]*len(energyRange) print("Number of points to plot:", len(energyRange)) for i in ran...
[ "def", "genSpectrum", "(", "energies", ",", "intensities", ",", "widths", ")", ":", "maxE", "=", "max", "(", "energies", ")", "minE", "=", "min", "(", "energies", ")", "print", "(", "\"maxE\"", ",", "maxE", ")", "print", "(", "\"minE\"", ",", "minE", ...
Gaussianifies the points on the spectrum using the input widths
[ "Gaussianifies", "the", "points", "on", "the", "spectrum", "using", "the", "input", "widths" ]
[ "\"\"\" Gaussianifies the points on the spectrum using the input widths\n \"\"\"", "# for i in range(len(energies)):", "# print \"E: \", energies[i], \" I: \", intensities[i]", "# print \"Gaussian for intensity i\", intensities[i]", "#print \"Intensities Gaussian\"", "# print sorted(intensityRa...
[ { "param": "energies", "type": null }, { "param": "intensities", "type": null }, { "param": "widths", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "energies", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "intensities", "type": null, "docstring": null, "docstring...
0bd09bfed7c0a6350f4502f835558fc499943872
binggu56/lime
lime/ToBeErased/FranckCondon/RecursiveModes.py
[ "MIT" ]
Python
depthFirstSearch
<not_specific>
def depthFirstSearch(threshold, Modes, values, E_electronic): """ Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have (e.g. n = 0,1,2,3) Returns a tuple (ListOfEnergies, ListOfIntensities). ...
Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have (e.g. n = 0,1,2,3) Returns a tuple (ListOfEnergies, ListOfIntensities).
Threshold is the threshold Franck-Condon after which we assign the value 0. Modes is a list of modes. values is a list of values the modes can have
[ "Threshold", "is", "the", "threshold", "Franck", "-", "Condon", "after", "which", "we", "assign", "the", "value", "0", ".", "Modes", "is", "a", "list", "of", "modes", ".", "values", "is", "a", "list", "of", "values", "the", "modes", "can", "have" ]
def depthFirstSearch(threshold, Modes, values, E_electronic): ListOfIntensites = [] ListOfEnergies = [] fringe = Stack() mode0 = Modes[0] print "NumModes =", len(Modes) for n in values: FC = mode0.FrankCondons[n] if FC >= threshold: energy = E_electronic + mode0.excit...
[ "def", "depthFirstSearch", "(", "threshold", ",", "Modes", ",", "values", ",", "E_electronic", ")", ":", "ListOfIntensites", "=", "[", "]", "ListOfEnergies", "=", "[", "]", "fringe", "=", "Stack", "(", ")", "mode0", "=", "Modes", "[", "0", "]", "print", ...
Threshold is the threshold Franck-Condon after which we assign the value 0.
[ "Threshold", "is", "the", "threshold", "Franck", "-", "Condon", "after", "which", "we", "assign", "the", "value", "0", "." ]
[ "\"\"\" Threshold is the threshold Franck-Condon after which we assign the value 0. \n Modes is a list of modes.\n values is a list of values the modes can have (e.g. n = 0,1,2,3)\n\n Returns a tuple (ListOfEnergies, ListOfIntensities).\n \"\"\"", "# print \"NumModes =\", len(Modes), \"nex...
[ { "param": "threshold", "type": null }, { "param": "Modes", "type": null }, { "param": "values", "type": null }, { "param": "E_electronic", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "threshold", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Modes", "type": null, "docstring": null, "docstring_toke...
c414abe71c5345c944578a43ce4fae2677746711
binggu56/lime
lime/ToBeErased/FranckCondon/ThreeModes.py
[ "MIT" ]
Python
genMultiModeIntensities
<not_specific>
def genMultiModeIntensities(Modes): """ Modes is a list of Mode-type objects (see Modes.py) """ # number of dimensions nModes = len(Modes) range_ns = 11 # Threshold value after which we round to 0 threshold = 10**(-16) # For example, if n would range from 0 to 4, and there were 3 modes, # ListofNs would be ...
Modes is a list of Mode-type objects (see Modes.py)
Modes is a list of Mode-type objects
[ "Modes", "is", "a", "list", "of", "Mode", "-", "type", "objects" ]
def genMultiModeIntensities(Modes): nModes = len(Modes) range_ns = 11 threshold = 10**(-16) ListOfNs = range(range_ns)*nModes; FCFactors = [] states = [] for mode in Modes: mode.computeFranckCondons(ListOfNs, threshold) listOfNs = range(range_ns) for n in listOfNs: FCn = Modes[0].FrankCondons[n] if FCn <...
[ "def", "genMultiModeIntensities", "(", "Modes", ")", ":", "nModes", "=", "len", "(", "Modes", ")", "range_ns", "=", "11", "threshold", "=", "10", "**", "(", "-", "16", ")", "ListOfNs", "=", "range", "(", "range_ns", ")", "*", "nModes", ";", "FCFactors"...
Modes is a list of Mode-type objects (see Modes.py)
[ "Modes", "is", "a", "list", "of", "Mode", "-", "type", "objects", "(", "see", "Modes", ".", "py", ")" ]
[ "\"\"\" Modes is a list of Mode-type objects (see Modes.py)\n\t\"\"\"", "# number of dimensions", "# Threshold value after which we round to 0", "# For example, if n would range from 0 to 4, and there were 3 modes, ", "# ListofNs would be [0,1,2,3,4,0,1,2,3,4,0,1,2,3,4,].", "# This is so that permutations...
[ { "param": "Modes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Modes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0e477a8238b593cbd64837762f6debcc9b507840
binggu56/lime
lime/heom/heom.py
[ "MIT" ]
Python
state_number_enumerate
null
def state_number_enumerate(dims, excitations=None, state=None, idx=0): """ An iterator that enumerate all the state number arrays (quantum numbers on the form [n1, n2, n3, ...]) for a system with dimensions given by dims. Example: >>> for state in state_number_enumerate([2,2]): >>> ...
An iterator that enumerate all the state number arrays (quantum numbers on the form [n1, n2, n3, ...]) for a system with dimensions given by dims. Example: >>> for state in state_number_enumerate([2,2]): >>> print(state) [ 0 0 ] [ 0 1 ] [ 1 0 ] [ 1 ...
An iterator that enumerate all the state number arrays (quantum numbers on the form [n1, n2, n3, ...]) for a system with dimensions given by dims.
[ "An", "iterator", "that", "enumerate", "all", "the", "state", "number", "arrays", "(", "quantum", "numbers", "on", "the", "form", "[", "n1", "n2", "n3", "...", "]", ")", "for", "a", "system", "with", "dimensions", "given", "by", "dims", "." ]
def state_number_enumerate(dims, excitations=None, state=None, idx=0): if state is None: state = np.zeros(len(dims), dtype=int) if excitations and sum(state[0:idx]) > excitations: pass elif idx == len(dims): if excitations is None: yield np.array(state) else: ...
[ "def", "state_number_enumerate", "(", "dims", ",", "excitations", "=", "None", ",", "state", "=", "None", ",", "idx", "=", "0", ")", ":", "if", "state", "is", "None", ":", "state", "=", "np", ".", "zeros", "(", "len", "(", "dims", ")", ",", "dtype"...
An iterator that enumerate all the state number arrays (quantum numbers on the form [n1, n2, n3, ...]) for a system with dimensions given by dims.
[ "An", "iterator", "that", "enumerate", "all", "the", "state", "number", "arrays", "(", "quantum", "numbers", "on", "the", "form", "[", "n1", "n2", "n3", "...", "]", ")", "for", "a", "system", "with", "dimensions", "given", "by", "dims", "." ]
[ "\"\"\"\n An iterator that enumerate all the state number arrays (quantum numbers on\n the form [n1, n2, n3, ...]) for a system with dimensions given by dims.\n\n Example:\n\n >>> for state in state_number_enumerate([2,2]):\n >>> print(state)\n [ 0 0 ]\n [ 0 1 ]\n [...
[ { "param": "dims", "type": null }, { "param": "excitations", "type": null }, { "param": "state", "type": null }, { "param": "idx", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dims", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "excitations", "type": null, "docstring": null, "docstring_tok...
0e477a8238b593cbd64837762f6debcc9b507840
binggu56/lime
lime/heom/heom.py
[ "MIT" ]
Python
_calc_matsubara_params
<not_specific>
def _calc_matsubara_params(N_exp, coup_strength, cut_freq, temperature): """ Calculate the Matsubara coefficents and frequencies Returns ------- c, nu: both list(float) """ c = [] nu = [] lam0 = coup_strength gam = cut_freq hbar = 1. beta = 1.0/temperature N_m = N_e...
Calculate the Matsubara coefficents and frequencies Returns ------- c, nu: both list(float)
Calculate the Matsubara coefficents and frequencies Returns
[ "Calculate", "the", "Matsubara", "coefficents", "and", "frequencies", "Returns" ]
def _calc_matsubara_params(N_exp, coup_strength, cut_freq, temperature): c = [] nu = [] lam0 = coup_strength gam = cut_freq hbar = 1. beta = 1.0/temperature N_m = N_exp g = 2*np.pi / (beta*hbar) for k in range(N_m): if k == 0: nu.append(gam) c.append(l...
[ "def", "_calc_matsubara_params", "(", "N_exp", ",", "coup_strength", ",", "cut_freq", ",", "temperature", ")", ":", "c", "=", "[", "]", "nu", "=", "[", "]", "lam0", "=", "coup_strength", "gam", "=", "cut_freq", "hbar", "=", "1.", "beta", "=", "1.0", "/...
Calculate the Matsubara coefficents and frequencies Returns
[ "Calculate", "the", "Matsubara", "coefficents", "and", "frequencies", "Returns" ]
[ "\"\"\"\n Calculate the Matsubara coefficents and frequencies\n\n Returns\n -------\n c, nu: both list(float)\n\n \"\"\"", "# exp_coeff = c", "# exp_freq = nu" ]
[ { "param": "N_exp", "type": null }, { "param": "coup_strength", "type": null }, { "param": "cut_freq", "type": null }, { "param": "temperature", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "N_exp", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "coup_strength", "type": null, "docstring": null, "docstring_...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
promote
<not_specific>
def promote(self, o, subspace='A'): """ promote an operator in subspace to the full Hilbert space E.g. A = A \otimes I_B """ if subspace == 'A': return kron(o, self.B.idm) elif subspace == 'B': return kron(self.A.idm, o) else: ...
promote an operator in subspace to the full Hilbert space E.g. A = A \otimes I_B
promote an operator in subspace to the full Hilbert space E.g. A = A \otimes I_B
[ "promote", "an", "operator", "in", "subspace", "to", "the", "full", "Hilbert", "space", "E", ".", "g", ".", "A", "=", "A", "\\", "otimes", "I_B" ]
def promote(self, o, subspace='A'): if subspace == 'A': return kron(o, self.B.idm) elif subspace == 'B': return kron(self.A.idm, o) else: raise ValueError('The subspace option can only be A or B.')
[ "def", "promote", "(", "self", ",", "o", ",", "subspace", "=", "'A'", ")", ":", "if", "subspace", "==", "'A'", ":", "return", "kron", "(", "o", ",", "self", ".", "B", ".", "idm", ")", "elif", "subspace", "==", "'B'", ":", "return", "kron", "(", ...
promote an operator in subspace to the full Hilbert space E.g.
[ "promote", "an", "operator", "in", "subspace", "to", "the", "full", "Hilbert", "space", "E", ".", "g", "." ]
[ "\"\"\"\n promote an operator in subspace to the full Hilbert space\n E.g. A = A \\otimes I_B\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "o", "type": null }, { "param": "subspace", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "o", "type": null, "docstring": null, "docstring_tokens": [], ...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
transform_basis
<not_specific>
def transform_basis(self, a): """ transform the operator a from the direct product basis to polariton basis Parameters ---------- a : TYPE DESCRIPTION. Returns ------- 2d array """ if self.eigvecs is None: self.ei...
transform the operator a from the direct product basis to polariton basis Parameters ---------- a : TYPE DESCRIPTION. Returns ------- 2d array
transform the operator a from the direct product basis to polariton basis Parameters a : TYPE DESCRIPTION. Returns 2d array
[ "transform", "the", "operator", "a", "from", "the", "direct", "product", "basis", "to", "polariton", "basis", "Parameters", "a", ":", "TYPE", "DESCRIPTION", ".", "Returns", "2d", "array" ]
def transform_basis(self, a): if self.eigvecs is None: self.eigenstates() return basis_transform(a, self.eigvecs)
[ "def", "transform_basis", "(", "self", ",", "a", ")", ":", "if", "self", ".", "eigvecs", "is", "None", ":", "self", ".", "eigenstates", "(", ")", "return", "basis_transform", "(", "a", ",", "self", ".", "eigvecs", ")" ]
transform the operator a from the direct product basis to polariton basis Parameters
[ "transform", "the", "operator", "a", "from", "the", "direct", "product", "basis", "to", "polariton", "basis", "Parameters" ]
[ "\"\"\"\n transform the operator a from the direct product basis to polariton basis\n\n Parameters\n ----------\n a : TYPE\n DESCRIPTION.\n\n Returns\n -------\n 2d array\n\n \"\"\"", "# raise ValueError('Call eigenstates() to compute eigvecs firs...
[ { "param": "self", "type": null }, { "param": "a", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
ham_ho
<not_specific>
def ham_ho(freq, N, ZPE=False): """ input: freq: fundamental frequency in units of Energy n : size of matrix output: h: hamiltonian of the harmonic oscillator """ if ZPE: energy = np.arange(N + 0.5) * freq else: energy = np.arange(N) * freq H = lil_m...
input: freq: fundamental frequency in units of Energy n : size of matrix output: h: hamiltonian of the harmonic oscillator
fundamental frequency in units of Energy n : size of matrix output: h: hamiltonian of the harmonic oscillator
[ "fundamental", "frequency", "in", "units", "of", "Energy", "n", ":", "size", "of", "matrix", "output", ":", "h", ":", "hamiltonian", "of", "the", "harmonic", "oscillator" ]
def ham_ho(freq, N, ZPE=False): if ZPE: energy = np.arange(N + 0.5) * freq else: energy = np.arange(N) * freq H = lil_matrix((N, N)) H.setdiag(energy) return H.tocsr()
[ "def", "ham_ho", "(", "freq", ",", "N", ",", "ZPE", "=", "False", ")", ":", "if", "ZPE", ":", "energy", "=", "np", ".", "arange", "(", "N", "+", "0.5", ")", "*", "freq", "else", ":", "energy", "=", "np", ".", "arange", "(", "N", ")", "*", "...
input: freq: fundamental frequency in units of Energy n : size of matrix output: h: hamiltonian of the harmonic oscillator
[ "input", ":", "freq", ":", "fundamental", "frequency", "in", "units", "of", "Energy", "n", ":", "size", "of", "matrix", "output", ":", "h", ":", "hamiltonian", "of", "the", "harmonic", "oscillator" ]
[ "\"\"\"\n input:\n freq: fundamental frequency in units of Energy\n n : size of matrix\n output:\n h: hamiltonian of the harmonic oscillator\n \"\"\"" ]
[ { "param": "freq", "type": null }, { "param": "N", "type": null }, { "param": "ZPE", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "freq", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "N", "type": null, "docstring": null, "docstring_tokens": [], ...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
spectrum
<not_specific>
def spectrum(self, omega): """ Fourier transform of the Gaussian pulse """ omegac = self.omegac sigma = self.sigma a = self.amplitude return a * sigma * np.sqrt(2.*np.pi) * np.exp(-(omega-omegac)**2 * sigma**2/2.)
Fourier transform of the Gaussian pulse
Fourier transform of the Gaussian pulse
[ "Fourier", "transform", "of", "the", "Gaussian", "pulse" ]
def spectrum(self, omega): omegac = self.omegac sigma = self.sigma a = self.amplitude return a * sigma * np.sqrt(2.*np.pi) * np.exp(-(omega-omegac)**2 * sigma**2/2.)
[ "def", "spectrum", "(", "self", ",", "omega", ")", ":", "omegac", "=", "self", ".", "omegac", "sigma", "=", "self", ".", "sigma", "a", "=", "self", ".", "amplitude", "return", "a", "*", "sigma", "*", "np", ".", "sqrt", "(", "2.", "*", "np", ".", ...
Fourier transform of the Gaussian pulse
[ "Fourier", "transform", "of", "the", "Gaussian", "pulse" ]
[ "\"\"\"\n Fourier transform of the Gaussian pulse\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "omega", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "omega", "type": null, "docstring": null, "docstring_tokens": ...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
vacuum
<not_specific>
def vacuum(self, sparse=True): """ get initial density matrix for cavity vacuum state """ vac = np.zeros(self.n_cav) vac[0] = 1. if sparse: return csr_matrix(vac) else: return vac
get initial density matrix for cavity vacuum state
get initial density matrix for cavity vacuum state
[ "get", "initial", "density", "matrix", "for", "cavity", "vacuum", "state" ]
def vacuum(self, sparse=True): vac = np.zeros(self.n_cav) vac[0] = 1. if sparse: return csr_matrix(vac) else: return vac
[ "def", "vacuum", "(", "self", ",", "sparse", "=", "True", ")", ":", "vac", "=", "np", ".", "zeros", "(", "self", ".", "n_cav", ")", "vac", "[", "0", "]", "=", "1.", "if", "sparse", ":", "return", "csr_matrix", "(", "vac", ")", "else", ":", "ret...
get initial density matrix for cavity vacuum state
[ "get", "initial", "density", "matrix", "for", "cavity", "vacuum", "state" ]
[ "\"\"\"\n get initial density matrix for cavity vacuum state\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "sparse", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sparse", "type": null, "docstring": null, "docstring_tokens":...
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
vacuum_dm
<not_specific>
def vacuum_dm(self): """ get initial density matrix for cavity vacuum state """ vac = np.zeros(self.n_cav) vac[0] = 1. return ket2dm(vac)
get initial density matrix for cavity vacuum state
get initial density matrix for cavity vacuum state
[ "get", "initial", "density", "matrix", "for", "cavity", "vacuum", "state" ]
def vacuum_dm(self): vac = np.zeros(self.n_cav) vac[0] = 1. return ket2dm(vac)
[ "def", "vacuum_dm", "(", "self", ")", ":", "vac", "=", "np", ".", "zeros", "(", "self", ".", "n_cav", ")", "vac", "[", "0", "]", "=", "1.", "return", "ket2dm", "(", "vac", ")" ]
get initial density matrix for cavity vacuum state
[ "get", "initial", "density", "matrix", "for", "cavity", "vacuum", "state" ]
[ "\"\"\"\n get initial density matrix for cavity vacuum state\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fb410a8ca120d64cec56d5b932b3f0c8ef4f48c5
binggu56/lime
lime/cavity.py
[ "MIT" ]
Python
Hsubspace
<not_specific>
def Hsubspace(self, g, nexc=1): ''' single-polariton Hamiltonian for N two-level molecules coupled to a single cavity mode including the ground state input: g_cav: single cavity-molecule coupling strength ''' nsites = self.nsites onsite = self.onsite ...
single-polariton Hamiltonian for N two-level molecules coupled to a single cavity mode including the ground state input: g_cav: single cavity-molecule coupling strength
single-polariton Hamiltonian for N two-level molecules coupled to a single cavity mode including the ground state single cavity-molecule coupling strength
[ "single", "-", "polariton", "Hamiltonian", "for", "N", "two", "-", "level", "molecules", "coupled", "to", "a", "single", "cavity", "mode", "including", "the", "ground", "state", "single", "cavity", "-", "molecule", "coupling", "strength" ]
def Hsubspace(self, g, nexc=1): nsites = self.nsites onsite = self.onsite omegac = self.omegac if nexc == 1: nstates = nsites + 1 + 1 dip = np.zeros((nstates, nstates)) H = np.diagflat([0.] + onsite + [omegac]) H[1:nsites+1, -1] = H[-1, 1:...
[ "def", "Hsubspace", "(", "self", ",", "g", ",", "nexc", "=", "1", ")", ":", "nsites", "=", "self", ".", "nsites", "onsite", "=", "self", ".", "onsite", "omegac", "=", "self", ".", "omegac", "if", "nexc", "==", "1", ":", "nstates", "=", "nsites", ...
single-polariton Hamiltonian for N two-level molecules coupled to a single cavity mode including the ground state
[ "single", "-", "polariton", "Hamiltonian", "for", "N", "two", "-", "level", "molecules", "coupled", "to", "a", "single", "cavity", "mode", "including", "the", "ground", "state" ]
[ "'''\n single-polariton Hamiltonian for N two-level molecules coupled to\n a single cavity mode including the ground state\n\n input:\n g_cav: single cavity-molecule coupling strength\n '''", "# number of states in the system", "# the states are respectively, |000>, |100>,...
[ { "param": "self", "type": null }, { "param": "g", "type": null }, { "param": "nexc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "g", "type": null, "docstring": null, "docstring_tokens": [], ...
0894b1143b9fefa26c62bf14beeda2616c03e718
binggu56/lime
lime/fft.py
[ "MIT" ]
Python
dft
<not_specific>
def dft(x, f, k): ''' Discrete Fourier transfrom at specified momentum ''' dx = (x[1] - x[0]).real g = np.zeros(len(k), dtype=np.complex128) for i in range(len(k)): g[i] = np.sum(f * np.exp(-1j * k[i] * x)) * dx return g
Discrete Fourier transfrom at specified momentum
Discrete Fourier transfrom at specified momentum
[ "Discrete", "Fourier", "transfrom", "at", "specified", "momentum" ]
def dft(x, f, k): dx = (x[1] - x[0]).real g = np.zeros(len(k), dtype=np.complex128) for i in range(len(k)): g[i] = np.sum(f * np.exp(-1j * k[i] * x)) * dx return g
[ "def", "dft", "(", "x", ",", "f", ",", "k", ")", ":", "dx", "=", "(", "x", "[", "1", "]", "-", "x", "[", "0", "]", ")", ".", "real", "g", "=", "np", ".", "zeros", "(", "len", "(", "k", ")", ",", "dtype", "=", "np", ".", "complex128", ...
Discrete Fourier transfrom at specified momentum
[ "Discrete", "Fourier", "transfrom", "at", "specified", "momentum" ]
[ "'''\r\n Discrete Fourier transfrom at specified momentum\r\n '''" ]
[ { "param": "x", "type": null }, { "param": "f", "type": null }, { "param": "k", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], ...
ce3740367a2f8d327452c62bfb0d8cd0e3e9318f
binggu56/lime
lime/ToBeErased/FranckCondon/Multi_Dimensional.py
[ "MIT" ]
Python
genMultiDimIntensities
<not_specific>
def genMultiDimIntensities(deltaQs, w_wn, w_primes_wn): """ w_wn must be greater than all w_primes_wn deltaQs is a list of the deltaQ for each dimension w_primes_wn is a list of the frequencies for each dimension """ # number of dimensions ndims = len(w_primes_wn) nlevels = 10 # Franck-Condon factors FCfac...
w_wn must be greater than all w_primes_wn deltaQs is a list of the deltaQ for each dimension w_primes_wn is a list of the frequencies for each dimension
w_wn must be greater than all w_primes_wn deltaQs is a list of the deltaQ for each dimension w_primes_wn is a list of the frequencies for each dimension
[ "w_wn", "must", "be", "greater", "than", "all", "w_primes_wn", "deltaQs", "is", "a", "list", "of", "the", "deltaQ", "for", "each", "dimension", "w_primes_wn", "is", "a", "list", "of", "the", "frequencies", "for", "each", "dimension" ]
def genMultiDimIntensities(deltaQs, w_wn, w_primes_wn): ndims = len(w_primes_wn) nlevels = 10 FCfactorParts = [[0]*ndims]*nlevels ground = [0, w_wn] for row in range(nlevels): for col in range(ndims): FCfactorParts[row][col] = DF.diffFreqOverlap([row, w_primes_wn[col]], ground, deltaQs[col]) FCFactors = map(...
[ "def", "genMultiDimIntensities", "(", "deltaQs", ",", "w_wn", ",", "w_primes_wn", ")", ":", "ndims", "=", "len", "(", "w_primes_wn", ")", "nlevels", "=", "10", "FCfactorParts", "=", "[", "[", "0", "]", "*", "ndims", "]", "*", "nlevels", "ground", "=", ...
w_wn must be greater than all w_primes_wn deltaQs is a list of the deltaQ for each dimension w_primes_wn is a list of the frequencies for each dimension
[ "w_wn", "must", "be", "greater", "than", "all", "w_primes_wn", "deltaQs", "is", "a", "list", "of", "the", "deltaQ", "for", "each", "dimension", "w_primes_wn", "is", "a", "list", "of", "the", "frequencies", "for", "each", "dimension" ]
[ "\"\"\" w_wn must be greater than all w_primes_wn\n\t\tdeltaQs is a list of the deltaQ for each dimension\n\t\tw_primes_wn is a list of the frequencies for each dimension\n\t\"\"\"", "# number of dimensions", "# Franck-Condon factors", "# row is the energy level we are going to (from ground), col is dimension...
[ { "param": "deltaQs", "type": null }, { "param": "w_wn", "type": null }, { "param": "w_primes_wn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "deltaQs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "w_wn", "type": null, "docstring": null, "docstring_tokens"...
c5ae62af1d53340b4f923f8755cd43426e6b8176
binggu56/lime
lime/ToBeErased/FranckCondon/DiffFreqs.py
[ "MIT" ]
Python
diffFreqOverlap
<not_specific>
def diffFreqOverlap(Ln, Lm, d): """ Ln and Lm are lists where L[0] is the state number, L[1] is the frequency in wavenumbers. d is the change in normal coordinate (in bohr) """ # If the excited state frequency (Ln[1]) is greater than the ground state # frequency (Lm[1]) then we must swa...
Ln and Lm are lists where L[0] is the state number, L[1] is the frequency in wavenumbers. d is the change in normal coordinate (in bohr)
Ln and Lm are lists where L[0] is the state number, L[1] is the frequency in wavenumbers. d is the change in normal coordinate (in bohr)
[ "Ln", "and", "Lm", "are", "lists", "where", "L", "[", "0", "]", "is", "the", "state", "number", "L", "[", "1", "]", "is", "the", "frequency", "in", "wavenumbers", ".", "d", "is", "the", "change", "in", "normal", "coordinate", "(", "in", "bohr", ")"...
def diffFreqOverlap(Ln, Lm, d): if (Ln[1] > Lm[1]): Ln, Lm = Lm, Ln n = Ln[0] m = Lm[0] wn_wavenumbers = Ln[1] wm_wavenumbers = Lm[1] wn = wn_wavenumbers/8065.5/27.2116 wm = wm_wavenumbers/8065.5/27.2116 f = wn/wm convertedQSquared = d**2 X = convertedQSquared / 2 P0 ...
[ "def", "diffFreqOverlap", "(", "Ln", ",", "Lm", ",", "d", ")", ":", "if", "(", "Ln", "[", "1", "]", ">", "Lm", "[", "1", "]", ")", ":", "Ln", ",", "Lm", "=", "Lm", ",", "Ln", "n", "=", "Ln", "[", "0", "]", "m", "=", "Lm", "[", "0", "]...
Ln and Lm are lists where L[0] is the state number, L[1] is the frequency in wavenumbers.
[ "Ln", "and", "Lm", "are", "lists", "where", "L", "[", "0", "]", "is", "the", "state", "number", "L", "[", "1", "]", "is", "the", "frequency", "in", "wavenumbers", "." ]
[ "\"\"\" Ln and Lm are lists where L[0] is the state number, L[1]\n is the frequency in wavenumbers.\n d is the change in normal coordinate (in bohr)\n \"\"\"", "# If the excited state frequency (Ln[1]) is greater than the ground state", "# frequency (Lm[1]) then we must swap Ln and Lm for the p...
[ { "param": "Ln", "type": null }, { "param": "Lm", "type": null }, { "param": "d", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "Ln", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Lm", "type": null, "docstring": null, "docstring_tokens": [], ...
c5ae62af1d53340b4f923f8755cd43426e6b8176
binggu56/lime
lime/ToBeErased/FranckCondon/DiffFreqs.py
[ "MIT" ]
Python
genIntensities
<not_specific>
def genIntensities( deltaE, deltaQ, w_wavenumbers, wprime_wavenumbers): """ wprime must be greater than w""" wprime = wprime_wavenumbers/8065.5/27.2116 w = w_wavenumbers/8065.5/27.2116 intensityFunction = lambda n: (diffFreqOverlap([n, wprime_wavenumbers], [0, w_wavenumbers], deltaQ))**2 intensities...
wprime must be greater than w
wprime must be greater than w
[ "wprime", "must", "be", "greater", "than", "w" ]
def genIntensities( deltaE, deltaQ, w_wavenumbers, wprime_wavenumbers): wprime = wprime_wavenumbers/8065.5/27.2116 w = w_wavenumbers/8065.5/27.2116 intensityFunction = lambda n: (diffFreqOverlap([n, wprime_wavenumbers], [0, w_wavenumbers], deltaQ))**2 intensities = map(intensityFunction, range(0,11)) ...
[ "def", "genIntensities", "(", "deltaE", ",", "deltaQ", ",", "w_wavenumbers", ",", "wprime_wavenumbers", ")", ":", "wprime", "=", "wprime_wavenumbers", "/", "8065.5", "/", "27.2116", "w", "=", "w_wavenumbers", "/", "8065.5", "/", "27.2116", "intensityFunction", "...
wprime must be greater than w
[ "wprime", "must", "be", "greater", "than", "w" ]
[ "\"\"\" wprime must be greater than w\"\"\"" ]
[ { "param": "deltaE", "type": null }, { "param": "deltaQ", "type": null }, { "param": "w_wavenumbers", "type": null }, { "param": "wprime_wavenumbers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "deltaE", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deltaQ", "type": null, "docstring": null, "docstring_tokens...
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
liouville_space
<not_specific>
def liouville_space(N): """ constuct liouville space out of N Hilbert space basis |ij> """ return
constuct liouville space out of N Hilbert space basis |ij>
constuct liouville space out of N Hilbert space basis |ij>
[ "constuct", "liouville", "space", "out", "of", "N", "Hilbert", "space", "basis", "|ij", ">" ]
def liouville_space(N): return
[ "def", "liouville_space", "(", "N", ")", ":", "return" ]
constuct liouville space out of N Hilbert space basis |ij>
[ "constuct", "liouville", "space", "out", "of", "N", "Hilbert", "space", "basis", "|ij", ">" ]
[ "\"\"\"\n constuct liouville space out of N Hilbert space basis |ij>\n \"\"\"" ]
[ { "param": "N", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "N", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
correlation_2op_1t
<not_specific>
def correlation_2op_1t(self, rho0, ops, tlist): """ Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function. """ a, b = ops # if self.eigvals is None: # evals, U1, U2 = self.eigenstates(k=...
Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function.
Compute by diagonalizing the Liouvillian. Returns 1D array. correlation function.
[ "Compute", "by", "diagonalizing", "the", "Liouvillian", ".", "Returns", "1D", "array", ".", "correlation", "function", "." ]
def correlation_2op_1t(self, rho0, ops, tlist): a, b = ops evals, U1, U2 = self.eigvals, self.right_eigvecs, self.left_eigvecs k = U1.shape[-1] norm = self.norm idv = self.idv cor = np.zeros(len(tlist), dtype=complex) coeff = np.array([np.vdot(idv, left(a).dot(U1[...
[ "def", "correlation_2op_1t", "(", "self", ",", "rho0", ",", "ops", ",", "tlist", ")", ":", "a", ",", "b", "=", "ops", "evals", ",", "U1", ",", "U2", "=", "self", ".", "eigvals", ",", "self", ".", "right_eigvecs", ",", "self", ".", "left_eigvecs", "...
Compute <A(t)B> by diagonalizing the Liouvillian.
[ "Compute", "<A", "(", "t", ")", "B", ">", "by", "diagonalizing", "the", "Liouvillian", "." ]
[ "\"\"\"\n Compute <A(t)B> by diagonalizing the Liouvillian.\n\n Returns\n -------\n 1D array.\n correlation function.\n\n \"\"\"", "# if self.eigvals is None:", "# evals, U1, U2 = self.eigenstates(k=k)", "# else:", "# if k is None:", "# k = self.dim", ...
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "tlist", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
correlation_3op_1t
<not_specific>
def correlation_3op_1t(self, rho0, ops, t): """ Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function. """ a, b, c = ops evals, U1, U2 = self.eigvals, self.right_eigvecs, self.left_eigvecs ...
Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function.
Compute by diagonalizing the Liouvillian. Returns 1D array. correlation function.
[ "Compute", "by", "diagonalizing", "the", "Liouvillian", ".", "Returns", "1D", "array", ".", "correlation", "function", "." ]
def correlation_3op_1t(self, rho0, ops, t): a, b, c = ops evals, U1, U2 = self.eigvals, self.right_eigvecs, self.left_eigvecs k = U1.shape[-1] norm = self.norm idv = self.idv cor = np.zeros(len(t), dtype=complex) coeff = np.array([np.vdot(idv, left(b).dot(U1[:,n])...
[ "def", "correlation_3op_1t", "(", "self", ",", "rho0", ",", "ops", ",", "t", ")", ":", "a", ",", "b", ",", "c", "=", "ops", "evals", ",", "U1", ",", "U2", "=", "self", ".", "eigvals", ",", "self", ".", "right_eigvecs", ",", "self", ".", "left_eig...
Compute <A(t)B> by diagonalizing the Liouvillian.
[ "Compute", "<A", "(", "t", ")", "B", ">", "by", "diagonalizing", "the", "Liouvillian", "." ]
[ "\"\"\"\n Compute <A(t)B> by diagonalizing the Liouvillian.\n\n Returns\n -------\n 1D array.\n correlation function.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "t", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
correlation_3op_1w
<not_specific>
def correlation_3op_1w(self, rho0, ops, w): """ Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function. """ a, b, c = ops evals, U1, U2 = self.eigvals, self.right_eigvecs, self.left_eigvecs ...
Compute <A(t)B> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function.
Compute by diagonalizing the Liouvillian. Returns 1D array. correlation function.
[ "Compute", "by", "diagonalizing", "the", "Liouvillian", ".", "Returns", "1D", "array", ".", "correlation", "function", "." ]
def correlation_3op_1w(self, rho0, ops, w): a, b, c = ops evals, U1, U2 = self.eigvals, self.right_eigvecs, self.left_eigvecs k = U1.shape[-1] norm = self.norm idv = self.idv cor = np.zeros(len(w), dtype=complex) coeff = np.array([np.vdot(idv, left(b).dot(U1[:,n])...
[ "def", "correlation_3op_1w", "(", "self", ",", "rho0", ",", "ops", ",", "w", ")", ":", "a", ",", "b", ",", "c", "=", "ops", "evals", ",", "U1", ",", "U2", "=", "self", ".", "eigvals", ",", "self", ".", "right_eigvecs", ",", "self", ".", "left_eig...
Compute <A(t)B> by diagonalizing the Liouvillian.
[ "Compute", "<A", "(", "t", ")", "B", ">", "by", "diagonalizing", "the", "Liouvillian", "." ]
[ "\"\"\"\n Compute <A(t)B> by diagonalizing the Liouvillian.\n\n Returns\n -------\n 1D array.\n correlation function.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "w", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
correlation_3op_2t
<not_specific>
def correlation_3op_2t(self, rho0, ops, tlist, taulist, k=None): """ Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function. """ a, b, c = ops rho0 = operator_to_vector(rho0) cor =...
Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function.
Compute by diagonalizing the Liouvillian. Returns 1D array. correlation function.
[ "Compute", "by", "diagonalizing", "the", "Liouvillian", ".", "Returns", "1D", "array", ".", "correlation", "function", "." ]
def correlation_3op_2t(self, rho0, ops, tlist, taulist, k=None): a, b, c = ops rho0 = operator_to_vector(rho0) cor = np.zeros((len(tlist), len(taulist)), dtype=complex) evals = self.eigvals U1 = self.right_eigvecs U2 = self.left_eigvecs if k is None: k...
[ "def", "correlation_3op_2t", "(", "self", ",", "rho0", ",", "ops", ",", "tlist", ",", "taulist", ",", "k", "=", "None", ")", ":", "a", ",", "b", ",", "c", "=", "ops", "rho0", "=", "operator_to_vector", "(", "rho0", ")", "cor", "=", "np", ".", "ze...
Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian.
[ "Compute", "<A", "(", "t", ")", "B", "(", "t", "+", "tau", ")", "C", "(", "t", ")", ">", "by", "diagonalizing", "the", "Liouvillian", "." ]
[ "\"\"\"\n Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian.\n\n Returns\n -------\n 1D array.\n correlation function.\n\n \"\"\"", "# diagonalize the Liouvillian", "# evals, U1, U2 = self.eigenstates(k=k)", "# assert(np.allclose(evals1, evals2.conj()))"...
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "tlist", "type": null }, { "param": "taulist", "type": null }, { "param": "k", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
1c40fcbd5a8dba2b2a356b28ee8871a2e93137ee
binggu56/lime
lime/superoperator.py
[ "MIT" ]
Python
correlation_4op_2t
<not_specific>
def correlation_4op_2t(self, rho0, ops, tlist, taulist, k=None): """ Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function. """ if len(ops) != 4: raise ValueError('Number of operators ...
Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian. Returns ------- 1D array. correlation function.
Compute by diagonalizing the Liouvillian. Returns 1D array. correlation function.
[ "Compute", "by", "diagonalizing", "the", "Liouvillian", ".", "Returns", "1D", "array", ".", "correlation", "function", "." ]
def correlation_4op_2t(self, rho0, ops, tlist, taulist, k=None): if len(ops) != 4: raise ValueError('Number of operators is not 4.') else: a, b, c, d = ops corr = self.correlation_3op_2t(rho0=rho0, ops=[a, b@c, d], tlist=tlist, \ tau...
[ "def", "correlation_4op_2t", "(", "self", ",", "rho0", ",", "ops", ",", "tlist", ",", "taulist", ",", "k", "=", "None", ")", ":", "if", "len", "(", "ops", ")", "!=", "4", ":", "raise", "ValueError", "(", "'Number of operators is not 4.'", ")", "else", ...
Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian.
[ "Compute", "<A", "(", "t", ")", "B", "(", "t", "+", "tau", ")", "C", "(", "t", ")", ">", "by", "diagonalizing", "the", "Liouvillian", "." ]
[ "\"\"\"\n Compute <A(t)B(t+tau)C(t)> by diagonalizing the Liouvillian.\n\n Returns\n -------\n 1D array.\n correlation function.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "tlist", "type": null }, { "param": "taulist", "type": null }, { "param": "k", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
1c457bc8969abfb76d85c1df6226dd8f0956c564
binggu56/lime
lime/optics.py
[ "MIT" ]
Python
spectrum
<not_specific>
def spectrum(self, omega): """ Fourier transform of the Gaussian pulse """ omega0 = self.omegac T = self.tau A0 = self.amplitude beta = self.beta # if beta is None: # return A0 * sigma * np.sqrt(2.*np.pi) * np.exp(-(omega-omega0)**2 * sigma**2/2...
Fourier transform of the Gaussian pulse
Fourier transform of the Gaussian pulse
[ "Fourier", "transform", "of", "the", "Gaussian", "pulse" ]
def spectrum(self, omega): omega0 = self.omegac T = self.tau A0 = self.amplitude beta = self.beta a = 0.5/T**2 + 1j * beta * omega0/T return A0 * np.sqrt(np.pi/a) * np.exp(-(omega - omega0)**2/4./a)
[ "def", "spectrum", "(", "self", ",", "omega", ")", ":", "omega0", "=", "self", ".", "omegac", "T", "=", "self", ".", "tau", "A0", "=", "self", ".", "amplitude", "beta", "=", "self", ".", "beta", "a", "=", "0.5", "/", "T", "**", "2", "+", "1j", ...
Fourier transform of the Gaussian pulse
[ "Fourier", "transform", "of", "the", "Gaussian", "pulse" ]
[ "\"\"\"\n Fourier transform of the Gaussian pulse\n \"\"\"", "# if beta is None:", "# return A0 * sigma * np.sqrt(2.*np.pi) * np.exp(-(omega-omega0)**2 * sigma**2/2.)", "# else:" ]
[ { "param": "self", "type": null }, { "param": "omega", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "omega", "type": null, "docstring": null, "docstring_tokens": ...
1c457bc8969abfb76d85c1df6226dd8f0956c564
binggu56/lime
lime/optics.py
[ "MIT" ]
Python
detect
<not_specific>
def detect(self): """ two-photon detection amplitude in a temporal grid defined by the spectral grid. Returns ------- t1: 1d array t2: 1d array d: detection amplitude in the temporal grid (t1, t2) """ if self.jsa is None: rai...
two-photon detection amplitude in a temporal grid defined by the spectral grid. Returns ------- t1: 1d array t2: 1d array d: detection amplitude in the temporal grid (t1, t2)
two-photon detection amplitude in a temporal grid defined by the spectral grid. Returns 1d array t2: 1d array d: detection amplitude in the temporal grid (t1, t2)
[ "two", "-", "photon", "detection", "amplitude", "in", "a", "temporal", "grid", "defined", "by", "the", "spectral", "grid", ".", "Returns", "1d", "array", "t2", ":", "1d", "array", "d", ":", "detection", "amplitude", "in", "the", "temporal", "grid", "(", ...
def detect(self): if self.jsa is None: raise ValueError('Please call get_jsa() to compute the jsa first.') bw = self.pump_bandwidth omega_s = self.signal_center_frequency omega_i = self.idler_center_frequency p = self.p q = self.q dp = p[1] - p[0] ...
[ "def", "detect", "(", "self", ")", ":", "if", "self", ".", "jsa", "is", "None", ":", "raise", "ValueError", "(", "'Please call get_jsa() to compute the jsa first.'", ")", "bw", "=", "self", ".", "pump_bandwidth", "omega_s", "=", "self", ".", "signal_center_frequ...
two-photon detection amplitude in a temporal grid defined by the spectral grid.
[ "two", "-", "photon", "detection", "amplitude", "in", "a", "temporal", "grid", "defined", "by", "the", "spectral", "grid", "." ]
[ "\"\"\"\n two-photon detection amplitude in a temporal grid defined by\n the spectral grid.\n\n Returns\n -------\n t1: 1d array\n t2: 1d array\n d: detection amplitude in the temporal grid (t1, t2)\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1c457bc8969abfb76d85c1df6226dd8f0956c564
binggu56/lime
lime/optics.py
[ "MIT" ]
Python
schmidt_decompose
<not_specific>
def schmidt_decompose(f, dp, dq, nmodes=5, method='rdm'): """ kernel method f: 2D array, input function to be decomposed nmodes: int number of modes to be kept method: str rdm or svd """ if method == 'rdm': kernel1 = f.dot(dag(f)) * dq * dp kernel2 = f...
kernel method f: 2D array, input function to be decomposed nmodes: int number of modes to be kept method: str rdm or svd
kernel method f: 2D array, input function to be decomposed nmodes: int number of modes to be kept method: str rdm or svd
[ "kernel", "method", "f", ":", "2D", "array", "input", "function", "to", "be", "decomposed", "nmodes", ":", "int", "number", "of", "modes", "to", "be", "kept", "method", ":", "str", "rdm", "or", "svd" ]
def schmidt_decompose(f, dp, dq, nmodes=5, method='rdm'): if method == 'rdm': kernel1 = f.dot(dag(f)) * dq * dp kernel2 = f.T.dot(f.conj()) * dp * dq print('c: Schmidt coefficients') s, phi = np.linalg.eig(kernel1) s1, psi = np.linalg.eig(kernel2) phi /= np.sqrt(dp) ...
[ "def", "schmidt_decompose", "(", "f", ",", "dp", ",", "dq", ",", "nmodes", "=", "5", ",", "method", "=", "'rdm'", ")", ":", "if", "method", "==", "'rdm'", ":", "kernel1", "=", "f", ".", "dot", "(", "dag", "(", "f", ")", ")", "*", "dq", "*", "...
kernel method f: 2D array, input function to be decomposed nmodes: int number of modes to be kept method: str rdm or svd
[ "kernel", "method", "f", ":", "2D", "array", "input", "function", "to", "be", "decomposed", "nmodes", ":", "int", "number", "of", "modes", "to", "be", "kept", "method", ":", "str", "rdm", "or", "svd" ]
[ "\"\"\"\n kernel method\n f: 2D array,\n input function to be decomposed\n nmodes: int\n number of modes to be kept\n method: str\n rdm or svd\n \"\"\"" ]
[ { "param": "f", "type": null }, { "param": "dp", "type": null }, { "param": "dq", "type": null }, { "param": "nmodes", "type": null }, { "param": "method", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "f", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dp", "type": null, "docstring": null, "docstring_tokens": [], ...
64a7a76f6ad9201e87ea7be31392ecec6765103c
binggu56/lime
lime/signal/sos.py
[ "MIT" ]
Python
TPA2D
<not_specific>
def TPA2D(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma): """ 2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1 """ g = 0 signal = np.zeros((len(omegaps), len(omega1s))) for i, omegap in enumerate(omegaps): for j, omega1 in e...
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
[ "2D", "two", "-", "photon", "-", "absorption", "signal", "with", "classical", "light", "scanning", "the", "omegap", "=", "omega1", "+", "omega2", "and", "omega1" ]
def TPA2D(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma): g = 0 signal = np.zeros((len(omegaps), len(omega1s))) for i, omegap in enumerate(omegaps): for j, omega1 in enumerate(omega1s): omega2 = omegap - omega1 for f in f_idx: tmp = 0. f...
[ "def", "TPA2D", "(", "E", ",", "dip", ",", "omegaps", ",", "omega1s", ",", "g_idx", ",", "e_idx", ",", "f_idx", ",", "gamma", ")", ":", "g", "=", "0", "signal", "=", "np", ".", "zeros", "(", "(", "len", "(", "omegaps", ")", ",", "len", "(", "...
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
[ "2D", "two", "-", "photon", "-", "absorption", "signal", "with", "classical", "light", "scanning", "the", "omegap", "=", "omega1", "+", "omega2", "and", "omega1" ]
[ "\"\"\"\n 2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1\n \"\"\"" ]
[ { "param": "E", "type": null }, { "param": "dip", "type": null }, { "param": "omegaps", "type": null }, { "param": "omega1s", "type": null }, { "param": "g_idx", "type": null }, { "param": "e_idx", "type": null }, { "param": "f_idx", "t...
{ "returns": [], "raises": [], "params": [ { "identifier": "E", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dip", "type": null, "docstring": null, "docstring_tokens": [], ...
64a7a76f6ad9201e87ea7be31392ecec6765103c
binggu56/lime
lime/signal/sos.py
[ "MIT" ]
Python
TPA2D_time_order
<not_specific>
def TPA2D_time_order(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma): """ 2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1 """ g = 0 signal = np.zeros((len(omegaps), len(omega1s))) for i in range(len(omegaps)): omegap = omega...
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
[ "2D", "two", "-", "photon", "-", "absorption", "signal", "with", "classical", "light", "scanning", "the", "omegap", "=", "omega1", "+", "omega2", "and", "omega1" ]
def TPA2D_time_order(E, dip, omegaps, omega1s, g_idx, e_idx, f_idx, gamma): g = 0 signal = np.zeros((len(omegaps), len(omega1s))) for i in range(len(omegaps)): omegap = omegaps[i] for j in range(len(omega1s)): omega1 = omega1s[j] omega2 = omegap - omega1 ...
[ "def", "TPA2D_time_order", "(", "E", ",", "dip", ",", "omegaps", ",", "omega1s", ",", "g_idx", ",", "e_idx", ",", "f_idx", ",", "gamma", ")", ":", "g", "=", "0", "signal", "=", "np", ".", "zeros", "(", "(", "len", "(", "omegaps", ")", ",", "len",...
2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1
[ "2D", "two", "-", "photon", "-", "absorption", "signal", "with", "classical", "light", "scanning", "the", "omegap", "=", "omega1", "+", "omega2", "and", "omega1" ]
[ "\"\"\"\n 2D two-photon-absorption signal with classical light scanning the omegap = omega1 + omega2 and omega1\n \"\"\"" ]
[ { "param": "E", "type": null }, { "param": "dip", "type": null }, { "param": "omegaps", "type": null }, { "param": "omega1s", "type": null }, { "param": "g_idx", "type": null }, { "param": "e_idx", "type": null }, { "param": "f_idx", "t...
{ "returns": [], "raises": [], "params": [ { "identifier": "E", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dip", "type": null, "docstring": null, "docstring_tokens": [], ...
64a7a76f6ad9201e87ea7be31392ecec6765103c
binggu56/lime
lime/signal/sos.py
[ "MIT" ]
Python
_etpa
<not_specific>
def _etpa(omegaps, Es, edip, jta, t1, t2, g_idx, e_idx, f_idx): """ internal function to compute the ETPA signal. The double time integrals are computed numerically. Parameters ---------- omegaps: pump center frequencies Es: eigenenergies edip: electric dipole operator jta: 2d arra...
internal function to compute the ETPA signal. The double time integrals are computed numerically. Parameters ---------- omegaps: pump center frequencies Es: eigenenergies edip: electric dipole operator jta: 2d array joint temporal amplitude t1: 1d array t2: 1d array ...
internal function to compute the ETPA signal. The double time integrals are computed numerically. Parameters Returns 1d array
[ "internal", "function", "to", "compute", "the", "ETPA", "signal", ".", "The", "double", "time", "integrals", "are", "computed", "numerically", ".", "Parameters", "Returns", "1d", "array" ]
def _etpa(omegaps, Es, edip, jta, t1, t2, g_idx, e_idx, f_idx): T1, T2 = np.meshgrid(t1, t2) theta = heaviside(T2 - T1, 0.5) signal = np.zeros(len(omegaps), dtype=complex) g = g_idx for j, omegap in enumerate(omegaps): omega1 = omega2 = omegap/2. for f in f_idx: for e i...
[ "def", "_etpa", "(", "omegaps", ",", "Es", ",", "edip", ",", "jta", ",", "t1", ",", "t2", ",", "g_idx", ",", "e_idx", ",", "f_idx", ")", ":", "T1", ",", "T2", "=", "np", ".", "meshgrid", "(", "t1", ",", "t2", ")", "theta", "=", "heaviside", "...
internal function to compute the ETPA signal.
[ "internal", "function", "to", "compute", "the", "ETPA", "signal", "." ]
[ "\"\"\"\n internal function to compute the ETPA signal.\n\n The double time integrals are computed numerically.\n\n Parameters\n ----------\n omegaps: pump center frequencies\n Es: eigenenergies\n edip: electric dipole operator\n jta: 2d array\n joint temporal amplitude\n t1: 1d ar...
[ { "param": "omegaps", "type": null }, { "param": "Es", "type": null }, { "param": "edip", "type": null }, { "param": "jta", "type": null }, { "param": "t1", "type": null }, { "param": "t2", "type": null }, { "param": "g_idx", "type": nu...
{ "returns": [], "raises": [], "params": [ { "identifier": "omegaps", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Es", "type": null, "docstring": null, "docstring_tokens": ...
4a51424c621bc0084ef92546c5bc383c5a7132c6
binggu56/lime
lime/SPO/SPO_1D.py
[ "MIT" ]
Python
adiabatic_1d
<not_specific>
def adiabatic_1d(x, v, psi0, dt, Nt=1, t0=0.): """ Time-dependent Schrodinger Equation for wavepackets on a single PES. Parameters ---------- psi0: 1d array, complex initial wavepacket t0: float initial time dt : float the small time interval over which to integrate ...
Time-dependent Schrodinger Equation for wavepackets on a single PES. Parameters ---------- psi0: 1d array, complex initial wavepacket t0: float initial time dt : float the small time interval over which to integrate nt : float, optional the number of interva...
Time-dependent Schrodinger Equation for wavepackets on a single PES. Parameters 1d array, complex initial wavepacket t0: float initial time dt : float the small time interval over which to integrate nt : float, optional the number of intervals to compute. The total change in time at the end of this method will be dt ...
[ "Time", "-", "dependent", "Schrodinger", "Equation", "for", "wavepackets", "on", "a", "single", "PES", ".", "Parameters", "1d", "array", "complex", "initial", "wavepacket", "t0", ":", "float", "initial", "time", "dt", ":", "float", "the", "small", "time", "i...
def adiabatic_1d(x, v, psi0, dt, Nt=1, t0=0.): f = open('density_matrix.dat', 'w') t = t0 psi_x = psi0.copy() dt2 = 0.5 * dt N = len(x) dx = interval(x) k = 2. * pi * scipy.fftpack.fftfreq(N, dx) x_evolve(dt2, x, v, psi_x) for i in range(nt - 1): t += dt psi_x = k_evo...
[ "def", "adiabatic_1d", "(", "x", ",", "v", ",", "psi0", ",", "dt", ",", "Nt", "=", "1", ",", "t0", "=", "0.", ")", ":", "f", "=", "open", "(", "'density_matrix.dat'", ",", "'w'", ")", "t", "=", "t0", "psi_x", "=", "psi0", ".", "copy", "(", ")...
Time-dependent Schrodinger Equation for wavepackets on a single PES.
[ "Time", "-", "dependent", "Schrodinger", "Equation", "for", "wavepackets", "on", "a", "single", "PES", "." ]
[ "\"\"\"\n Time-dependent Schrodinger Equation for wavepackets on a single PES.\n\n Parameters\n ----------\n psi0: 1d array, complex\n initial wavepacket\n t0: float\n initial time\n dt : float\n the small time interval over which to integrate\n nt : float, optional\n ...
[ { "param": "x", "type": null }, { "param": "v", "type": null }, { "param": "psi0", "type": null }, { "param": "dt", "type": null }, { "param": "Nt", "type": null }, { "param": "t0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], ...
4a51424c621bc0084ef92546c5bc383c5a7132c6
binggu56/lime
lime/SPO/SPO_1D.py
[ "MIT" ]
Python
gauss_x
<not_specific>
def gauss_x(x, a, x0, k0): """ a gaussian wave packet of width a, centered at x0, with momentum k0 """ return (a/np.sqrt(np.pi))**(-0.25)*\ np.exp(-0.5 * a * (x - x0)**2 + 1j * (x-x0) * k0)
a gaussian wave packet of width a, centered at x0, with momentum k0
a gaussian wave packet of width a, centered at x0, with momentum k0
[ "a", "gaussian", "wave", "packet", "of", "width", "a", "centered", "at", "x0", "with", "momentum", "k0" ]
def gauss_x(x, a, x0, k0): return (a/np.sqrt(np.pi))**(-0.25)*\ np.exp(-0.5 * a * (x - x0)**2 + 1j * (x-x0) * k0)
[ "def", "gauss_x", "(", "x", ",", "a", ",", "x0", ",", "k0", ")", ":", "return", "(", "a", "/", "np", ".", "sqrt", "(", "np", ".", "pi", ")", ")", "**", "(", "-", "0.25", ")", "*", "np", ".", "exp", "(", "-", "0.5", "*", "a", "*", "(", ...
a gaussian wave packet of width a, centered at x0, with momentum k0
[ "a", "gaussian", "wave", "packet", "of", "width", "a", "centered", "at", "x0", "with", "momentum", "k0" ]
[ "\"\"\"\n a gaussian wave packet of width a, centered at x0, with momentum k0\n \"\"\"" ]
[ { "param": "x", "type": null }, { "param": "a", "type": null }, { "param": "x0", "type": null }, { "param": "k0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
4a51424c621bc0084ef92546c5bc383c5a7132c6
binggu56/lime
lime/SPO/SPO_1D.py
[ "MIT" ]
Python
gauss_k
<not_specific>
def gauss_k(k,a,x0,k0): """ analytical fourier transform of gauss_x(x), above """ return ((a / np.sqrt(np.pi))**0.5 * np.exp(-0.5 * (a * (k - k0)) ** 2 - 1j * (k - k0) * x0))
analytical fourier transform of gauss_x(x), above
analytical fourier transform of gauss_x(x), above
[ "analytical", "fourier", "transform", "of", "gauss_x", "(", "x", ")", "above" ]
def gauss_k(k,a,x0,k0): return ((a / np.sqrt(np.pi))**0.5 * np.exp(-0.5 * (a * (k - k0)) ** 2 - 1j * (k - k0) * x0))
[ "def", "gauss_k", "(", "k", ",", "a", ",", "x0", ",", "k0", ")", ":", "return", "(", "(", "a", "/", "np", ".", "sqrt", "(", "np", ".", "pi", ")", ")", "**", "0.5", "*", "np", ".", "exp", "(", "-", "0.5", "*", "(", "a", "*", "(", "k", ...
analytical fourier transform of gauss_x(x), above
[ "analytical", "fourier", "transform", "of", "gauss_x", "(", "x", ")", "above" ]
[ "\"\"\"\n analytical fourier transform of gauss_x(x), above\n \"\"\"" ]
[ { "param": "k", "type": null }, { "param": "a", "type": null }, { "param": "x0", "type": null }, { "param": "k0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "k", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
e1d31efa0d3f572457a66ca3075d4e6fc84c4ef6
binggu56/lime
lime/noise.py
[ "MIT" ]
Python
corr
<not_specific>
def corr(eps): """ calculate the autocorrelation function in variable MEAN. """ f = open('corr.out') nstep, nsample = eps.shape cor = np.zeros(nstep) npts = nstep * nsample for idly in range(nstep): mean = 0.0 std = 0. for i in range(nsample):# i=1,nrea...
calculate the autocorrelation function in variable MEAN.
calculate the autocorrelation function in variable MEAN.
[ "calculate", "the", "autocorrelation", "function", "in", "variable", "MEAN", "." ]
def corr(eps): f = open('corr.out') nstep, nsample = eps.shape cor = np.zeros(nstep) npts = nstep * nsample for idly in range(nstep): mean = 0.0 std = 0. for i in range(nsample): for j in range(nstep - idly): mean += eps[j,i] * eps[j+idly, i] ...
[ "def", "corr", "(", "eps", ")", ":", "f", "=", "open", "(", "'corr.out'", ")", "nstep", ",", "nsample", "=", "eps", ".", "shape", "cor", "=", "np", ".", "zeros", "(", "nstep", ")", "npts", "=", "nstep", "*", "nsample", "for", "idly", "in", "range...
calculate the autocorrelation function in variable MEAN.
[ "calculate", "the", "autocorrelation", "function", "in", "variable", "MEAN", "." ]
[ "\"\"\"\n calculate the autocorrelation function in variable MEAN.\n \"\"\"", "# i=1,nreal" ]
[ { "param": "eps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "eps", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e1d31efa0d3f572457a66ca3075d4e6fc84c4ef6
binggu56/lime
lime/noise.py
[ "MIT" ]
Python
cross_corr
<not_specific>
def cross_corr(a, b): """ calculate the cross-correlation function in variable MEAN. """ f = open('corr.out') nstep, nsample = a.shape cor = np.zeros(nstep) npts = nstep * nsample for idly in range(nstep): mean = 0.0 std = 0. for i in range(nsample)...
calculate the cross-correlation function in variable MEAN.
calculate the cross-correlation function in variable MEAN.
[ "calculate", "the", "cross", "-", "correlation", "function", "in", "variable", "MEAN", "." ]
def cross_corr(a, b): f = open('corr.out') nstep, nsample = a.shape cor = np.zeros(nstep) npts = nstep * nsample for idly in range(nstep): mean = 0.0 std = 0. for i in range(nsample): for j in range(nstep - idly): mean += a[j,i] * b[j+idly, i] ...
[ "def", "cross_corr", "(", "a", ",", "b", ")", ":", "f", "=", "open", "(", "'corr.out'", ")", "nstep", ",", "nsample", "=", "a", ".", "shape", "cor", "=", "np", ".", "zeros", "(", "nstep", ")", "npts", "=", "nstep", "*", "nsample", "for", "idly", ...
calculate the cross-correlation function in variable MEAN.
[ "calculate", "the", "cross", "-", "correlation", "function", "in", "variable", "MEAN", "." ]
[ "\"\"\"\n calculate the cross-correlation function in variable MEAN.\n \"\"\"", "# i=1,nreal", "#smean=sngl(mean) #single precision speeds up calculations" ]
[ { "param": "a", "type": null }, { "param": "b", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "b", "type": null, "docstring": null, "docstring_tokens": [], ...
1e82132a0aef54f5e288cf4b2c51f2c1848aef3e
binggu56/lime
lime/spo/SPO_1D_NAMD.py
[ "MIT" ]
Python
evolve
<not_specific>
def evolve(x, v, psi0, dt, nt=1, t0=0.): """ Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total c...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change in time at the end of this method ...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change in time at the end of this method will be dt * Nsteps. default is N = 1
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", ".", "Parameters", "dt", ":", "float", "the", "small", "time", "interval", "over", "which", "to", "integrate", "Nsteps", ":", "float", ...
def evolve(x, v, psi0, dt, nt=1, t0=0.): f = open('density_matrix.dat', 'w') t = t0 psi_x = psi0 dt2 = 0.5 * dt N = len(x) dx = interval(x) k = scipy.fftpack.fftfreq(N, dx) k[:] = 2.0 * np.pi * k[:] x_evolve(dt2, x, v, psi_x) for i in range(nt - 1): t += dt k_evol...
[ "def", "evolve", "(", "x", ",", "v", ",", "psi0", ",", "dt", ",", "nt", "=", "1", ",", "t0", "=", "0.", ")", ":", "f", "=", "open", "(", "'density_matrix.dat'", ",", "'w'", ")", "t", "=", "t0", "psi_x", "=", "psi0", "dt2", "=", "0.5", "*", ...
Perform a series of time-steps via the time-dependent Schrodinger Equation.
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", "." ]
[ "\"\"\"\n Perform a series of time-steps via the time-dependent\n Schrodinger Equation.\n\n Parameters\n ----------\n dt : float\n the small time interval over which to integrate\n Nsteps : float, optional\n the number of intervals to compute. The total change\n in time at th...
[ { "param": "x", "type": null }, { "param": "v", "type": null }, { "param": "psi0", "type": null }, { "param": "dt", "type": null }, { "param": "nt", "type": null }, { "param": "t0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], ...
66be4f3f43531795cdbde307cf8f71ca6a50a0b7
binggu56/lime
lime/ToBeErased/FranckCondon/Grapher.py
[ "MIT" ]
Python
makeOverlapGraph
<not_specific>
def makeOverlapGraph(ListOfLns, Lm, f, extraTitle): """ Returns a figure containing a plot of f(n,m). ListOfLns is a list of lists Ln such that Ln[0] = n, Ln[1] = wn_wavenumbers Lm is a list such that Lm such that Lm[0] = m, Lm[1] - wm_wavenumbers f is the function to be plotted that takes L...
Returns a figure containing a plot of f(n,m). ListOfLns is a list of lists Ln such that Ln[0] = n, Ln[1] = wn_wavenumbers Lm is a list such that Lm such that Lm[0] = m, Lm[1] - wm_wavenumbers f is the function to be plotted that takes Ln and Lm as inputs extraTitle is a string of extra ...
Returns a figure containing a plot of f(n,m). ListOfLns is a list of lists Ln such that Ln[0] = n, Ln[1] = wn_wavenumbers Lm is a list such that Lm such that Lm[0] = m, Lm[1] - wm_wavenumbers f is the function to be plotted that takes Ln and Lm as inputs extraTitle is a string of extra text to be included in the graph'...
[ "Returns", "a", "figure", "containing", "a", "plot", "of", "f", "(", "n", "m", ")", ".", "ListOfLns", "is", "a", "list", "of", "lists", "Ln", "such", "that", "Ln", "[", "0", "]", "=", "n", "Ln", "[", "1", "]", "=", "wn_wavenumbers", "Lm", "is", ...
def makeOverlapGraph(ListOfLns, Lm, f, extraTitle): xpoints = [L[0] for L in ListOfLns] f_OneInput = lambda Ln : f(Ln, Lm) ypoints = map(f_OneInput, ListOfLns) fig = plt.figure() ax = fig.add_subplot(111) ax.set_title("<n|"+ str(Lm[0])+ "> "+ extraTitle) ax.set_xlabel("n") ax.set_ylabel...
[ "def", "makeOverlapGraph", "(", "ListOfLns", ",", "Lm", ",", "f", ",", "extraTitle", ")", ":", "xpoints", "=", "[", "L", "[", "0", "]", "for", "L", "in", "ListOfLns", "]", "f_OneInput", "=", "lambda", "Ln", ":", "f", "(", "Ln", ",", "Lm", ")", "y...
Returns a figure containing a plot of f(n,m).
[ "Returns", "a", "figure", "containing", "a", "plot", "of", "f", "(", "n", "m", ")", "." ]
[ "\"\"\" Returns a figure containing a plot of f(n,m).\n ListOfLns is a list of lists Ln such that Ln[0] = n, Ln[1] = wn_wavenumbers\n Lm is a list such that Lm such that Lm[0] = m, Lm[1] - wm_wavenumbers\n f is the function to be plotted that takes Ln and Lm as inputs\n extraTitle is a s...
[ { "param": "ListOfLns", "type": null }, { "param": "Lm", "type": null }, { "param": "f", "type": null }, { "param": "extraTitle", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ListOfLns", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Lm", "type": null, "docstring": null, "docstring_tokens"...
17bec732c61facc4bc200cd14ed94312a778ce79
binggu56/lime
lime/models/pyrazine.py
[ "MIT" ]
Python
polariton_hamiltonian
<not_specific>
def polariton_hamiltonian(n_el, n_vc, n_vt, cav, g): """ contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space """ #n_basis = n_el * n_cav * n_vc * n_vt freq_vc = 952. * wavenumber2hartree freq_vt = 597. * wavenumber2hartree ...
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
[ "contruct", "vibronic", "-", "cavity", "basis", "for", "polaritonic", "states", "that", "is", "a", "direct", "product", "of", "electron", "-", "vibration", "-", "photon", "space" ]
def polariton_hamiltonian(n_el, n_vc, n_vt, cav, g): freq_vc = 952. * wavenumber2hartree freq_vt = 597. * wavenumber2hartree Eshift = np.array([0.0, 31800.0, 39000]) * wavenumber2hartree kappa = np.array([0.0, -847.0, 1202.]) * wavenumber2hartree coup = 2110.0 * wavenumber2hartree I_el = identi...
[ "def", "polariton_hamiltonian", "(", "n_el", ",", "n_vc", ",", "n_vt", ",", "cav", ",", "g", ")", ":", "freq_vc", "=", "952.", "*", "wavenumber2hartree", "freq_vt", "=", "597.", "*", "wavenumber2hartree", "Eshift", "=", "np", ".", "array", "(", "[", "0.0...
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
[ "contruct", "vibronic", "-", "cavity", "basis", "for", "polaritonic", "states", "that", "is", "a", "direct", "product", "of", "electron", "-", "vibration", "-", "photon", "space" ]
[ "\"\"\"\n contruct vibronic-cavity basis for polaritonic states, that is a\n direct product of electron-vibration-photon space\n \"\"\"", "#n_basis = n_el * n_cav * n_vc * n_vt", "# inter-state coupling lambda", "# indentity matrices in each subspace", "# the bare term in the system Hamiltonian", ...
[ { "param": "n_el", "type": null }, { "param": "n_vc", "type": null }, { "param": "n_vt", "type": null }, { "param": "cav", "type": null }, { "param": "g", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n_el", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n_vc", "type": null, "docstring": null, "docstring_tokens": [...
17bec732c61facc4bc200cd14ed94312a778ce79
binggu56/lime
lime/models/pyrazine.py
[ "MIT" ]
Python
vibronic_hamiltonian
<not_specific>
def vibronic_hamiltonian(n_el, n_vc, n_vt): """ contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space """ #n_basis = n_el * n_cav * n_vc * n_vt freq_vc = 952. * wavenumber2hartree freq_vt = 597. * wavenumber2hartree Eshift =...
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
[ "contruct", "vibronic", "-", "cavity", "basis", "for", "polaritonic", "states", "that", "is", "a", "direct", "product", "of", "electron", "-", "vibration", "-", "photon", "space" ]
def vibronic_hamiltonian(n_el, n_vc, n_vt): freq_vc = 952. * wavenumber2hartree freq_vt = 597. * wavenumber2hartree Eshift = np.array([0.0, 31800.0, 39000]) * wavenumber2hartree kappa = np.array([0.0, -847.0, 1202.]) * wavenumber2hartree coup = 2110.0 * wavenumber2hartree I_el = identity(n_el) ...
[ "def", "vibronic_hamiltonian", "(", "n_el", ",", "n_vc", ",", "n_vt", ")", ":", "freq_vc", "=", "952.", "*", "wavenumber2hartree", "freq_vt", "=", "597.", "*", "wavenumber2hartree", "Eshift", "=", "np", ".", "array", "(", "[", "0.0", ",", "31800.0", ",", ...
contruct vibronic-cavity basis for polaritonic states, that is a direct product of electron-vibration-photon space
[ "contruct", "vibronic", "-", "cavity", "basis", "for", "polaritonic", "states", "that", "is", "a", "direct", "product", "of", "electron", "-", "vibration", "-", "photon", "space" ]
[ "\"\"\"\n contruct vibronic-cavity basis for polaritonic states, that is a\n direct product of electron-vibration-photon space\n \"\"\"", "#n_basis = n_el * n_cav * n_vc * n_vt", "# inter-state coupling lambda", "# indentity matrices in each subspace", "# the bare term in the system Hamiltonian", ...
[ { "param": "n_el", "type": null }, { "param": "n_vc", "type": null }, { "param": "n_vt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n_el", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n_vc", "type": null, "docstring": null, "docstring_tokens": [...
17d3f3744c661bf6c2a29273ea37eeb22138df06
binggu56/lime
lime/ToBeErased/FranckCondon/Gaussian.py
[ "MIT" ]
Python
gaussian
<not_specific>
def gaussian(x, mu, sigma): """ mu will be the 'x' location of the the peak, sigma is width """ exponent = -(x-float(mu))**2/(2*sigma**2) coef = sigma*math.sqrt(2*math.pi) return math.exp(exponent)/coef
mu will be the 'x' location of the the peak, sigma is width
mu will be the 'x' location of the the peak, sigma is width
[ "mu", "will", "be", "the", "'", "x", "'", "location", "of", "the", "the", "peak", "sigma", "is", "width" ]
def gaussian(x, mu, sigma): exponent = -(x-float(mu))**2/(2*sigma**2) coef = sigma*math.sqrt(2*math.pi) return math.exp(exponent)/coef
[ "def", "gaussian", "(", "x", ",", "mu", ",", "sigma", ")", ":", "exponent", "=", "-", "(", "x", "-", "float", "(", "mu", ")", ")", "**", "2", "/", "(", "2", "*", "sigma", "**", "2", ")", "coef", "=", "sigma", "*", "math", ".", "sqrt", "(", ...
mu will be the 'x' location of the the peak, sigma is width
[ "mu", "will", "be", "the", "'", "x", "'", "location", "of", "the", "the", "peak", "sigma", "is", "width" ]
[ "\"\"\" mu will be the 'x' location of the the peak, sigma is width\n \"\"\"" ]
[ { "param": "x", "type": null }, { "param": "mu", "type": null }, { "param": "sigma", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mu", "type": null, "docstring": null, "docstring_tokens": [], ...
17d3f3744c661bf6c2a29273ea37eeb22138df06
binggu56/lime
lime/ToBeErased/FranckCondon/Gaussian.py
[ "MIT" ]
Python
gaussianGenerator
<not_specific>
def gaussianGenerator(A, y, dX): """ y is the width of the peak at half height, A is the peak height, dX is the x location of the peak """ alpha = math.log(2)*8/(y**2) coef = A #*((alpha/math.pi)**0.25) return lambda x: coef*math.exp((-alpha*(x-dX)**2)/2)
y is the width of the peak at half height, A is the peak height, dX is the x location of the peak
y is the width of the peak at half height, A is the peak height, dX is the x location of the peak
[ "y", "is", "the", "width", "of", "the", "peak", "at", "half", "height", "A", "is", "the", "peak", "height", "dX", "is", "the", "x", "location", "of", "the", "peak" ]
def gaussianGenerator(A, y, dX): alpha = math.log(2)*8/(y**2) coef = A return lambda x: coef*math.exp((-alpha*(x-dX)**2)/2)
[ "def", "gaussianGenerator", "(", "A", ",", "y", ",", "dX", ")", ":", "alpha", "=", "math", ".", "log", "(", "2", ")", "*", "8", "/", "(", "y", "**", "2", ")", "coef", "=", "A", "return", "lambda", "x", ":", "coef", "*", "math", ".", "exp", ...
y is the width of the peak at half height, A is the peak height, dX is the x location of the peak
[ "y", "is", "the", "width", "of", "the", "peak", "at", "half", "height", "A", "is", "the", "peak", "height", "dX", "is", "the", "x", "location", "of", "the", "peak" ]
[ "\"\"\" y is the width of the peak at half height, A is the peak height,\n\t\tdX is the x location of the peak\n\t\"\"\"", "#*((alpha/math.pi)**0.25)" ]
[ { "param": "A", "type": null }, { "param": "y", "type": null }, { "param": "dX", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "A", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": null, "docstring_tokens": [], ...
5b72afcdaaa5395e3f0e1399ec2c674167aa46ca
binggu56/lime
lime/ToBeErased/FranckCondon/SimpleOscillator.py
[ "MIT" ]
Python
laguerre
<not_specific>
def laguerre(a, n): """ Generates the nth laguerre polynomial with superscript a using the Rodrigues formula. """ # function = lambda x: ((x ** -a)*(math.exp(x))/(math.factorial(n))) #incomplete x = sym.Symbol('x') subFunction = (sym.exp(-x) * (x ** (a+n))).diff(x, n) L = ((x ** ...
Generates the nth laguerre polynomial with superscript a using the Rodrigues formula.
Generates the nth laguerre polynomial with superscript a using the Rodrigues formula.
[ "Generates", "the", "nth", "laguerre", "polynomial", "with", "superscript", "a", "using", "the", "Rodrigues", "formula", "." ]
def laguerre(a, n): x = sym.Symbol('x') subFunction = (sym.exp(-x) * (x ** (a+n))).diff(x, n) L = ((x ** -a)*(sym.exp(x))/(sym.factorial(n))) * subFunction L = sym.simplify(L) l = sym.lambdify(x, L) return l
[ "def", "laguerre", "(", "a", ",", "n", ")", ":", "x", "=", "sym", ".", "Symbol", "(", "'x'", ")", "subFunction", "=", "(", "sym", ".", "exp", "(", "-", "x", ")", "*", "(", "x", "**", "(", "a", "+", "n", ")", ")", ")", ".", "diff", "(", ...
Generates the nth laguerre polynomial with superscript a using the Rodrigues formula.
[ "Generates", "the", "nth", "laguerre", "polynomial", "with", "superscript", "a", "using", "the", "Rodrigues", "formula", "." ]
[ "\"\"\"\n Generates the nth laguerre polynomial with superscript a\n using the Rodrigues formula.\n \"\"\"", "# function = lambda x: ((x ** -a)*(math.exp(x))/(math.factorial(n))) #incomplete", "#print \"Laguerre\", L" ]
[ { "param": "a", "type": null }, { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], ...
5b72afcdaaa5395e3f0e1399ec2c674167aa46ca
binggu56/lime
lime/ToBeErased/FranckCondon/SimpleOscillator.py
[ "MIT" ]
Python
sameFreqOverlap
<not_specific>
def sameFreqOverlap(n, m, w_wavenumbers, deltaQ): """ n must be greater than m, w_wavenumbers is the frequency in wavenumbers. deltaQ is the change in normal coordinate in bohr. Since sameFreqOverlap will only be called with m as the ground state (m=0 -> 0th laguerre), we on...
n must be greater than m, w_wavenumbers is the frequency in wavenumbers. deltaQ is the change in normal coordinate in bohr. Since sameFreqOverlap will only be called with m as the ground state (m=0 -> 0th laguerre), we only need the 0th laguerre, which is equal to 1 for...
n must be greater than m, w_wavenumbers is the frequency in wavenumbers. deltaQ is the change in normal coordinate in bohr. Since sameFreqOverlap will only be called with m as the ground state (m=0 -> 0th laguerre), we only need the 0th laguerre, which is equal to 1 for all a, so I have removed the call to the laguerr...
[ "n", "must", "be", "greater", "than", "m", "w_wavenumbers", "is", "the", "frequency", "in", "wavenumbers", ".", "deltaQ", "is", "the", "change", "in", "normal", "coordinate", "in", "bohr", ".", "Since", "sameFreqOverlap", "will", "only", "be", "called", "wit...
def sameFreqOverlap(n, m, w_wavenumbers, deltaQ): w = w_wavenumbers/8065.5/27.2116 F = w ** 2 convertedQSquared = deltaQ**2 X = (F * (convertedQSquared)) / ( 2 * w) L = laguerre(n-m, m) exp1 = (float(n)-m)/2 exp2 = -X/float(2) P = (X**(exp1) * (factorial(m)/float(factorial(n)))**0.5 * np...
[ "def", "sameFreqOverlap", "(", "n", ",", "m", ",", "w_wavenumbers", ",", "deltaQ", ")", ":", "w", "=", "w_wavenumbers", "/", "8065.5", "/", "27.2116", "F", "=", "w", "**", "2", "convertedQSquared", "=", "deltaQ", "**", "2", "X", "=", "(", "F", "*", ...
n must be greater than m, w_wavenumbers is the frequency in wavenumbers.
[ "n", "must", "be", "greater", "than", "m", "w_wavenumbers", "is", "the", "frequency", "in", "wavenumbers", "." ]
[ "\"\"\"\n n must be greater than m, w_wavenumbers is the frequency in\n wavenumbers.\n deltaQ is the change in normal coordinate in bohr.\n\n Since sameFreqOverlap will only be called with m as the ground\n state (m=0 -> 0th laguerre), we only need the 0th laguerre, which\n ...
[ { "param": "n", "type": null }, { "param": "m", "type": null }, { "param": "w_wavenumbers", "type": null }, { "param": "deltaQ", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], ...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
redfield_tensor
<not_specific>
def redfield_tensor(self, secular=False): """ compute the Redfield tensor represented in the eigenbasis of H The returned Redfield tensor contains the unitary dynamics and is defined as i d/dt rho = R rho Parameters ---------- spectra : list of callback functi...
compute the Redfield tensor represented in the eigenbasis of H The returned Redfield tensor contains the unitary dynamics and is defined as i d/dt rho = R rho Parameters ---------- spectra : list of callback functions DESCRIPTION. secular : TYPE, ...
compute the Redfield tensor represented in the eigenbasis of H The returned Redfield tensor contains the unitary dynamics and is defined as i d/dt rho = R rho Parameters spectra : list of callback functions DESCRIPTION. secular : TYPE, optional DESCRIPTION. The default is False. Returns TYPE DESCRIPTION.
[ "compute", "the", "Redfield", "tensor", "represented", "in", "the", "eigenbasis", "of", "H", "The", "returned", "Redfield", "tensor", "contains", "the", "unitary", "dynamics", "and", "is", "defined", "as", "i", "d", "/", "dt", "rho", "=", "R", "rho", "Para...
def redfield_tensor(self, secular=False): H = self.H c_ops = self.c_ops if self.spectra is None: raise TypeError('Specify the bath spectral function.') else: spectra = self.spectra R, evecs = redfield_tensor(H, c_ops, spectra, secular) self.R = R ...
[ "def", "redfield_tensor", "(", "self", ",", "secular", "=", "False", ")", ":", "H", "=", "self", ".", "H", "c_ops", "=", "self", ".", "c_ops", "if", "self", ".", "spectra", "is", "None", ":", "raise", "TypeError", "(", "'Specify the bath spectral function....
compute the Redfield tensor represented in the eigenbasis of H The returned Redfield tensor contains the unitary dynamics and is defined as
[ "compute", "the", "Redfield", "tensor", "represented", "in", "the", "eigenbasis", "of", "H", "The", "returned", "Redfield", "tensor", "contains", "the", "unitary", "dynamics", "and", "is", "defined", "as" ]
[ "\"\"\"\n compute the Redfield tensor represented in the eigenbasis of H\n\n The returned Redfield tensor contains the unitary dynamics and is defined as\n\n i d/dt rho = R rho\n\n Parameters\n ----------\n spectra : list of callback functions\n DESCRIPTION.\n ...
[ { "param": "self", "type": null }, { "param": "secular", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "secular", "type": null, "docstring": null, "docstring_tokens"...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
_redfield
<not_specific>
def _redfield(R, rho0, evecs=None, Nt=1, dt=0.005, t0=0, e_ops=[], return_result=True): """ time propagation of the Redfield quantum master equation with RK4 Input ------- R: 2d array Redfield tensor rho0: 2d array initial density matrix Nt: total number of time steps ...
time propagation of the Redfield quantum master equation with RK4 Input ------- R: 2d array Redfield tensor rho0: 2d array initial density matrix Nt: total number of time steps dt: time step e_ops: list of observable operators Returns ========= rho: 2D a...
time propagation of the Redfield quantum master equation with RK4 Input 2d array Redfield tensor 2d array initial density matrix total number of time steps time step e_ops: list of observable operators Returns 2D array density matrix at time t = Nt * dt
[ "time", "propagation", "of", "the", "Redfield", "quantum", "master", "equation", "with", "RK4", "Input", "2d", "array", "Redfield", "tensor", "2d", "array", "initial", "density", "matrix", "total", "number", "of", "time", "steps", "time", "step", "e_ops", ":",...
def _redfield(R, rho0, evecs=None, Nt=1, dt=0.005, t0=0, e_ops=[], return_result=True): N = rho0.shape[0] if e_ops is None: e_ops = [] if evecs is not None: rho0 = transform(rho0, evecs) e_ops = [transform(e, evecs) for e in e_ops] rho = rho0.copy() rho = dm2vec(rho).astype(c...
[ "def", "_redfield", "(", "R", ",", "rho0", ",", "evecs", "=", "None", ",", "Nt", "=", "1", ",", "dt", "=", "0.005", ",", "t0", "=", "0", ",", "e_ops", "=", "[", "]", ",", "return_result", "=", "True", ")", ":", "N", "=", "rho0", ".", "shape",...
time propagation of the Redfield quantum master equation with RK4 Input
[ "time", "propagation", "of", "the", "Redfield", "quantum", "master", "equation", "with", "RK4", "Input" ]
[ "\"\"\"\n time propagation of the Redfield quantum master equation with RK4\n\n Input\n -------\n R: 2d array\n Redfield tensor\n\n rho0: 2d array\n initial density matrix\n\n Nt: total number of time steps\n\n dt: time step\n e_ops: list of observable operators\n\n Returns\...
[ { "param": "R", "type": null }, { "param": "rho0", "type": null }, { "param": "evecs", "type": null }, { "param": "Nt", "type": null }, { "param": "dt", "type": null }, { "param": "t0", "type": null }, { "param": "e_ops", "type": null ...
{ "returns": [], "raises": [], "params": [ { "identifier": "R", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [], ...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
_correlation_2p_1t
<not_specific>
def _correlation_2p_1t(H, rho0, ops, c_ops, dt, Nt, method='lindblad', output='cor.dat'): """ compute the time-translation invariant two-point correlation function in the density matrix formalism using quantum regression theorem <A(t)B> = Tr[ A U(t) (B rho0) U^\dag(t)] input: ======== ...
compute the time-translation invariant two-point correlation function in the density matrix formalism using quantum regression theorem <A(t)B> = Tr[ A U(t) (B rho0) U^\dag(t)] input: ======== H: 2d array full Hamiltonian rho0: initial density matrix ops: list of operato...
compute the time-translation invariant two-point correlation function in the density matrix formalism using quantum regression theorem 2d array full Hamiltonian initial density matrix list of operators [A, B] for computing the correlation functions dictionary of parameters for dynamics Returns the density m...
[ "compute", "the", "time", "-", "translation", "invariant", "two", "-", "point", "correlation", "function", "in", "the", "density", "matrix", "formalism", "using", "quantum", "regression", "theorem", "2d", "array", "full", "Hamiltonian", "initial", "density", "matr...
def _correlation_2p_1t(H, rho0, ops, c_ops, dt, Nt, method='lindblad', output='cor.dat'): A, B = ops rho = B.dot(rho0) f = open(output, 'w') t = 0.0 cor = np.zeros(Nt, dtype=complex) H = csr_matrix(H) rho = csr_matrix(rho) A = csr_matrix(A) c_ops_sparse = [csr_matrix(c_op) for c_op i...
[ "def", "_correlation_2p_1t", "(", "H", ",", "rho0", ",", "ops", ",", "c_ops", ",", "dt", ",", "Nt", ",", "method", "=", "'lindblad'", ",", "output", "=", "'cor.dat'", ")", ":", "A", ",", "B", "=", "ops", "rho", "=", "B", ".", "dot", "(", "rho0", ...
compute the time-translation invariant two-point correlation function in the density matrix formalism using quantum regression theorem
[ "compute", "the", "time", "-", "translation", "invariant", "two", "-", "point", "correlation", "function", "in", "the", "density", "matrix", "formalism", "using", "quantum", "regression", "theorem" ]
[ "\"\"\"\n compute the time-translation invariant two-point correlation function in the\n density matrix formalism using quantum regression theorem\n\n <A(t)B> = Tr[ A U(t) (B rho0) U^\\dag(t)]\n\n input:\n ========\n H: 2d array\n full Hamiltonian\n\n rho0: initial density matrix\n\...
[ { "param": "H", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "c_ops", "type": null }, { "param": "dt", "type": null }, { "param": "Nt", "type": null }, { "param": "method", "type": null...
{ "returns": [], "raises": [], "params": [ { "identifier": "H", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [], ...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
corr
null
def corr(self): """ compute the correlation function for bath operators """ pass
compute the correlation function for bath operators
compute the correlation function for bath operators
[ "compute", "the", "correlation", "function", "for", "bath", "operators" ]
def corr(self): pass
[ "def", "corr", "(", "self", ")", ":", "pass" ]
compute the correlation function for bath operators
[ "compute", "the", "correlation", "function", "for", "bath", "operators" ]
[ "\"\"\"\n compute the correlation function for bath operators\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
func
<not_specific>
def func(rho, h0, c_ops, l_ops): """ right-hand side of the master equation """ rhs = -1j * commutator(h0, rho) for i in range(len(c_ops)): c_op = c_ops[i] l_op = l_ops[i] rhs -= commutator(c_op, l_op.dot(rho) - rho.dot(dag(l_op))) return rhs
right-hand side of the master equation
right-hand side of the master equation
[ "right", "-", "hand", "side", "of", "the", "master", "equation" ]
def func(rho, h0, c_ops, l_ops): rhs = -1j * commutator(h0, rho) for i in range(len(c_ops)): c_op = c_ops[i] l_op = l_ops[i] rhs -= commutator(c_op, l_op.dot(rho) - rho.dot(dag(l_op))) return rhs
[ "def", "func", "(", "rho", ",", "h0", ",", "c_ops", ",", "l_ops", ")", ":", "rhs", "=", "-", "1j", "*", "commutator", "(", "h0", ",", "rho", ")", "for", "i", "in", "range", "(", "len", "(", "c_ops", ")", ")", ":", "c_op", "=", "c_ops", "[", ...
right-hand side of the master equation
[ "right", "-", "hand", "side", "of", "the", "master", "equation" ]
[ "\"\"\"\n right-hand side of the master equation\n \"\"\"" ]
[ { "param": "rho", "type": null }, { "param": "h0", "type": null }, { "param": "c_ops", "type": null }, { "param": "l_ops", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rho", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "h0", "type": null, "docstring": null, "docstring_tokens": [], ...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
coherent
<not_specific>
def coherent(N, alpha): """Generates a coherent state with eigenvalue alpha. Constructed using displacement operator on vacuum state. Modified from Qutip. Parameters ---------- N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue of coherent st...
Generates a coherent state with eigenvalue alpha. Constructed using displacement operator on vacuum state. Modified from Qutip. Parameters ---------- N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue of coherent state. offset : int (default...
Generates a coherent state with eigenvalue alpha. Constructed using displacement operator on vacuum state. Modified from Qutip. Parameters N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue of coherent state. offset : int (default 0) The lowest number state that is included in the fin...
[ "Generates", "a", "coherent", "state", "with", "eigenvalue", "alpha", ".", "Constructed", "using", "displacement", "operator", "on", "vacuum", "state", ".", "Modified", "from", "Qutip", ".", "Parameters", "N", ":", "int", "Number", "of", "Fock", "states", "in"...
def coherent(N, alpha): x = basis(N, 0) a = destroy(N) D = la.expm(alpha * dag(a) - np.conj(alpha) * a) return D @ x
[ "def", "coherent", "(", "N", ",", "alpha", ")", ":", "x", "=", "basis", "(", "N", ",", "0", ")", "a", "=", "destroy", "(", "N", ")", "D", "=", "la", ".", "expm", "(", "alpha", "*", "dag", "(", "a", ")", "-", "np", ".", "conj", "(", "alpha...
Generates a coherent state with eigenvalue alpha.
[ "Generates", "a", "coherent", "state", "with", "eigenvalue", "alpha", "." ]
[ "\"\"\"Generates a coherent state with eigenvalue alpha.\n\n Constructed using displacement operator on vacuum state.\n\n Modified from Qutip.\n\n Parameters\n ----------\n N : int\n Number of Fock states in Hilbert space.\n\n alpha : float/complex\n Eigenvalue of coherent state.\n\n...
[ { "param": "N", "type": null }, { "param": "alpha", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "N", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "alpha", "type": null, "docstring": null, "docstring_tokens": [],...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
coherent_dm
<not_specific>
def coherent_dm(N, alpha): """Density matrix representation of a coherent state. Constructed via outer product of :func:`qutip.states.coherent` Parameters ---------- N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue for coherent state. offse...
Density matrix representation of a coherent state. Constructed via outer product of :func:`qutip.states.coherent` Parameters ---------- N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue for coherent state. offset : int (default 0) The lo...
Density matrix representation of a coherent state. Constructed via outer product of :func:`qutip.states.coherent` Parameters N : int Number of Fock states in Hilbert space. alpha : float/complex Eigenvalue for coherent state. offset : int (default 0) The lowest number state that is included in the finite number sta...
[ "Density", "matrix", "representation", "of", "a", "coherent", "state", ".", "Constructed", "via", "outer", "product", "of", ":", "func", ":", "`", "qutip", ".", "states", ".", "coherent", "`", "Parameters", "N", ":", "int", "Number", "of", "Fock", "states"...
def coherent_dm(N, alpha): psi = coherent(N, alpha) return ket2dm(psi)
[ "def", "coherent_dm", "(", "N", ",", "alpha", ")", ":", "psi", "=", "coherent", "(", "N", ",", "alpha", ")", "return", "ket2dm", "(", "psi", ")" ]
Density matrix representation of a coherent state.
[ "Density", "matrix", "representation", "of", "a", "coherent", "state", "." ]
[ "\"\"\"Density matrix representation of a coherent state.\n\n Constructed via outer product of :func:`qutip.states.coherent`\n\n Parameters\n ----------\n N : int\n Number of Fock states in Hilbert space.\n\n alpha : float/complex\n Eigenvalue for coherent state.\n\n offset : int (de...
[ { "param": "N", "type": null }, { "param": "alpha", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "N", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "alpha", "type": null, "docstring": null, "docstring_tokens": [],...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
_redfield_old
<not_specific>
def _redfield_old(nstates, rho0, c_ops, h0, Nt, dt,e_ops, env): """ time propagation of the Redfield equation with second-order differencing input: nstate: total number of states h0: system Hamiltonian Nt: total number of time steps dt: tiem step c_ops: list of collap...
time propagation of the Redfield equation with second-order differencing input: nstate: total number of states h0: system Hamiltonian Nt: total number of time steps dt: tiem step c_ops: list of collapse operators e_ops: list of observable operators rho0: ...
time propagation of the Redfield equation with second-order differencing input: nstate: total number of states h0: system Hamiltonian Nt: total number of time steps dt: tiem step c_ops: list of collapse operators e_ops: list of observable operators rho0: initial density matrix
[ "time", "propagation", "of", "the", "Redfield", "equation", "with", "second", "-", "order", "differencing", "input", ":", "nstate", ":", "total", "number", "of", "states", "h0", ":", "system", "Hamiltonian", "Nt", ":", "total", "number", "of", "time", "steps...
def _redfield_old(nstates, rho0, c_ops, h0, Nt, dt,e_ops, env): t = 0.0 print('Total number of states in the system = {}'.format(nstates)) rho = rho0 T = env.T cutfreq = env.cutfreq reorg = env.reorg fmt = '{} '* (len(e_ops) + 1) + '\n' l_ops = [] for c_op in c_ops: l_ops.app...
[ "def", "_redfield_old", "(", "nstates", ",", "rho0", ",", "c_ops", ",", "h0", ",", "Nt", ",", "dt", ",", "e_ops", ",", "env", ")", ":", "t", "=", "0.0", "print", "(", "'Total number of states in the system = {}'", ".", "format", "(", "nstates", ")", ")",...
time propagation of the Redfield equation with second-order differencing input: nstate: total number of states h0: system Hamiltonian Nt: total number of time steps dt: tiem step c_ops: list of collapse operators e_ops: list of observable operators rho0: initial density matrix
[ "time", "propagation", "of", "the", "Redfield", "equation", "with", "second", "-", "order", "differencing", "input", ":", "nstate", ":", "total", "number", "of", "states", "h0", ":", "system", "Hamiltonian", "Nt", ":", "total", "number", "of", "time", "steps...
[ "\"\"\"\n time propagation of the Redfield equation with second-order differencing\n input:\n nstate: total number of states\n h0: system Hamiltonian\n Nt: total number of time steps\n dt: tiem step\n c_ops: list of collapse operators\n e_ops: list of observable opera...
[ { "param": "nstates", "type": null }, { "param": "rho0", "type": null }, { "param": "c_ops", "type": null }, { "param": "h0", "type": null }, { "param": "Nt", "type": null }, { "param": "dt", "type": null }, { "param": "e_ops", "type": ...
{ "returns": [], "raises": [], "params": [ { "identifier": "nstates", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens"...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
observe
<not_specific>
def observe(A, rho): """ compute expectation value of the operator A """ return A.dot(rho).diagonal().sum()
compute expectation value of the operator A
compute expectation value of the operator A
[ "compute", "expectation", "value", "of", "the", "operator", "A" ]
def observe(A, rho): return A.dot(rho).diagonal().sum()
[ "def", "observe", "(", "A", ",", "rho", ")", ":", "return", "A", ".", "dot", "(", "rho", ")", ".", "diagonal", "(", ")", ".", "sum", "(", ")" ]
compute expectation value of the operator A
[ "compute", "expectation", "value", "of", "the", "operator", "A" ]
[ "\"\"\"\n compute expectation value of the operator A\n \"\"\"" ]
[ { "param": "A", "type": null }, { "param": "rho", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "A", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho", "type": null, "docstring": null, "docstring_tokens": [], ...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
correlation_3op_2t
<not_specific>
def correlation_3op_2t(self, rho0, ops, dt, Nt, Ntau): """ Internal function for calculating the three-operator two-time correlation function: <A(t)B(t+tau)C(t)> using the Linblad master equation solver. """ # the solvers only work for positive time differences a...
Internal function for calculating the three-operator two-time correlation function: <A(t)B(t+tau)C(t)> using the Linblad master equation solver.
Internal function for calculating the three-operator two-time correlation function: using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "three", "-", "operator", "two", "-", "time", "correlation", "function", ":", "using", "the", "Linblad", "master", "equation", "solver", "." ]
def correlation_3op_2t(self, rho0, ops, dt, Nt, Ntau): H = self.H c_ops = self.c_ops rho_t = _lindblad(H, rho0, c_ops, dt=dt, Nt=Nt, return_result=True).rholist a_op, b_op, c_op = ops corr_mat = np.zeros([Nt, Ntau], dtype=complex) for t_idx, rho in enumerate(rho_t): ...
[ "def", "correlation_3op_2t", "(", "self", ",", "rho0", ",", "ops", ",", "dt", ",", "Nt", ",", "Ntau", ")", ":", "H", "=", "self", ".", "H", "c_ops", "=", "self", ".", "c_ops", "rho_t", "=", "_lindblad", "(", "H", ",", "rho0", ",", "c_ops", ",", ...
Internal function for calculating the three-operator two-time correlation function: <A(t)B(t+tau)C(t)> using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "three", "-", "operator", "two", "-", "time", "correlation", "function", ":", "<A", "(", "t", ")", "B", "(", "t", "+", "tau", ")", "C", "(", "t", ")", ">", "using", "the", "Linblad", "master", "equ...
[ "\"\"\"\n Internal function for calculating the three-operator two-time\n correlation function:\n <A(t)B(t+tau)C(t)>\n using the Linblad master equation solver.\n \"\"\"", "# the solvers only work for positive time differences and the correlators", "# require positive tau", ...
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "dt", "type": null }, { "param": "Nt", "type": null }, { "param": "Ntau", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
correlation_4op_1t
<not_specific>
def correlation_4op_1t(self, rho0, ops, dt, nt): """ Internal function for calculating the four-operator two-time correlation function: <A B(t)C(t) D> using the Linblad master equation solver. """ if len(ops) != 4: raise ValueError('Number of operator...
Internal function for calculating the four-operator two-time correlation function: <A B(t)C(t) D> using the Linblad master equation solver.
Internal function for calculating the four-operator two-time correlation function: using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "four", "-", "operator", "two", "-", "time", "correlation", "function", ":", "using", "the", "Linblad", "master", "equation", "solver", "." ]
def correlation_4op_1t(self, rho0, ops, dt, nt): if len(ops) != 4: raise ValueError('Number of operators is not 4.') else: a, b, c, d = ops corr = self.correlation_3op_1t(rho0, [a, b@c, d], dt, nt) return corr
[ "def", "correlation_4op_1t", "(", "self", ",", "rho0", ",", "ops", ",", "dt", ",", "nt", ")", ":", "if", "len", "(", "ops", ")", "!=", "4", ":", "raise", "ValueError", "(", "'Number of operators is not 4.'", ")", "else", ":", "a", ",", "b", ",", "c",...
Internal function for calculating the four-operator two-time correlation function: <A B(t)C(t) D> using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "four", "-", "operator", "two", "-", "time", "correlation", "function", ":", "<A", "B", "(", "t", ")", "C", "(", "t", ")", "D", ">", "using", "the", "Linblad", "master", "equation", "solver", "." ]
[ "\"\"\"\n Internal function for calculating the four-operator two-time\n correlation function:\n <A B(t)C(t) D>\n using the Linblad master equation solver.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "dt", "type": null }, { "param": "nt", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
correlation_4op_2t
<not_specific>
def correlation_4op_2t(self, rho0, ops, dt, nt, ntau): """ Internal function for calculating the four-operator two-time correlation function: <A(t)B(t+tau)C(t+tau)D(t)> using the Linblad master equation solver. """ if len(ops) != 4: raise ValueError('...
Internal function for calculating the four-operator two-time correlation function: <A(t)B(t+tau)C(t+tau)D(t)> using the Linblad master equation solver.
Internal function for calculating the four-operator two-time correlation function: using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "four", "-", "operator", "two", "-", "time", "correlation", "function", ":", "using", "the", "Linblad", "master", "equation", "solver", "." ]
def correlation_4op_2t(self, rho0, ops, dt, nt, ntau): if len(ops) != 4: raise ValueError('Number of operators is not 4.') else: a, b, c, d = ops corr = self.correlation_3op_2t(rho0, [a, b@c, d], dt, nt, ntau) return corr
[ "def", "correlation_4op_2t", "(", "self", ",", "rho0", ",", "ops", ",", "dt", ",", "nt", ",", "ntau", ")", ":", "if", "len", "(", "ops", ")", "!=", "4", ":", "raise", "ValueError", "(", "'Number of operators is not 4.'", ")", "else", ":", "a", ",", "...
Internal function for calculating the four-operator two-time correlation function: <A(t)B(t+tau)C(t+tau)D(t)> using the Linblad master equation solver.
[ "Internal", "function", "for", "calculating", "the", "four", "-", "operator", "two", "-", "time", "correlation", "function", ":", "<A", "(", "t", ")", "B", "(", "t", "+", "tau", ")", "C", "(", "t", "+", "tau", ")", "D", "(", "t", ")", ">", "using...
[ "\"\"\"\n Internal function for calculating the four-operator two-time\n correlation function:\n <A(t)B(t+tau)C(t+tau)D(t)>\n using the Linblad master equation solver.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "rho0", "type": null }, { "param": "ops", "type": null }, { "param": "dt", "type": null }, { "param": "nt", "type": null }, { "param": "ntau", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [...
4e8f2def2fb2005e248b1f999f82369e2facedee
binggu56/lime
lime/oqs.py
[ "MIT" ]
Python
_lindblad
<not_specific>
def _lindblad(H, rho0, c_ops, e_ops=None, Nt=1, dt=0.005, return_result=True): """ time propagation of the lindblad quantum master equation with second-order differencing Input ------- h0: 2d array system Hamiltonian Nt: total number of time steps dt: time step c_o...
time propagation of the lindblad quantum master equation with second-order differencing Input ------- h0: 2d array system Hamiltonian Nt: total number of time steps dt: time step c_ops: list of collapse operators e_ops: list of observable operators rho0...
time propagation of the lindblad quantum master equation with second-order differencing Input 2d array system Hamiltonian Nt: total number of time steps time step c_ops: list of collapse operators e_ops: list of observable operators rho0: initial density matrix Returns 2D array density matrix at time t = Nt * dt
[ "time", "propagation", "of", "the", "lindblad", "quantum", "master", "equation", "with", "second", "-", "order", "differencing", "Input", "2d", "array", "system", "Hamiltonian", "Nt", ":", "total", "number", "of", "time", "steps", "time", "step", "c_ops", ":",...
def _lindblad(H, rho0, c_ops, e_ops=None, Nt=1, dt=0.005, return_result=True): rho = rho0.copy() rho = rho.astype(complex) if e_ops is None: e_ops = [] t = 0.0 if return_result == False: f_obs = open('obs.dat', 'w') fmt = '{} '* (len(e_ops) + 1) + '\n' for k in range(...
[ "def", "_lindblad", "(", "H", ",", "rho0", ",", "c_ops", ",", "e_ops", "=", "None", ",", "Nt", "=", "1", ",", "dt", "=", "0.005", ",", "return_result", "=", "True", ")", ":", "rho", "=", "rho0", ".", "copy", "(", ")", "rho", "=", "rho", ".", ...
time propagation of the lindblad quantum master equation with second-order differencing
[ "time", "propagation", "of", "the", "lindblad", "quantum", "master", "equation", "with", "second", "-", "order", "differencing" ]
[ "\"\"\"\n time propagation of the lindblad quantum master equation\n with second-order differencing\n\n Input\n -------\n h0: 2d array\n system Hamiltonian\n Nt: total number of time steps\n\n dt: time step\n c_ops: list of collapse operators\n e_ops: list of observable...
[ { "param": "H", "type": null }, { "param": "rho0", "type": null }, { "param": "c_ops", "type": null }, { "param": "e_ops", "type": null }, { "param": "Nt", "type": null }, { "param": "dt", "type": null }, { "param": "return_result", "ty...
{ "returns": [], "raises": [], "params": [ { "identifier": "H", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rho0", "type": null, "docstring": null, "docstring_tokens": [], ...
a08bc83912c5a808aee2564f407ac774a0f09cf9
binggu56/lime
examples/standalone_namd.py
[ "MIT" ]
Python
propagate
<not_specific>
def propagate(self, dt, psi_x, Nsteps = 1): """ Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the num...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change ...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change in time at the end of this method will be dt * Nsteps. default is N = 1
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", ".", "Parameters", "dt", ":", "float", "the", "small", "time", "interval", "over", "which", "to", "integrate", "Nsteps", ":", "float", ...
def propagate(self, dt, psi_x, Nsteps = 1): if dt > 0.0: f = open('density_matrix.dat', 'w') else: f = open('density_matrix_backward.dat', 'w') x = self.x V_x = self.V_x nx = len(x) nstates = self.nstates dt2 = 0.5 * dt vpsi = np....
[ "def", "propagate", "(", "self", ",", "dt", ",", "psi_x", ",", "Nsteps", "=", "1", ")", ":", "if", "dt", ">", "0.0", ":", "f", "=", "open", "(", "'density_matrix.dat'", ",", "'w'", ")", "else", ":", "f", "=", "open", "(", "'density_matrix_backward.da...
Perform a series of time-steps via the time-dependent Schrodinger Equation.
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", "." ]
[ "\"\"\"\n Perform a series of time-steps via the time-dependent\n Schrodinger Equation.\n\n Parameters\n ----------\n dt : float\n the small time interval over which to integrate\n\n Nsteps : float, optional\n the number of intervals to compute. The t...
[ { "param": "self", "type": null }, { "param": "dt", "type": null }, { "param": "psi_x", "type": null }, { "param": "Nsteps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dt", "type": null, "docstring": null, "docstring_tokens": [],...
a08bc83912c5a808aee2564f407ac774a0f09cf9
binggu56/lime
examples/standalone_namd.py
[ "MIT" ]
Python
gwp
<not_specific>
def gwp(x, a, x0, k0): """ a gaussian wave packet of width a, centered at x0, with momentum k0 """ return ((a * np.sqrt(np.pi)) ** (-0.5) * np.exp(-0.5 * ((x - x0) * 1. / a) ** 2 + 1j * x * k0))
a gaussian wave packet of width a, centered at x0, with momentum k0
a gaussian wave packet of width a, centered at x0, with momentum k0
[ "a", "gaussian", "wave", "packet", "of", "width", "a", "centered", "at", "x0", "with", "momentum", "k0" ]
def gwp(x, a, x0, k0): return ((a * np.sqrt(np.pi)) ** (-0.5) * np.exp(-0.5 * ((x - x0) * 1. / a) ** 2 + 1j * x * k0))
[ "def", "gwp", "(", "x", ",", "a", ",", "x0", ",", "k0", ")", ":", "return", "(", "(", "a", "*", "np", ".", "sqrt", "(", "np", ".", "pi", ")", ")", "**", "(", "-", "0.5", ")", "*", "np", ".", "exp", "(", "-", "0.5", "*", "(", "(", "x",...
a gaussian wave packet of width a, centered at x0, with momentum k0
[ "a", "gaussian", "wave", "packet", "of", "width", "a", "centered", "at", "x0", "with", "momentum", "k0" ]
[ "\"\"\"\n a gaussian wave packet of width a, centered at x0, with momentum k0\n \"\"\"" ]
[ { "param": "x", "type": null }, { "param": "a", "type": null }, { "param": "x0", "type": null }, { "param": "k0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
7e7fde407f6425fdf57bb516e9ffd939809b944d
binggu56/lime
lime/Floquet.py
[ "MIT" ]
Python
quasiE
<not_specific>
def quasiE(H0, H1, Nt, omega): """ Construct the Floquet hamiltonian of size Norbs * Nt INPUT Norbs : number of orbitals Nt : number of Fourier components E0 : electric field amplitude """ Norbs = H0.shape[-1] #print('transition dipoles \n', M) # dimensionali...
Construct the Floquet hamiltonian of size Norbs * Nt INPUT Norbs : number of orbitals Nt : number of Fourier components E0 : electric field amplitude
Construct the Floquet hamiltonian of size Norbs * Nt INPUT Norbs : number of orbitals Nt : number of Fourier components E0 : electric field amplitude
[ "Construct", "the", "Floquet", "hamiltonian", "of", "size", "Norbs", "*", "Nt", "INPUT", "Norbs", ":", "number", "of", "orbitals", "Nt", ":", "number", "of", "Fourier", "components", "E0", ":", "electric", "field", "amplitude" ]
def quasiE(H0, H1, Nt, omega): Norbs = H0.shape[-1] NF = Norbs * Nt F = np.zeros((NF,NF)) N0 = -(Nt-1)/2 for n in range(Nt): for m in range(Nt): for k in range(Norbs): for l in range(Norbs): i = Norbs * n + k j = Norbs * m ...
[ "def", "quasiE", "(", "H0", ",", "H1", ",", "Nt", ",", "omega", ")", ":", "Norbs", "=", "H0", ".", "shape", "[", "-", "1", "]", "NF", "=", "Norbs", "*", "Nt", "F", "=", "np", ".", "zeros", "(", "(", "NF", ",", "NF", ")", ")", "N0", "=", ...
Construct the Floquet hamiltonian of size Norbs * Nt INPUT Norbs : number of orbitals Nt : number of Fourier components E0 : electric field amplitude
[ "Construct", "the", "Floquet", "hamiltonian", "of", "size", "Norbs", "*", "Nt", "INPUT", "Norbs", ":", "number", "of", "orbitals", "Nt", ":", "number", "of", "Fourier", "components", "E0", ":", "electric", "field", "amplitude" ]
[ "\"\"\"\n Construct the Floquet hamiltonian of size Norbs * Nt\n INPUT\n Norbs : number of orbitals\n Nt : number of Fourier components\n E0 : electric field amplitude\n \"\"\"", "#print('transition dipoles \\n', M)", "# dimensionality of the Floquet matrix", "# starting po...
[ { "param": "H0", "type": null }, { "param": "H1", "type": null }, { "param": "Nt", "type": null }, { "param": "omega", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "H0", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "H1", "type": null, "docstring": null, "docstring_tokens": [], ...
7e7fde407f6425fdf57bb516e9ffd939809b944d
binggu56/lime
lime/Floquet.py
[ "MIT" ]
Python
HamiltonFT
<not_specific>
def HamiltonFT(H0, H1, n): """ Fourier transform of the Hamiltonian matrix, required to construct the Floquet Hamiltonian INPUT n : Fourier component index M : dipole matrix """ Norbs = H0.shape[-1] if n == 0: return H0 elif n == 1 or n == -1: return H...
Fourier transform of the Hamiltonian matrix, required to construct the Floquet Hamiltonian INPUT n : Fourier component index M : dipole matrix
Fourier transform of the Hamiltonian matrix, required to construct the Floquet Hamiltonian INPUT n : Fourier component index M : dipole matrix
[ "Fourier", "transform", "of", "the", "Hamiltonian", "matrix", "required", "to", "construct", "the", "Floquet", "Hamiltonian", "INPUT", "n", ":", "Fourier", "component", "index", "M", ":", "dipole", "matrix" ]
def HamiltonFT(H0, H1, n): Norbs = H0.shape[-1] if n == 0: return H0 elif n == 1 or n == -1: return H1 else: return np.zeros((Norbs,Norbs))
[ "def", "HamiltonFT", "(", "H0", ",", "H1", ",", "n", ")", ":", "Norbs", "=", "H0", ".", "shape", "[", "-", "1", "]", "if", "n", "==", "0", ":", "return", "H0", "elif", "n", "==", "1", "or", "n", "==", "-", "1", ":", "return", "H1", "else", ...
Fourier transform of the Hamiltonian matrix, required to construct the Floquet Hamiltonian
[ "Fourier", "transform", "of", "the", "Hamiltonian", "matrix", "required", "to", "construct", "the", "Floquet", "Hamiltonian" ]
[ "\"\"\"\n Fourier transform of the Hamiltonian matrix, required to construct the\n Floquet Hamiltonian\n\n INPUT\n n : Fourier component index\n M : dipole matrix\n \"\"\"" ]
[ { "param": "H0", "type": null }, { "param": "H1", "type": null }, { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "H0", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "H1", "type": null, "docstring": null, "docstring_tokens": [], ...
b6e3f094d79d73522252dd501079b94661efd5b5
binggu56/lime
lime/spo/NAMD_2D.py
[ "MIT" ]
Python
gauss_x_2d
<not_specific>
def gauss_x_2d(sigma, x0, y0, kx0, ky0): """ generate the gaussian distribution in 2D grid :param x0: float, mean value of gaussian wavepacket along x :param y0: float, mean value of gaussian wavepacket along y :param sigma: float array, covariance matrix with 2X2 dimension :param kx0: float, in...
generate the gaussian distribution in 2D grid :param x0: float, mean value of gaussian wavepacket along x :param y0: float, mean value of gaussian wavepacket along y :param sigma: float array, covariance matrix with 2X2 dimension :param kx0: float, initial momentum along x :param ky0: float, in...
generate the gaussian distribution in 2D grid
[ "generate", "the", "gaussian", "distribution", "in", "2D", "grid" ]
def gauss_x_2d(sigma, x0, y0, kx0, ky0): gauss_2d = np.zeros((len(x), len(y))) for i in range(len(x)): for j in range(len(y)): delta = np.dot(np.array([x[i]-x0, y[j]-y0]), inv(sigma))\ .dot(np.array([x[i]-x0, y[j]-y0])) gauss_2d[i, j] = (np.sqrt(det(sigma)) ...
[ "def", "gauss_x_2d", "(", "sigma", ",", "x0", ",", "y0", ",", "kx0", ",", "ky0", ")", ":", "gauss_2d", "=", "np", ".", "zeros", "(", "(", "len", "(", "x", ")", ",", "len", "(", "y", ")", ")", ")", "for", "i", "in", "range", "(", "len", "(",...
generate the gaussian distribution in 2D grid
[ "generate", "the", "gaussian", "distribution", "in", "2D", "grid" ]
[ "\"\"\"\n generate the gaussian distribution in 2D grid\n :param x0: float, mean value of gaussian wavepacket along x\n :param y0: float, mean value of gaussian wavepacket along y\n :param sigma: float array, covariance matrix with 2X2 dimension\n :param kx0: float, initial momentum along x\n :par...
[ { "param": "sigma", "type": null }, { "param": "x0", "type": null }, { "param": "y0", "type": null }, { "param": "kx0", "type": null }, { "param": "ky0", "type": null } ]
{ "returns": [ { "docstring": "float array, the gaussian distribution in 2D grid", "docstring_tokens": [ "float", "array", "the", "gaussian", "distribution", "in", "2D", "grid" ], "type": null } ], "raises": [], "par...
b6e3f094d79d73522252dd501079b94661efd5b5
binggu56/lime
lime/spo/NAMD_2D.py
[ "MIT" ]
Python
vpsi
null
def vpsi(dt, v_2d, psi_grid): """ propagate the state in grid basis half time step forward with Potential Energy Operator :param dt: float time step :param v_2d: float array the two electronic states potential operator in grid basis :param psi_grid: list ...
propagate the state in grid basis half time step forward with Potential Energy Operator :param dt: float time step :param v_2d: float array the two electronic states potential operator in grid basis :param psi_grid: list the two-electronic-state...
propagate the state in grid basis half time step forward with Potential Energy Operator
[ "propagate", "the", "state", "in", "grid", "basis", "half", "time", "step", "forward", "with", "Potential", "Energy", "Operator" ]
def vpsi(dt, v_2d, psi_grid): for i in range(len(x)): for j in range(len(y)): v_mat = np.array([[v_2d[0][i, j], v_2d[1][i, j]], [v_2d[2][i, j], v_2d[3][i, j]]]) w, u = scipy.linalg.eigh(v_mat) v = np.diagflat(np.exp(-1j * w * dt)) ...
[ "def", "vpsi", "(", "dt", ",", "v_2d", ",", "psi_grid", ")", ":", "for", "i", "in", "range", "(", "len", "(", "x", ")", ")", ":", "for", "j", "in", "range", "(", "len", "(", "y", ")", ")", ":", "v_mat", "=", "np", ".", "array", "(", "[", ...
propagate the state in grid basis half time step forward with Potential Energy Operator
[ "propagate", "the", "state", "in", "grid", "basis", "half", "time", "step", "forward", "with", "Potential", "Energy", "Operator" ]
[ "\"\"\"\n propagate the state in grid basis half time step forward with \n Potential Energy Operator\n \n :param dt: float\n time step\n :param v_2d: float array\n the two electronic states potential operator in grid basis\n :param psi_grid: list\n the ...
[ { "param": "dt", "type": null }, { "param": "v_2d", "type": null }, { "param": "psi_grid", "type": null } ]
{ "returns": [ { "docstring": "list\nthe two-electronic-states vibrational state in grid basis\nafter being half time step forward", "docstring_tokens": [ "list", "the", "two", "-", "electronic", "-", "states", "vibrational", "sta...
b6e3f094d79d73522252dd501079b94661efd5b5
binggu56/lime
lime/spo/NAMD_2D.py
[ "MIT" ]
Python
k_evolve_2d
null
def k_evolve_2d(dt, kx, ky, psi_grid): """ propagate the state in grid basis a time step forward with H = K :param dt: float, time step :param kx: float, momentum corresponding to x :param ky: float, momentum corresponding to y :param psi_grid: list, the two-electronic-states vibrational states ...
propagate the state in grid basis a time step forward with H = K :param dt: float, time step :param kx: float, momentum corresponding to x :param ky: float, momentum corresponding to y :param psi_grid: list, the two-electronic-states vibrational states in grid basis :...
propagate the state in grid basis a time step forward with H = K
[ "propagate", "the", "state", "in", "grid", "basis", "a", "time", "step", "forward", "with", "H", "=", "K" ]
def k_evolve_2d(dt, kx, ky, psi_grid): for i in range(2): psi_k_tmp = fft2(psi_grid[i]) for j in range(len(kx)): for k in range(len(ky)): psi_k_tmp[j, k] *= np.exp(-0.5 * 1j / m * (kx[j]**2+ky[k]**2) * dt) psi_grid[i] = if...
[ "def", "k_evolve_2d", "(", "dt", ",", "kx", ",", "ky", ",", "psi_grid", ")", ":", "for", "i", "in", "range", "(", "2", ")", ":", "psi_k_tmp", "=", "fft2", "(", "psi_grid", "[", "i", "]", ")", "for", "j", "in", "range", "(", "len", "(", "kx", ...
propagate the state in grid basis a time step forward with H = K
[ "propagate", "the", "state", "in", "grid", "basis", "a", "time", "step", "forward", "with", "H", "=", "K" ]
[ "\"\"\"\n propagate the state in grid basis a time step forward with H = K\n :param dt: float, time step\n :param kx: float, momentum corresponding to x\n :param ky: float, momentum corresponding to y\n :param psi_grid: list, the two-electronic-states vibrational states in\n ...
[ { "param": "dt", "type": null }, { "param": "kx", "type": null }, { "param": "ky", "type": null }, { "param": "psi_grid", "type": null } ]
{ "returns": [ { "docstring": "list, the two-electronic-states vibrational\nstates in grid basis", "docstring_tokens": [ "list", "the", "two", "-", "electronic", "-", "states", "vibrational", "states", "in", "grid"...
b6e3f094d79d73522252dd501079b94661efd5b5
binggu56/lime
lime/spo/NAMD_2D.py
[ "MIT" ]
Python
spo_dynamics
<not_specific>
def spo_dynamics(dt, v_2d, psi0, num_steps=0): """ perform the propagation of the dynamics and calculate the purity at every time step :param dt: time step :param v_2d: list potential matrices in 2D :param psi_grid_0: list the initial state :param num_steps: t...
perform the propagation of the dynamics and calculate the purity at every time step :param dt: time step :param v_2d: list potential matrices in 2D :param psi_grid_0: list the initial state :param num_steps: the number of the time steps num_ste...
perform the propagation of the dynamics and calculate the purity at every time step
[ "perform", "the", "propagation", "of", "the", "dynamics", "and", "calculate", "the", "purity", "at", "every", "time", "step" ]
def spo_dynamics(dt, v_2d, psi0, num_steps=0): t = 0.0 psi_grid = psi0 purity = np.zeros(num_steps) kx = fftfreq(nx, dx) ky = fftfreq(ny, dy) dt2 = dt * 0.5 vpsi(dt2, v_2d, psi_grid) for i in range(num_steps): t += dt k_evolve_2d(dt, kx, ky, psi_grid) vpsi(dt, v_...
[ "def", "spo_dynamics", "(", "dt", ",", "v_2d", ",", "psi0", ",", "num_steps", "=", "0", ")", ":", "t", "=", "0.0", "psi_grid", "=", "psi0", "purity", "=", "np", ".", "zeros", "(", "num_steps", ")", "kx", "=", "fftfreq", "(", "nx", ",", "dx", ")",...
perform the propagation of the dynamics and calculate the purity at every time step
[ "perform", "the", "propagation", "of", "the", "dynamics", "and", "calculate", "the", "purity", "at", "every", "time", "step" ]
[ "\"\"\"\n perform the propagation of the dynamics and calculate the purity at\n every time step\n :param dt: time step\n :param v_2d: list\n potential matrices in 2D\n :param psi_grid_0: list\n the initial state\n :param num_steps: the number of the time steps\n ...
[ { "param": "dt", "type": null }, { "param": "v_2d", "type": null }, { "param": "psi0", "type": null }, { "param": "num_steps", "type": null } ]
{ "returns": [ { "docstring": "list\nthe final state\npurity: float array\npurity values at each time point", "docstring_tokens": [ "list", "the", "final", "state", "purity", ":", "float", "array", "purity", "values", ...
ca86dee7bcc1fab5d475a8009b0f639e011f0cf0
binggu56/lime
examples/f_lor.py
[ "MIT" ]
Python
f_lor
<not_specific>
def f_lor ( t, y ): """ Right hand side for the Lorenz system """ a=10. r=70. r=28 b=8./3. f=zeros(3) f[0]=-a*y[0]+a*y[1] f[1]=r*y[0]-y[1]-y[0]*y[2] f[2]=-b*y[2]+y[0]*y[1] return(f)
Right hand side for the Lorenz system
Right hand side for the Lorenz system
[ "Right", "hand", "side", "for", "the", "Lorenz", "system" ]
def f_lor ( t, y ): a=10. r=70. r=28 b=8./3. f=zeros(3) f[0]=-a*y[0]+a*y[1] f[1]=r*y[0]-y[1]-y[0]*y[2] f[2]=-b*y[2]+y[0]*y[1] return(f)
[ "def", "f_lor", "(", "t", ",", "y", ")", ":", "a", "=", "10.", "r", "=", "70.", "r", "=", "28", "b", "=", "8.", "/", "3.", "f", "=", "zeros", "(", "3", ")", "f", "[", "0", "]", "=", "-", "a", "*", "y", "[", "0", "]", "+", "a", "*", ...
Right hand side for the Lorenz system
[ "Right", "hand", "side", "for", "the", "Lorenz", "system" ]
[ "\"\"\"\n Right hand side for the Lorenz system\n \"\"\"" ]
[ { "param": "t", "type": null }, { "param": "y", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": null, "docstring_tokens": [], ...
402aa32b9405745b4ddec63a26644b340a2641f1
binggu56/lime
lime/wpd.py
[ "MIT" ]
Python
gwp
<not_specific>
def gwp(x, a, x0=0., p0=0.): """ a Gaussian wave packet centered at x0, with momentum k0 """ return (a/np.sqrt(np.pi))**(-0.25)*\ np.exp(-0.5 * a * (x - x0)**2 + 1j * (x-x0) * p0)
a Gaussian wave packet centered at x0, with momentum k0
a Gaussian wave packet centered at x0, with momentum k0
[ "a", "Gaussian", "wave", "packet", "centered", "at", "x0", "with", "momentum", "k0" ]
def gwp(x, a, x0=0., p0=0.): return (a/np.sqrt(np.pi))**(-0.25)*\ np.exp(-0.5 * a * (x - x0)**2 + 1j * (x-x0) * p0)
[ "def", "gwp", "(", "x", ",", "a", ",", "x0", "=", "0.", ",", "p0", "=", "0.", ")", ":", "return", "(", "a", "/", "np", ".", "sqrt", "(", "np", ".", "pi", ")", ")", "**", "(", "-", "0.25", ")", "*", "np", ".", "exp", "(", "-", "0.5", "...
a Gaussian wave packet centered at x0, with momentum k0
[ "a", "Gaussian", "wave", "packet", "centered", "at", "x0", "with", "momentum", "k0" ]
[ "\"\"\"\n a Gaussian wave packet centered at x0, with momentum k0\n \"\"\"" ]
[ { "param": "x", "type": null }, { "param": "a", "type": null }, { "param": "x0", "type": null }, { "param": "p0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [], ...
a6310d4f6a7d7947aeb6cab8c1a9745d032f76cc
binggu56/lime
lime/namd/adiabats_1d.py
[ "MIT" ]
Python
propagate
<not_specific>
def propagate(self, dt, psi_x, Nsteps = 1): """ Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the num...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters ---------- dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change ...
Perform a series of time-steps via the time-dependent Schrodinger Equation. Parameters dt : float the small time interval over which to integrate Nsteps : float, optional the number of intervals to compute. The total change in time at the end of this method will be dt * Nsteps. default is N = 1
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", ".", "Parameters", "dt", ":", "float", "the", "small", "time", "interval", "over", "which", "to", "integrate", "Nsteps", ":", "float", ...
def propagate(self, dt, psi_x, Nsteps = 1): if dt > 0.0: f = open('density_matrix.dat', 'w') else: f = open('density_matrix_backward.dat', 'w') x = self.x V_x = self.V_x nx = len(x) nstates = self.nstates dt2 = 0.5 * dt vpsi = np.ze...
[ "def", "propagate", "(", "self", ",", "dt", ",", "psi_x", ",", "Nsteps", "=", "1", ")", ":", "if", "dt", ">", "0.0", ":", "f", "=", "open", "(", "'density_matrix.dat'", ",", "'w'", ")", "else", ":", "f", "=", "open", "(", "'density_matrix_backward.da...
Perform a series of time-steps via the time-dependent Schrodinger Equation.
[ "Perform", "a", "series", "of", "time", "-", "steps", "via", "the", "time", "-", "dependent", "Schrodinger", "Equation", "." ]
[ "\"\"\"\n Perform a series of time-steps via the time-dependent\n Schrodinger Equation.\n\n Parameters\n ----------\n dt : float\n the small time interval over which to integrate\n\n Nsteps : float, optional\n the number of intervals to compute. The t...
[ { "param": "self", "type": null }, { "param": "dt", "type": null }, { "param": "psi_x", "type": null }, { "param": "Nsteps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dt", "type": null, "docstring": null, "docstring_tokens": [],...
6044a2a36c1acab78d37e03cc5c14c66ab3ee3fd
AmineKheldouni/DirectFuturePrediction
DFP/segmentation_image.py
[ "MIT" ]
Python
display_medkit_mask
<not_specific>
def display_medkit_mask(image, mask, regions, class_ids, scores, CLASS_NAMES): """Display the given image and the top few class masks.""" to_display = [] to_display.append(image) # Pick top prominent classes in this image chosen_class_ids = [] if len(class_ids) > 0: for i in range(len(cl...
Display the given image and the top few class masks.
Display the given image and the top few class masks.
[ "Display", "the", "given", "image", "and", "the", "top", "few", "class", "masks", "." ]
def display_medkit_mask(image, mask, regions, class_ids, scores, CLASS_NAMES): to_display = [] to_display.append(image) chosen_class_ids = [] if len(class_ids) > 0: for i in range(len(class_ids)): if not class_ids[i] in chosen_class_ids and class_ids[i] in [6,8]: chos...
[ "def", "display_medkit_mask", "(", "image", ",", "mask", ",", "regions", ",", "class_ids", ",", "scores", ",", "CLASS_NAMES", ")", ":", "to_display", "=", "[", "]", "to_display", ".", "append", "(", "image", ")", "chosen_class_ids", "=", "[", "]", "if", ...
Display the given image and the top few class masks.
[ "Display", "the", "given", "image", "and", "the", "top", "few", "class", "masks", "." ]
[ "\"\"\"Display the given image and the top few class masks.\"\"\"", "# Pick top prominent classes in this image", "# Generate images and titles", "# Pull masks of instances belonging to the same class.", "# to_display.append(m)", "# visualize.display_images(to_display, titles=['simulator image', 'medkit m...
[ { "param": "image", "type": null }, { "param": "mask", "type": null }, { "param": "regions", "type": null }, { "param": "class_ids", "type": null }, { "param": "scores", "type": null }, { "param": "CLASS_NAMES", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "image", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mask", "type": null, "docstring": null, "docstring_tokens": ...
022d6bde4ea3deb18120030ea49cc677e67aa940
AmineKheldouni/DirectFuturePrediction
DDQN_REINFORCE_A2C/ddqn_yo.py
[ "MIT" ]
Python
update_target_model
null
def update_target_model(self): """ After some time interval update the target model to be same with model """ self.target_model.set_weights(self.model.get_weights())
After some time interval update the target model to be same with model
After some time interval update the target model to be same with model
[ "After", "some", "time", "interval", "update", "the", "target", "model", "to", "be", "same", "with", "model" ]
def update_target_model(self): self.target_model.set_weights(self.model.get_weights())
[ "def", "update_target_model", "(", "self", ")", ":", "self", ".", "target_model", ".", "set_weights", "(", "self", ".", "model", ".", "get_weights", "(", ")", ")" ]
After some time interval update the target model to be same with model
[ "After", "some", "time", "interval", "update", "the", "target", "model", "to", "be", "same", "with", "model" ]
[ "\"\"\"\n After some time interval update the target model to be same with model\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e3756658e05779a66708329c58061e3df2bf0aac
AmineKheldouni/DirectFuturePrediction
DFP/extended_network.py
[ "MIT" ]
Python
dfp_network
<not_specific>
def dfp_network(input_shape, measurement_size, goal_size, action_size, num_timesteps, learning_rate): """ Neural Network for Direct Future Predition (DFP) """ # Perception Feature state_input = Input(shape=(input_shape)) perception_feat = Convolution2D(32, 8, 8, subsampl...
Neural Network for Direct Future Predition (DFP)
Neural Network for Direct Future Predition (DFP)
[ "Neural", "Network", "for", "Direct", "Future", "Predition", "(", "DFP", ")" ]
def dfp_network(input_shape, measurement_size, goal_size, action_size, num_timesteps, learning_rate): state_input = Input(shape=(input_shape)) perception_feat = Convolution2D(32, 8, 8, subsample=(4,4), activation='relu')(state_input) perception_feat = Convolution2D(64, 4, 4, subsample=(2,2), act...
[ "def", "dfp_network", "(", "input_shape", ",", "measurement_size", ",", "goal_size", ",", "action_size", ",", "num_timesteps", ",", "learning_rate", ")", ":", "state_input", "=", "Input", "(", "shape", "=", "(", "input_shape", ")", ")", "perception_feat", "=", ...
Neural Network for Direct Future Predition (DFP)
[ "Neural", "Network", "for", "Direct", "Future", "Predition", "(", "DFP", ")" ]
[ "\"\"\"\n Neural Network for Direct Future Predition (DFP)\n \"\"\"", "# Perception Feature", "# Measurement Feature", "# Goal Feature", "# 3 measurements, 6 timesteps" ]
[ { "param": "input_shape", "type": null }, { "param": "measurement_size", "type": null }, { "param": "goal_size", "type": null }, { "param": "action_size", "type": null }, { "param": "num_timesteps", "type": null }, { "param": "learning_rate", "type...
{ "returns": [], "raises": [], "params": [ { "identifier": "input_shape", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "measurement_size", "type": null, "docstring": null, "d...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
import_subj_myo
<not_specific>
def import_subj_myo(folder_path, subject, expts=1): """Get data from Myo experiment for v1 testing.""" nb_expts = np.size(expts) if nb_expts < 1: raise ValueError("Experiment ID(s) argument, 'expts', must have atleast 1 value.") expts = np.asarray(expts) # In case scalar file_name =...
Get data from Myo experiment for v1 testing.
Get data from Myo experiment for v1 testing.
[ "Get", "data", "from", "Myo", "experiment", "for", "v1", "testing", "." ]
def import_subj_myo(folder_path, subject, expts=1): nb_expts = np.size(expts) if nb_expts < 1: raise ValueError("Experiment ID(s) argument, 'expts', must have atleast 1 value.") expts = np.asarray(expts) file_name = "s{}_ex{}.mat".format(subject, expts.item(0)) file_path = os.path.join(fol...
[ "def", "import_subj_myo", "(", "folder_path", ",", "subject", ",", "expts", "=", "1", ")", ":", "nb_expts", "=", "np", ".", "size", "(", "expts", ")", "if", "nb_expts", "<", "1", ":", "raise", "ValueError", "(", "\"Experiment ID(s) argument, 'expts', must have...
Get data from Myo experiment for v1 testing.
[ "Get", "data", "from", "Myo", "experiment", "for", "v1", "testing", "." ]
[ "\"\"\"Get data from Myo experiment for v1 testing.\"\"\"", "# In case scalar\r", "# Label experiments as later repetitions\r" ]
[ { "param": "folder_path", "type": null }, { "param": "subject", "type": null }, { "param": "expts", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "folder_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "subject", "type": null, "docstring": null, "docstring_...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
import_subj_delsys
<not_specific>
def import_subj_delsys(folder_path, subject, expts=1): """Get data from Myo experiment for v1 testing.""" nb_expts = np.size(expts) if nb_expts < 1: raise ValueError("Experiment ID(s) argument, 'expts', must have atleast 1 value.") expts = np.asarray(expts) # In case scalar file_nam...
Get data from Myo experiment for v1 testing.
Get data from Myo experiment for v1 testing.
[ "Get", "data", "from", "Myo", "experiment", "for", "v1", "testing", "." ]
def import_subj_delsys(folder_path, subject, expts=1): nb_expts = np.size(expts) if nb_expts < 1: raise ValueError("Experiment ID(s) argument, 'expts', must have atleast 1 value.") expts = np.asarray(expts) file_name = "s{}_ex{}_delsys.mat".format(subject, expts.item(0)) file_path = os.pat...
[ "def", "import_subj_delsys", "(", "folder_path", ",", "subject", ",", "expts", "=", "1", ")", ":", "nb_expts", "=", "np", ".", "size", "(", "expts", ")", "if", "nb_expts", "<", "1", ":", "raise", "ValueError", "(", "\"Experiment ID(s) argument, 'expts', must h...
Get data from Myo experiment for v1 testing.
[ "Get", "data", "from", "Myo", "experiment", "for", "v1", "testing", "." ]
[ "\"\"\"Get data from Myo experiment for v1 testing.\"\"\"", "# In case scalar\r", "# Label experiments as later repetitions\r" ]
[ { "param": "folder_path", "type": null }, { "param": "subject", "type": null }, { "param": "expts", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "folder_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "subject", "type": null, "docstring": null, "docstring_...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
import_supplemental
<not_specific>
def import_supplemental(file_path): """Get data from a supplemental file""" data = sio.loadmat(file_path) data['move'] = np.squeeze(data['move']) data['rep'] = np.squeeze(data['rep']) data['emg_time'] = np.squeeze(data['emg_time']) return data
Get data from a supplemental file
Get data from a supplemental file
[ "Get", "data", "from", "a", "supplemental", "file" ]
def import_supplemental(file_path): data = sio.loadmat(file_path) data['move'] = np.squeeze(data['move']) data['rep'] = np.squeeze(data['rep']) data['emg_time'] = np.squeeze(data['emg_time']) return data
[ "def", "import_supplemental", "(", "file_path", ")", ":", "data", "=", "sio", ".", "loadmat", "(", "file_path", ")", "data", "[", "'move'", "]", "=", "np", ".", "squeeze", "(", "data", "[", "'move'", "]", ")", "data", "[", "'rep'", "]", "=", "np", ...
Get data from a supplemental file
[ "Get", "data", "from", "a", "supplemental", "file" ]
[ "\"\"\"Get data from a supplemental file\"\"\"" ]
[ { "param": "file_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
gen_split_balanced
<not_specific>
def gen_split_balanced(rep_ids, nb_test, base=None): """Create a balanced split for training and testing based on repetitions (all reps equally tested + trained on) . Args: rep_ids (array): Repetition identifiers to split nb_test (int): The number of repetitions to be used for testing in e...
Create a balanced split for training and testing based on repetitions (all reps equally tested + trained on) . Args: rep_ids (array): Repetition identifiers to split nb_test (int): The number of repetitions to be used for testing in each each split base (array, optional): A specific te...
Create a balanced split for training and testing based on repetitions (all reps equally tested + trained on) .
[ "Create", "a", "balanced", "split", "for", "training", "and", "testing", "based", "on", "repetitions", "(", "all", "reps", "equally", "tested", "+", "trained", "on", ")", "." ]
def gen_split_balanced(rep_ids, nb_test, base=None): nb_reps = rep_ids.shape[0] nb_splits = nb_reps train_reps = np.zeros((nb_splits, nb_reps - nb_test,), dtype=int) test_reps = np.zeros((nb_splits, nb_test), dtype=int) all_combos = combinations(rep_ids, nb_test) all_combos = np.fromiter(chain.f...
[ "def", "gen_split_balanced", "(", "rep_ids", ",", "nb_test", ",", "base", "=", "None", ")", ":", "nb_reps", "=", "rep_ids", ".", "shape", "[", "0", "]", "nb_splits", "=", "nb_reps", "train_reps", "=", "np", ".", "zeros", "(", "(", "nb_splits", ",", "nb...
Create a balanced split for training and testing based on repetitions (all reps equally tested + trained on) .
[ "Create", "a", "balanced", "split", "for", "training", "and", "testing", "based", "on", "repetitions", "(", "all", "reps", "equally", "tested", "+", "trained", "on", ")", "." ]
[ "\"\"\"Create a balanced split for training and testing based on repetitions (all reps equally tested + trained on) .\r\n\r\n Args:\r\n rep_ids (array): Repetition identifiers to split\r\n nb_test (int): The number of repetitions to be used for testing in each each split\r\n base (array, opt...
[ { "param": "rep_ids", "type": null }, { "param": "nb_test", "type": null }, { "param": "base", "type": null } ]
{ "returns": [ { "docstring": "Training repetitions and corresponding test repetitions as 2D arrays [[set 1], [set 2] ..]", "docstring_tokens": [ "Training", "repetitions", "and", "corresponding", "test", "repetitions", "as", "2D", ...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
gen_ttv_balanced
<not_specific>
def gen_ttv_balanced(rep_ids, nb_test, nb_val, split_multiplier=1, base=None): """Create a balanced split for training, testing and validation based on repetitions. Args: rep_ids (array): Repetition identifiers to split nb_test (int): The number of repetitions to be used for testing in eac...
Create a balanced split for training, testing and validation based on repetitions. Args: rep_ids (array): Repetition identifiers to split nb_test (int): The number of repetitions to be used for testing in each each split nb_val (int): The number of repetitions to be used for validation...
Create a balanced split for training, testing and validation based on repetitions.
[ "Create", "a", "balanced", "split", "for", "training", "testing", "and", "validation", "based", "on", "repetitions", "." ]
def gen_ttv_balanced(rep_ids, nb_test, nb_val, split_multiplier=1, base=None): nb_reps = rep_ids.shape[0] nb_splits = nb_reps * split_multiplier train_val_pool_reps = np.zeros((nb_splits, nb_reps - nb_test,), dtype=int) train_reps = np.zeros((nb_splits, nb_reps - nb_test - nb_val,), dtype=int) test_...
[ "def", "gen_ttv_balanced", "(", "rep_ids", ",", "nb_test", ",", "nb_val", ",", "split_multiplier", "=", "1", ",", "base", "=", "None", ")", ":", "nb_reps", "=", "rep_ids", ".", "shape", "[", "0", "]", "nb_splits", "=", "nb_reps", "*", "split_multiplier", ...
Create a balanced split for training, testing and validation based on repetitions.
[ "Create", "a", "balanced", "split", "for", "training", "testing", "and", "validation", "based", "on", "repetitions", "." ]
[ "\"\"\"Create a balanced split for training, testing and validation based on repetitions.\r\n\r\n Args:\r\n rep_ids (array): Repetition identifiers to split\r\n nb_test (int): The number of repetitions to be used for testing in each each split\r\n nb_val (int): The number of repetitions to b...
[ { "param": "rep_ids", "type": null }, { "param": "nb_test", "type": null }, { "param": "nb_val", "type": null }, { "param": "split_multiplier", "type": null }, { "param": "base", "type": null } ]
{ "returns": [ { "docstring": "Training repetitions and corresponding test repetitions as 2D arrays [[set 1], [set 2] ..]", "docstring_tokens": [ "Training", "repetitions", "and", "corresponding", "test", "repetitions", "as", "2D", ...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
normalise_by_rep
<not_specific>
def normalise_by_rep(emg, rep, train_reps): """Preprocess train+test data to mean 0, std 1 based on training data only.""" # Locate valid window end indices (window must be window_len long and window_inc away from last) train_idx = np.where(np.in1d(rep, train_reps)) scaler = StandardScaler(with_me...
Preprocess train+test data to mean 0, std 1 based on training data only.
Preprocess train+test data to mean 0, std 1 based on training data only.
[ "Preprocess", "train", "+", "test", "data", "to", "mean", "0", "std", "1", "based", "on", "training", "data", "only", "." ]
def normalise_by_rep(emg, rep, train_reps): train_idx = np.where(np.in1d(rep, train_reps)) scaler = StandardScaler(with_mean=True, with_std=True, copy=False).fit(emg[train_idx]) return scaler.transform(emg), scaler
[ "def", "normalise_by_rep", "(", "emg", ",", "rep", ",", "train_reps", ")", ":", "train_idx", "=", "np", ".", "where", "(", "np", ".", "in1d", "(", "rep", ",", "train_reps", ")", ")", "scaler", "=", "StandardScaler", "(", "with_mean", "=", "True", ",", ...
Preprocess train+test data to mean 0, std 1 based on training data only.
[ "Preprocess", "train", "+", "test", "data", "to", "mean", "0", "std", "1", "based", "on", "training", "data", "only", "." ]
[ "\"\"\"Preprocess train+test data to mean 0, std 1 based on training data only.\"\"\"", "# Locate valid window end indices (window must be window_len long and window_inc away from last)\r" ]
[ { "param": "emg", "type": null }, { "param": "rep", "type": null }, { "param": "train_reps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "emg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rep", "type": null, "docstring": null, "docstring_tokens": [],...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
window_emg
<not_specific>
def window_emg(window_len, window_inc, emg, move, rep, which_moves=None, which_reps=None, emg_dtype=np.float32, y_dtype=np.int8, r_dtype=np.int8): """Window the EMG data explicitly. If using which_moves then y_data will be indices into which_moves rather than the original movement label; thi...
Window the EMG data explicitly. If using which_moves then y_data will be indices into which_moves rather than the original movement label; this is to fix issues in some machine learning libraries such as Tensorflow which have issues using sparse categorical cross-entropy and non-sequential labels.
Window the EMG data explicitly. If using which_moves then y_data will be indices into which_moves rather than the original movement label; this is to fix issues in some machine learning libraries such as Tensorflow which have issues using sparse categorical cross-entropy and non-sequential labels.
[ "Window", "the", "EMG", "data", "explicitly", ".", "If", "using", "which_moves", "then", "y_data", "will", "be", "indices", "into", "which_moves", "rather", "than", "the", "original", "movement", "label", ";", "this", "is", "to", "fix", "issues", "in", "some...
def window_emg(window_len, window_inc, emg, move, rep, which_moves=None, which_reps=None, emg_dtype=np.float32, y_dtype=np.int8, r_dtype=np.int8): nb_obs = emg.shape[0] nb_channels = emg.shape[1] targets = np.array(range(window_len - 1, nb_obs, window_inc)) if which_moves is not None: ...
[ "def", "window_emg", "(", "window_len", ",", "window_inc", ",", "emg", ",", "move", ",", "rep", ",", "which_moves", "=", "None", ",", "which_reps", "=", "None", ",", "emg_dtype", "=", "np", ".", "float32", ",", "y_dtype", "=", "np", ".", "int8", ",", ...
Window the EMG data explicitly.
[ "Window", "the", "EMG", "data", "explicitly", "." ]
[ "\"\"\"Window the EMG data explicitly.\r\n\r\n If using which_moves then y_data will be indices into which_moves rather than the original movement label; this is\r\n to fix issues in some machine learning libraries such as Tensorflow which have issues using sparse categorical\r\n cross-entropy and non-sequ...
[ { "param": "window_len", "type": null }, { "param": "window_inc", "type": null }, { "param": "emg", "type": null }, { "param": "move", "type": null }, { "param": "rep", "type": null }, { "param": "which_moves", "type": null }, { "param": "w...
{ "returns": [], "raises": [], "params": [ { "identifier": "window_len", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "window_inc", "type": null, "docstring": null, "docstrin...
aff683f03f3f48328bb94539023c5e0b16c2686e
Lif3line/myo-helper
myo_helper/myo_helper.py
[ "MIT" ]
Python
save_object
null
def save_object(obj, filename): """Simple function for saving an object with pickle to a file. Create dir + file if neccessary.""" filename = os.path.normpath(filename) if not os.path.exists(os.path.dirname(filename)): try: os.makedirs(os.path.dirname(filename)) except OS...
Simple function for saving an object with pickle to a file. Create dir + file if neccessary.
Simple function for saving an object with pickle to a file. Create dir + file if neccessary.
[ "Simple", "function", "for", "saving", "an", "object", "with", "pickle", "to", "a", "file", ".", "Create", "dir", "+", "file", "if", "neccessary", "." ]
def save_object(obj, filename): filename = os.path.normpath(filename) if not os.path.exists(os.path.dirname(filename)): try: os.makedirs(os.path.dirname(filename)) except OSError as exc: if exc.errno != errno.EEXIST: raise with open(filename, 'wb+') ...
[ "def", "save_object", "(", "obj", ",", "filename", ")", ":", "filename", "=", "os", ".", "path", ".", "normpath", "(", "filename", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "filename", ")", ")"...
Simple function for saving an object with pickle to a file.
[ "Simple", "function", "for", "saving", "an", "object", "with", "pickle", "to", "a", "file", "." ]
[ "\"\"\"Simple function for saving an object with pickle to a file. Create dir + file if neccessary.\"\"\"", "# Guard against race condition\r" ]
[ { "param": "obj", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens"...
f137566cc67c8e94049ae6d8b93ba541e69913c6
ImJustTatan/borg
functions.py
[ "MIT" ]
Python
plinput
<not_specific>
def plinput(): """Requests player input (for commands).""" print('\n{}'.format(larrow), end='\0') r = input() return r
Requests player input (for commands).
Requests player input (for commands).
[ "Requests", "player", "input", "(", "for", "commands", ")", "." ]
def plinput(): print('\n{}'.format(larrow), end='\0') r = input() return r
[ "def", "plinput", "(", ")", ":", "print", "(", "'\\n{}'", ".", "format", "(", "larrow", ")", ",", "end", "=", "'\\0'", ")", "r", "=", "input", "(", ")", "return", "r" ]
Requests player input (for commands).
[ "Requests", "player", "input", "(", "for", "commands", ")", "." ]
[ "\"\"\"Requests player input (for commands).\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f137566cc67c8e94049ae6d8b93ba541e69913c6
ImJustTatan/borg
functions.py
[ "MIT" ]
Python
dacts
null
def dacts(m): """Displays available commands (given by the only parameter).""" if m == None: cprint('\nNo actions are available!', 'red', attrs=['bold']) else: print(actmessages, end='\0') print('{}.'.format(m))
Displays available commands (given by the only parameter).
Displays available commands (given by the only parameter).
[ "Displays", "available", "commands", "(", "given", "by", "the", "only", "parameter", ")", "." ]
def dacts(m): if m == None: cprint('\nNo actions are available!', 'red', attrs=['bold']) else: print(actmessages, end='\0') print('{}.'.format(m))
[ "def", "dacts", "(", "m", ")", ":", "if", "m", "==", "None", ":", "cprint", "(", "'\\nNo actions are available!'", ",", "'red'", ",", "attrs", "=", "[", "'bold'", "]", ")", "else", ":", "print", "(", "actmessages", ",", "end", "=", "'\\0'", ")", "pri...
Displays available commands (given by the only parameter).
[ "Displays", "available", "commands", "(", "given", "by", "the", "only", "parameter", ")", "." ]
[ "\"\"\"Displays available commands (given by the only parameter).\"\"\"" ]
[ { "param": "m", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aed047fd6d4dec8ded7be40921e426be87104f0d
ImJustTatan/borg
classes.py
[ "MIT" ]
Python
chstate
null
def chstate(self, s): """Changes the enemy's state to the one given by the parameter 's'.""" self.state = s.lower() if s == 'dead': self.hp = 0 cprint('\nYou killed the {}.'.format(self.name), 'red', attrs=['bold']) else: self.hp = self.hp
Changes the enemy's state to the one given by the parameter 's'.
Changes the enemy's state to the one given by the parameter 's'.
[ "Changes", "the", "enemy", "'", "s", "state", "to", "the", "one", "given", "by", "the", "parameter", "'", "s", "'", "." ]
def chstate(self, s): self.state = s.lower() if s == 'dead': self.hp = 0 cprint('\nYou killed the {}.'.format(self.name), 'red', attrs=['bold']) else: self.hp = self.hp
[ "def", "chstate", "(", "self", ",", "s", ")", ":", "self", ".", "state", "=", "s", ".", "lower", "(", ")", "if", "s", "==", "'dead'", ":", "self", ".", "hp", "=", "0", "cprint", "(", "'\\nYou killed the {}.'", ".", "format", "(", "self", ".", "na...
Changes the enemy's state to the one given by the parameter 's'.
[ "Changes", "the", "enemy", "'", "s", "state", "to", "the", "one", "given", "by", "the", "parameter", "'", "s", "'", "." ]
[ "\"\"\"Changes the enemy's state to the one given by the parameter 's'.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "s", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s", "type": null, "docstring": null, "docstring_tokens": [], ...
aed047fd6d4dec8ded7be40921e426be87104f0d
ImJustTatan/borg
classes.py
[ "MIT" ]
Python
shstate
null
def shstate(self): """Displays the enemy's state.""" if self.state == 'dead': cprint('\nThe {} is dead. {}.'.format(self.name, sphrases["dstatements"][random.randint(0, 4)]), attrs=['bold']) elif self.state == 'alive': cprint('\n{}'.format(self.desc), attrs=['bold']) else: cprint('An error occur...
Displays the enemy's state.
Displays the enemy's state.
[ "Displays", "the", "enemy", "'", "s", "state", "." ]
def shstate(self): if self.state == 'dead': cprint('\nThe {} is dead. {}.'.format(self.name, sphrases["dstatements"][random.randint(0, 4)]), attrs=['bold']) elif self.state == 'alive': cprint('\n{}'.format(self.desc), attrs=['bold']) else: cprint('An error occured when trying to show this enemy\'s ...
[ "def", "shstate", "(", "self", ")", ":", "if", "self", ".", "state", "==", "'dead'", ":", "cprint", "(", "'\\nThe {} is dead. {}.'", ".", "format", "(", "self", ".", "name", ",", "sphrases", "[", "\"dstatements\"", "]", "[", "random", ".", "randint", "("...
Displays the enemy's state.
[ "Displays", "the", "enemy", "'", "s", "state", "." ]
[ "\"\"\"Displays the enemy's state.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
aed047fd6d4dec8ded7be40921e426be87104f0d
ImJustTatan/borg
classes.py
[ "MIT" ]
Python
ghit
null
def ghit(self, hpm1, hpm2): """Function to get hit. 'hpm' is the amount of HP taken.""" hpm = random.randint(hpm1, hpm2) self.hp -= hpm cprint('\nThe {} has taken {} points of damage! Remaining HP: {}'.format(colored(self.name, attrs=['bold']), colored(str(hpm), 'green', attrs=['bold']), colored(str(self.hp...
Function to get hit. 'hpm' is the amount of HP taken.
Function to get hit. 'hpm' is the amount of HP taken.
[ "Function", "to", "get", "hit", ".", "'", "hpm", "'", "is", "the", "amount", "of", "HP", "taken", "." ]
def ghit(self, hpm1, hpm2): hpm = random.randint(hpm1, hpm2) self.hp -= hpm cprint('\nThe {} has taken {} points of damage! Remaining HP: {}'.format(colored(self.name, attrs=['bold']), colored(str(hpm), 'green', attrs=['bold']), colored(str(self.hp), 'green', attrs=['bold']))) if self.hp <= 0: self.chst...
[ "def", "ghit", "(", "self", ",", "hpm1", ",", "hpm2", ")", ":", "hpm", "=", "random", ".", "randint", "(", "hpm1", ",", "hpm2", ")", "self", ".", "hp", "-=", "hpm", "cprint", "(", "'\\nThe {} has taken {} points of damage! Remaining HP: {}'", ".", "format", ...
Function to get hit.
[ "Function", "to", "get", "hit", "." ]
[ "\"\"\"Function to get hit. 'hpm' is the amount of HP taken.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "hpm1", "type": null }, { "param": "hpm2", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hpm1", "type": null, "docstring": null, "docstring_tokens": [...
4ecc03cd5c42ecbcc4c4c87c19e48fa27a4437fe
bostroesser/rtslib-fb
rtslib/root.py
[ "Apache-2.0" ]
Python
_get_saveconf
<not_specific>
def _get_saveconf(self, so_path, save_file): ''' Fetch the configuration of all the blocks and return conf with updated storageObject info and its related target configuraion of given storage object path ''' current = self.dump() try: with open(save_f...
Fetch the configuration of all the blocks and return conf with updated storageObject info and its related target configuraion of given storage object path
Fetch the configuration of all the blocks and return conf with updated storageObject info and its related target configuraion of given storage object path
[ "Fetch", "the", "configuration", "of", "all", "the", "blocks", "and", "return", "conf", "with", "updated", "storageObject", "info", "and", "its", "related", "target", "configuraion", "of", "given", "storage", "object", "path" ]
def _get_saveconf(self, so_path, save_file): current = self.dump() try: with open(save_file, "r") as f: saveconf = json.loads(f.read()) except IOError as e: if e.errno == errno.ENOENT: saveconf = {'storage_objects': [], 'targets': []} ...
[ "def", "_get_saveconf", "(", "self", ",", "so_path", ",", "save_file", ")", ":", "current", "=", "self", ".", "dump", "(", ")", "try", ":", "with", "open", "(", "save_file", ",", "\"r\"", ")", "as", "f", ":", "saveconf", "=", "json", ".", "loads", ...
Fetch the configuration of all the blocks and return conf with updated storageObject info and its related target configuraion of given storage object path
[ "Fetch", "the", "configuration", "of", "all", "the", "blocks", "and", "return", "conf", "with", "updated", "storageObject", "info", "and", "its", "related", "target", "configuraion", "of", "given", "storage", "object", "path" ]
[ "'''\n Fetch the configuration of all the blocks and return conf with\n updated storageObject info and its related target configuraion of\n given storage object path\n '''", "# Get the given block current storageObj configuration", "# Get the given block current target configuration"...
[ { "param": "self", "type": null }, { "param": "so_path", "type": null }, { "param": "save_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "so_path", "type": null, "docstring": null, "docstring_tokens"...
4ecc03cd5c42ecbcc4c4c87c19e48fa27a4437fe
bostroesser/rtslib-fb
rtslib/root.py
[ "Apache-2.0" ]
Python
dump
<not_specific>
def dump(self): ''' Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore(). ''' d = super(RTSRoot, self).dump() d['storage_objects'] = [so.dump() for so in self.storage_objects...
Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore().
Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore().
[ "Returns", "a", "dict", "representing", "the", "complete", "state", "of", "the", "target", "config", "suitable", "for", "serialization", "/", "deserialization", "and", "then", "handing", "to", "restore", "()", "." ]
def dump(self): d = super(RTSRoot, self).dump() d['storage_objects'] = [so.dump() for so in self.storage_objects] d['targets'] = [t.dump() for t in self.targets] d['fabric_modules'] = [f.dump() for f in self.fabric_modules if f.has_feature("discovery_auth")...
[ "def", "dump", "(", "self", ")", ":", "d", "=", "super", "(", "RTSRoot", ",", "self", ")", ".", "dump", "(", ")", "d", "[", "'storage_objects'", "]", "=", "[", "so", ".", "dump", "(", ")", "for", "so", "in", "self", ".", "storage_objects", "]", ...
Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore().
[ "Returns", "a", "dict", "representing", "the", "complete", "state", "of", "the", "target", "config", "suitable", "for", "serialization", "/", "deserialization", "and", "then", "handing", "to", "restore", "()", "." ]
[ "'''\n Returns a dict representing the complete state of the target\n config, suitable for serialization/deserialization, and then\n handing to restore().\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ecc03cd5c42ecbcc4c4c87c19e48fa27a4437fe
bostroesser/rtslib-fb
rtslib/root.py
[ "Apache-2.0" ]
Python
restore
<not_specific>
def restore(self, config, target=None, storage_object=None, clear_existing=False, abort_on_error=False): ''' Takes a dict generated by dump() and reconfigures the target to match. Returns list of non-fatal errors that were encountered. Will refuse to restore over an exist...
Takes a dict generated by dump() and reconfigures the target to match. Returns list of non-fatal errors that were encountered. Will refuse to restore over an existing configuration unless clear_existing is True.
Takes a dict generated by dump() and reconfigures the target to match. Returns list of non-fatal errors that were encountered. Will refuse to restore over an existing configuration unless clear_existing is True.
[ "Takes", "a", "dict", "generated", "by", "dump", "()", "and", "reconfigures", "the", "target", "to", "match", ".", "Returns", "list", "of", "non", "-", "fatal", "errors", "that", "were", "encountered", ".", "Will", "refuse", "to", "restore", "over", "an", ...
def restore(self, config, target=None, storage_object=None, clear_existing=False, abort_on_error=False): if clear_existing: self.clear_existing(target, storage_object, confirm=True) elif any(self.storage_objects) or any(self.targets): if any(self.storage_objects):...
[ "def", "restore", "(", "self", ",", "config", ",", "target", "=", "None", ",", "storage_object", "=", "None", ",", "clear_existing", "=", "False", ",", "abort_on_error", "=", "False", ")", ":", "if", "clear_existing", ":", "self", ".", "clear_existing", "(...
Takes a dict generated by dump() and reconfigures the target to match.
[ "Takes", "a", "dict", "generated", "by", "dump", "()", "and", "reconfigures", "the", "target", "to", "match", "." ]
[ "'''\n Takes a dict generated by dump() and reconfigures the target to match.\n Returns list of non-fatal errors that were encountered.\n Will refuse to restore over an existing configuration unless clear_existing\n is True.\n '''", "# * Restore/load the single matching stor...
[ { "param": "self", "type": null }, { "param": "config", "type": null }, { "param": "target", "type": null }, { "param": "storage_object", "type": null }, { "param": "clear_existing", "type": null }, { "param": "abort_on_error", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": null, "docstring": null, "docstring_tokens":...
4ecc03cd5c42ecbcc4c4c87c19e48fa27a4437fe
bostroesser/rtslib-fb
rtslib/root.py
[ "Apache-2.0" ]
Python
restore_from_file
<not_specific>
def restore_from_file(self, restore_file=None, clear_existing=True, target=None, storage_object=None, abort_on_error=False): ''' Restore the configuration from a file in json format. Restore file defaults to '/etc/target/saveconfig.json'. ...
Restore the configuration from a file in json format. Restore file defaults to '/etc/target/saveconfig.json'. Returns a list of non-fatal errors. If abort_on_error is set, it will raise the exception instead of continuing.
Restore the configuration from a file in json format. Restore file defaults to '/etc/target/saveconfig.json'. Returns a list of non-fatal errors. If abort_on_error is set, it will raise the exception instead of continuing.
[ "Restore", "the", "configuration", "from", "a", "file", "in", "json", "format", ".", "Restore", "file", "defaults", "to", "'", "/", "etc", "/", "target", "/", "saveconfig", ".", "json", "'", ".", "Returns", "a", "list", "of", "non", "-", "fatal", "erro...
def restore_from_file(self, restore_file=None, clear_existing=True, target=None, storage_object=None, abort_on_error=False): if not restore_file: restore_file = default_save_file with open(restore_file, "r") as f: config = json....
[ "def", "restore_from_file", "(", "self", ",", "restore_file", "=", "None", ",", "clear_existing", "=", "True", ",", "target", "=", "None", ",", "storage_object", "=", "None", ",", "abort_on_error", "=", "False", ")", ":", "if", "not", "restore_file", ":", ...
Restore the configuration from a file in json format.
[ "Restore", "the", "configuration", "from", "a", "file", "in", "json", "format", "." ]
[ "'''\n Restore the configuration from a file in json format.\n Restore file defaults to '/etc/target/saveconfig.json'.\n Returns a list of non-fatal errors. If abort_on_error is set,\n it will raise the exception instead of continuing.\n '''" ]
[ { "param": "self", "type": null }, { "param": "restore_file", "type": null }, { "param": "clear_existing", "type": null }, { "param": "target", "type": null }, { "param": "storage_object", "type": null }, { "param": "abort_on_error", "type": null ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "restore_file", "type": null, "docstring": null, "docstring_to...
4ecc03cd5c42ecbcc4c4c87c19e48fa27a4437fe
bostroesser/rtslib-fb
rtslib/root.py
[ "Apache-2.0" ]
Python
invalidate_caches
null
def invalidate_caches(self): ''' Invalidate any caches used throughout the hierarchy ''' bs_cache.clear()
Invalidate any caches used throughout the hierarchy
Invalidate any caches used throughout the hierarchy
[ "Invalidate", "any", "caches", "used", "throughout", "the", "hierarchy" ]
def invalidate_caches(self): bs_cache.clear()
[ "def", "invalidate_caches", "(", "self", ")", ":", "bs_cache", ".", "clear", "(", ")" ]
Invalidate any caches used throughout the hierarchy
[ "Invalidate", "any", "caches", "used", "throughout", "the", "hierarchy" ]
[ "'''\n Invalidate any caches used throughout the hierarchy\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
has_feature
<not_specific>
def has_feature(self, feature): ''' Whether or not this Target has a certain feature. ''' return self.fabric_module.has_feature(feature)
Whether or not this Target has a certain feature.
Whether or not this Target has a certain feature.
[ "Whether", "or", "not", "this", "Target", "has", "a", "certain", "feature", "." ]
def has_feature(self, feature): return self.fabric_module.has_feature(feature)
[ "def", "has_feature", "(", "self", ",", "feature", ")", ":", "return", "self", ".", "fabric_module", ".", "has_feature", "(", "feature", ")" ]
Whether or not this Target has a certain feature.
[ "Whether", "or", "not", "this", "Target", "has", "a", "certain", "feature", "." ]
[ "'''\n Whether or not this Target has a certain feature.\n '''" ]
[ { "param": "self", "type": null }, { "param": "feature", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "feature", "type": null, "docstring": null, "docstring_tokens"...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
delete
null
def delete(self): ''' Recursively deletes a Target object. This will delete all attached TPG objects and then the Target itself. ''' self._check_self() for tpg in self.tpgs: tpg.delete() super(Target, self).delete()
Recursively deletes a Target object. This will delete all attached TPG objects and then the Target itself.
Recursively deletes a Target object. This will delete all attached TPG objects and then the Target itself.
[ "Recursively", "deletes", "a", "Target", "object", ".", "This", "will", "delete", "all", "attached", "TPG", "objects", "and", "then", "the", "Target", "itself", "." ]
def delete(self): self._check_self() for tpg in self.tpgs: tpg.delete() super(Target, self).delete()
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_check_self", "(", ")", "for", "tpg", "in", "self", ".", "tpgs", ":", "tpg", ".", "delete", "(", ")", "super", "(", "Target", ",", "self", ")", ".", "delete", "(", ")" ]
Recursively deletes a Target object.
[ "Recursively", "deletes", "a", "Target", "object", "." ]
[ "'''\n Recursively deletes a Target object.\n This will delete all attached TPG objects and then the Target itself.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
_set_enable
null
def _set_enable(self, boolean): ''' Enables or disables the TPG. If the TPG doesn't support the enable attribute, do nothing. ''' self._check_self() path = "%s/enable" % self.path if os.path.isfile(path) and (boolean != self._get_enable()): try: ...
Enables or disables the TPG. If the TPG doesn't support the enable attribute, do nothing.
Enables or disables the TPG. If the TPG doesn't support the enable attribute, do nothing.
[ "Enables", "or", "disables", "the", "TPG", ".", "If", "the", "TPG", "doesn", "'", "t", "support", "the", "enable", "attribute", "do", "nothing", "." ]
def _set_enable(self, boolean): self._check_self() path = "%s/enable" % self.path if os.path.isfile(path) and (boolean != self._get_enable()): try: fwrite(path, str(int(boolean))) except IOError as e: raise RTSLibError("Cannot change enable...
[ "def", "_set_enable", "(", "self", ",", "boolean", ")", ":", "self", ".", "_check_self", "(", ")", "path", "=", "\"%s/enable\"", "%", "self", ".", "path", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", "and", "(", "boolean", "!=", "self", ...
Enables or disables the TPG.
[ "Enables", "or", "disables", "the", "TPG", "." ]
[ "'''\n Enables or disables the TPG. If the TPG doesn't support the enable\n attribute, do nothing.\n '''" ]
[ { "param": "self", "type": null }, { "param": "boolean", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "boolean", "type": null, "docstring": null, "docstring_tokens"...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
_get_nexus
<not_specific>
def _get_nexus(self): ''' Gets the nexus initiator WWN, or None if the TPG does not have one. ''' self._check_self() if self.has_feature('nexus'): try: nexus_wwn = fread("%s/nexus" % self.path) except IOError: nexus_wwn = ''...
Gets the nexus initiator WWN, or None if the TPG does not have one.
Gets the nexus initiator WWN, or None if the TPG does not have one.
[ "Gets", "the", "nexus", "initiator", "WWN", "or", "None", "if", "the", "TPG", "does", "not", "have", "one", "." ]
def _get_nexus(self): self._check_self() if self.has_feature('nexus'): try: nexus_wwn = fread("%s/nexus" % self.path) except IOError: nexus_wwn = '' return nexus_wwn else: return None
[ "def", "_get_nexus", "(", "self", ")", ":", "self", ".", "_check_self", "(", ")", "if", "self", ".", "has_feature", "(", "'nexus'", ")", ":", "try", ":", "nexus_wwn", "=", "fread", "(", "\"%s/nexus\"", "%", "self", ".", "path", ")", "except", "IOError"...
Gets the nexus initiator WWN, or None if the TPG does not have one.
[ "Gets", "the", "nexus", "initiator", "WWN", "or", "None", "if", "the", "TPG", "does", "not", "have", "one", "." ]
[ "'''\n Gets the nexus initiator WWN, or None if the TPG does not have one.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
_set_nexus
null
def _set_nexus(self, nexus_wwn=None): ''' Sets the nexus initiator WWN. Raises an exception if the nexus is already set or if the TPG does not use a nexus. ''' self._check_self() if not self.has_feature('nexus'): raise RTSLibError("The TPG does not use a nexu...
Sets the nexus initiator WWN. Raises an exception if the nexus is already set or if the TPG does not use a nexus.
Sets the nexus initiator WWN. Raises an exception if the nexus is already set or if the TPG does not use a nexus.
[ "Sets", "the", "nexus", "initiator", "WWN", ".", "Raises", "an", "exception", "if", "the", "nexus", "is", "already", "set", "or", "if", "the", "TPG", "does", "not", "use", "a", "nexus", "." ]
def _set_nexus(self, nexus_wwn=None): self._check_self() if not self.has_feature('nexus'): raise RTSLibError("The TPG does not use a nexus") if self._get_nexus(): raise RTSLibError("The TPG's nexus initiator WWN is already set") fm = self.parent_target.fabric_modu...
[ "def", "_set_nexus", "(", "self", ",", "nexus_wwn", "=", "None", ")", ":", "self", ".", "_check_self", "(", ")", "if", "not", "self", ".", "has_feature", "(", "'nexus'", ")", ":", "raise", "RTSLibError", "(", "\"The TPG does not use a nexus\"", ")", "if", ...
Sets the nexus initiator WWN.
[ "Sets", "the", "nexus", "initiator", "WWN", "." ]
[ "'''\n Sets the nexus initiator WWN. Raises an exception if the nexus is\n already set or if the TPG does not use a nexus.\n '''", "# Nexus wwn type should match parent target" ]
[ { "param": "self", "type": null }, { "param": "nexus_wwn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nexus_wwn", "type": null, "docstring": null, "docstring_token...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
has_feature
<not_specific>
def has_feature(self, feature): ''' Whether or not this TPG has a certain feature. ''' return self.parent_target.has_feature(feature)
Whether or not this TPG has a certain feature.
Whether or not this TPG has a certain feature.
[ "Whether", "or", "not", "this", "TPG", "has", "a", "certain", "feature", "." ]
def has_feature(self, feature): return self.parent_target.has_feature(feature)
[ "def", "has_feature", "(", "self", ",", "feature", ")", ":", "return", "self", ".", "parent_target", ".", "has_feature", "(", "feature", ")" ]
Whether or not this TPG has a certain feature.
[ "Whether", "or", "not", "this", "TPG", "has", "a", "certain", "feature", "." ]
[ "'''\n Whether or not this TPG has a certain feature.\n '''" ]
[ { "param": "self", "type": null }, { "param": "feature", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "feature", "type": null, "docstring": null, "docstring_tokens"...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
delete
null
def delete(self): ''' Recursively deletes a TPG object. This will delete all attached LUN, NetworkPortal and Node ACL objects and then the TPG itself. Before starting the actual deletion process, all sessions will be disconnected. ''' self._check_self() s...
Recursively deletes a TPG object. This will delete all attached LUN, NetworkPortal and Node ACL objects and then the TPG itself. Before starting the actual deletion process, all sessions will be disconnected.
Recursively deletes a TPG object. This will delete all attached LUN, NetworkPortal and Node ACL objects and then the TPG itself. Before starting the actual deletion process, all sessions will be disconnected.
[ "Recursively", "deletes", "a", "TPG", "object", ".", "This", "will", "delete", "all", "attached", "LUN", "NetworkPortal", "and", "Node", "ACL", "objects", "and", "then", "the", "TPG", "itself", ".", "Before", "starting", "the", "actual", "deletion", "process",...
def delete(self): self._check_self() self.enable = False for acl in self.node_acls: acl.delete() for lun in self.luns: lun.delete() for portal in self.network_portals: portal.delete() super(TPG, self).delete()
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_check_self", "(", ")", "self", ".", "enable", "=", "False", "for", "acl", "in", "self", ".", "node_acls", ":", "acl", ".", "delete", "(", ")", "for", "lun", "in", "self", ".", "luns", ":", "l...
Recursively deletes a TPG object.
[ "Recursively", "deletes", "a", "TPG", "object", "." ]
[ "'''\n Recursively deletes a TPG object.\n This will delete all attached LUN, NetworkPortal and Node ACL objects\n and then the TPG itself. Before starting the actual deletion process,\n all sessions will be disconnected.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
node_acl
<not_specific>
def node_acl(self, node_wwn, mode='any'): ''' Same as NodeACL() but without specifying the parent_tpg. ''' self._check_self() return NodeACL(self, node_wwn=node_wwn, mode=mode)
Same as NodeACL() but without specifying the parent_tpg.
Same as NodeACL() but without specifying the parent_tpg.
[ "Same", "as", "NodeACL", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
def node_acl(self, node_wwn, mode='any'): self._check_self() return NodeACL(self, node_wwn=node_wwn, mode=mode)
[ "def", "node_acl", "(", "self", ",", "node_wwn", ",", "mode", "=", "'any'", ")", ":", "self", ".", "_check_self", "(", ")", "return", "NodeACL", "(", "self", ",", "node_wwn", "=", "node_wwn", ",", "mode", "=", "mode", ")" ]
Same as NodeACL() but without specifying the parent_tpg.
[ "Same", "as", "NodeACL", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
[ "'''\n Same as NodeACL() but without specifying the parent_tpg.\n '''" ]
[ { "param": "self", "type": null }, { "param": "node_wwn", "type": null }, { "param": "mode", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node_wwn", "type": null, "docstring": null, "docstring_tokens...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
network_portal
<not_specific>
def network_portal(self, ip_address, port, mode='any'): ''' Same as NetworkPortal() but without specifying the parent_tpg. ''' self._check_self() return NetworkPortal(self, ip_address=ip_address, port=port, mode=mode)
Same as NetworkPortal() but without specifying the parent_tpg.
Same as NetworkPortal() but without specifying the parent_tpg.
[ "Same", "as", "NetworkPortal", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
def network_portal(self, ip_address, port, mode='any'): self._check_self() return NetworkPortal(self, ip_address=ip_address, port=port, mode=mode)
[ "def", "network_portal", "(", "self", ",", "ip_address", ",", "port", ",", "mode", "=", "'any'", ")", ":", "self", ".", "_check_self", "(", ")", "return", "NetworkPortal", "(", "self", ",", "ip_address", "=", "ip_address", ",", "port", "=", "port", ",", ...
Same as NetworkPortal() but without specifying the parent_tpg.
[ "Same", "as", "NetworkPortal", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
[ "'''\n Same as NetworkPortal() but without specifying the parent_tpg.\n '''" ]
[ { "param": "self", "type": null }, { "param": "ip_address", "type": null }, { "param": "port", "type": null }, { "param": "mode", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ip_address", "type": null, "docstring": null, "docstring_toke...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
lun
<not_specific>
def lun(self, lun, storage_object=None, alias=None): ''' Same as LUN() but without specifying the parent_tpg. ''' self._check_self() return LUN(self, lun=lun, storage_object=storage_object, alias=alias)
Same as LUN() but without specifying the parent_tpg.
Same as LUN() but without specifying the parent_tpg.
[ "Same", "as", "LUN", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
def lun(self, lun, storage_object=None, alias=None): self._check_self() return LUN(self, lun=lun, storage_object=storage_object, alias=alias)
[ "def", "lun", "(", "self", ",", "lun", ",", "storage_object", "=", "None", ",", "alias", "=", "None", ")", ":", "self", ".", "_check_self", "(", ")", "return", "LUN", "(", "self", ",", "lun", "=", "lun", ",", "storage_object", "=", "storage_object", ...
Same as LUN() but without specifying the parent_tpg.
[ "Same", "as", "LUN", "()", "but", "without", "specifying", "the", "parent_tpg", "." ]
[ "'''\n Same as LUN() but without specifying the parent_tpg.\n '''" ]
[ { "param": "self", "type": null }, { "param": "lun", "type": null }, { "param": "storage_object", "type": null }, { "param": "alias", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lun", "type": null, "docstring": null, "docstring_tokens": []...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
delete
null
def delete(self): ''' If the underlying configFS object does not exist, this method does nothing. If the underlying configFS object exists, this method attempts to delete it along with all MappedLUN objects referencing that LUN. ''' self._check_self() for mlun in...
If the underlying configFS object does not exist, this method does nothing. If the underlying configFS object exists, this method attempts to delete it along with all MappedLUN objects referencing that LUN.
If the underlying configFS object does not exist, this method does nothing. If the underlying configFS object exists, this method attempts to delete it along with all MappedLUN objects referencing that LUN.
[ "If", "the", "underlying", "configFS", "object", "does", "not", "exist", "this", "method", "does", "nothing", ".", "If", "the", "underlying", "configFS", "object", "exists", "this", "method", "attempts", "to", "delete", "it", "along", "with", "all", "MappedLUN...
def delete(self): self._check_self() for mlun in self.mapped_luns: mlun.delete() try: link = self.alias except RTSLibBrokenLink: pass else: if os.path.islink("%s/%s" % (self.path, link)): os.unlink("%s/%s" % (self.pa...
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_check_self", "(", ")", "for", "mlun", "in", "self", ".", "mapped_luns", ":", "mlun", ".", "delete", "(", ")", "try", ":", "link", "=", "self", ".", "alias", "except", "RTSLibBrokenLink", ":", "pa...
If the underlying configFS object does not exist, this method does nothing.
[ "If", "the", "underlying", "configFS", "object", "does", "not", "exist", "this", "method", "does", "nothing", "." ]
[ "'''\n If the underlying configFS object does not exist, this method does\n nothing. If the underlying configFS object exists, this method attempts\n to delete it along with all MappedLUN objects referencing that LUN.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
has_feature
<not_specific>
def has_feature(self, feature): ''' Whether or not this NodeACL has a certain feature. ''' return self.parent_tpg.has_feature(feature)
Whether or not this NodeACL has a certain feature.
Whether or not this NodeACL has a certain feature.
[ "Whether", "or", "not", "this", "NodeACL", "has", "a", "certain", "feature", "." ]
def has_feature(self, feature): return self.parent_tpg.has_feature(feature)
[ "def", "has_feature", "(", "self", ",", "feature", ")", ":", "return", "self", ".", "parent_tpg", ".", "has_feature", "(", "feature", ")" ]
Whether or not this NodeACL has a certain feature.
[ "Whether", "or", "not", "this", "NodeACL", "has", "a", "certain", "feature", "." ]
[ "'''\n Whether or not this NodeACL has a certain feature.\n '''" ]
[ { "param": "self", "type": null }, { "param": "feature", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "feature", "type": null, "docstring": null, "docstring_tokens"...
1477197f2018e9254d3a3e0a340127df00742767
bostroesser/rtslib-fb
rtslib/target.py
[ "Apache-2.0" ]
Python
delete
null
def delete(self): ''' Delete the NodeACL, including all MappedLUN objects. If the underlying configFS object does not exist, this method does nothing. ''' self._check_self() for mapped_lun in self.mapped_luns: mapped_lun.delete() super(NodeACL,...
Delete the NodeACL, including all MappedLUN objects. If the underlying configFS object does not exist, this method does nothing.
Delete the NodeACL, including all MappedLUN objects. If the underlying configFS object does not exist, this method does nothing.
[ "Delete", "the", "NodeACL", "including", "all", "MappedLUN", "objects", ".", "If", "the", "underlying", "configFS", "object", "does", "not", "exist", "this", "method", "does", "nothing", "." ]
def delete(self): self._check_self() for mapped_lun in self.mapped_luns: mapped_lun.delete() super(NodeACL, self).delete()
[ "def", "delete", "(", "self", ")", ":", "self", ".", "_check_self", "(", ")", "for", "mapped_lun", "in", "self", ".", "mapped_luns", ":", "mapped_lun", ".", "delete", "(", ")", "super", "(", "NodeACL", ",", "self", ")", ".", "delete", "(", ")" ]
Delete the NodeACL, including all MappedLUN objects.
[ "Delete", "the", "NodeACL", "including", "all", "MappedLUN", "objects", "." ]
[ "'''\n Delete the NodeACL, including all MappedLUN objects.\n If the underlying configFS object does not exist, this method does\n nothing.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }