partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
ctr_geom
Returns geometry shifted to center of mass. Helper function to automate / encapsulate translation of a geometry to its center of mass. Parameters ---------- geom length-3N |npfloat_| -- Original coordinates of the atoms masses length-N OR length-3N |npfloat_| -- ...
opan/utils/inertia.py
def ctr_geom(geom, masses): """ Returns geometry shifted to center of mass. Helper function to automate / encapsulate translation of a geometry to its center of mass. Parameters ---------- geom length-3N |npfloat_| -- Original coordinates of the atoms masses length...
def ctr_geom(geom, masses): """ Returns geometry shifted to center of mass. Helper function to automate / encapsulate translation of a geometry to its center of mass. Parameters ---------- geom length-3N |npfloat_| -- Original coordinates of the atoms masses length...
[ "Returns", "geometry", "shifted", "to", "center", "of", "mass", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L119-L158
[ "def", "ctr_geom", "(", "geom", ",", "masses", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Calculate the shift vector. Possible bad shape of geom or masses is", "# addressed internally by the ctr_mass call.", "shift", "=", "np", ".", "tile", "(", "ctr_mass", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
inertia_tensor
Generate the 3x3 moment-of-inertia tensor. Compute the 3x3 moment-of-inertia tensor for the provided geometry and atomic masses. Always recenters the geometry to the center of mass as the first step. Reference for inertia tensor: [Kro92]_, Eq. (2.26) .. todo:: Replace cite eventually with link t...
opan/utils/inertia.py
def inertia_tensor(geom, masses): """Generate the 3x3 moment-of-inertia tensor. Compute the 3x3 moment-of-inertia tensor for the provided geometry and atomic masses. Always recenters the geometry to the center of mass as the first step. Reference for inertia tensor: [Kro92]_, Eq. (2.26) .. t...
def inertia_tensor(geom, masses): """Generate the 3x3 moment-of-inertia tensor. Compute the 3x3 moment-of-inertia tensor for the provided geometry and atomic masses. Always recenters the geometry to the center of mass as the first step. Reference for inertia tensor: [Kro92]_, Eq. (2.26) .. t...
[ "Generate", "the", "3x3", "moment", "-", "of", "-", "inertia", "tensor", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L164-L242
[ "def", "inertia_tensor", "(", "geom", ",", "masses", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Center the geometry. Takes care of any improper shapes of geom or", "# masses via the internal call to 'ctr_mass' within the call to 'ctr_geom'", "geom", "=", "ctr_geom", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
principals
Principal axes and moments of inertia for the indicated geometry. Calculated by :func:`scipy.linalg.eigh`, since the moment of inertia tensor is symmetric (real-Hermitian) by construction. More convenient to compute both the axes and moments at the same time since the eigenvectors must be processed to...
opan/utils/inertia.py
def principals(geom, masses, on_tol=_DEF.ORTHONORM_TOL): """Principal axes and moments of inertia for the indicated geometry. Calculated by :func:`scipy.linalg.eigh`, since the moment of inertia tensor is symmetric (real-Hermitian) by construction. More convenient to compute both the axes and moments ...
def principals(geom, masses, on_tol=_DEF.ORTHONORM_TOL): """Principal axes and moments of inertia for the indicated geometry. Calculated by :func:`scipy.linalg.eigh`, since the moment of inertia tensor is symmetric (real-Hermitian) by construction. More convenient to compute both the axes and moments ...
[ "Principal", "axes", "and", "moments", "of", "inertia", "for", "the", "indicated", "geometry", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L248-L494
[ "def", "principals", "(", "geom", ",", "masses", ",", "on_tol", "=", "_DEF", ".", "ORTHONORM_TOL", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", ".", "const", "import", "PRM", ",", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
rot_consts
Rotational constants for a given molecular system. Calculates the rotational constants for the provided system with numerical value given in the units provided in `units`. The orthnormality tolerance `on_tol` is required in order to be passed through to the :func:`principals` function. If the sys...
opan/utils/inertia.py
def rot_consts(geom, masses, units=_EURC.INV_INERTIA, on_tol=_DEF.ORTHONORM_TOL): """Rotational constants for a given molecular system. Calculates the rotational constants for the provided system with numerical value given in the units provided in `units`. The orthnormality tolerance `on_tol` is requi...
def rot_consts(geom, masses, units=_EURC.INV_INERTIA, on_tol=_DEF.ORTHONORM_TOL): """Rotational constants for a given molecular system. Calculates the rotational constants for the provided system with numerical value given in the units provided in `units`. The orthnormality tolerance `on_tol` is requi...
[ "Rotational", "constants", "for", "a", "given", "molecular", "system", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L499-L598
[ "def", "rot_consts", "(", "geom", ",", "masses", ",", "units", "=", "_EURC", ".", "INV_INERTIA", ",", "on_tol", "=", "_DEF", ".", "ORTHONORM_TOL", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", ".", ".", "const", "import", "EnumTopType", "...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
_fadn_orth
First non-zero Atomic Displacement Non-Orthogonal to Vec Utility function to identify the first atomic displacement in a geometry that is (a) not the zero vector; and (b) not normal to the reference vector. Parameters ---------- vec length-3 |npfloat_| -- Reference vector. Does not...
opan/utils/inertia.py
def _fadn_orth(vec, geom): """First non-zero Atomic Displacement Non-Orthogonal to Vec Utility function to identify the first atomic displacement in a geometry that is (a) not the zero vector; and (b) not normal to the reference vector. Parameters ---------- vec length-3 |npfloat_| -- ...
def _fadn_orth(vec, geom): """First non-zero Atomic Displacement Non-Orthogonal to Vec Utility function to identify the first atomic displacement in a geometry that is (a) not the zero vector; and (b) not normal to the reference vector. Parameters ---------- vec length-3 |npfloat_| -- ...
[ "First", "non", "-", "zero", "Atomic", "Displacement", "Non", "-", "Orthogonal", "to", "Vec" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L604-L667
[ "def", "_fadn_orth", "(", "vec", ",", "geom", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", ".", "const", "import", "PRM", "from", ".", ".", "error", "import", "InertiaError", "from"...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
_fadn_par
First non-zero Atomic Displacement that is Non-Parallel with Vec Utility function to identify the first atomic displacement in a geometry that is both (a) not the zero vector and (b) non-(anti-)parallel with a reference vector. Parameters ---------- vec length-3 |npfloat_| -- R...
opan/utils/inertia.py
def _fadn_par(vec, geom): """First non-zero Atomic Displacement that is Non-Parallel with Vec Utility function to identify the first atomic displacement in a geometry that is both (a) not the zero vector and (b) non-(anti-)parallel with a reference vector. Parameters ---------- vec ...
def _fadn_par(vec, geom): """First non-zero Atomic Displacement that is Non-Parallel with Vec Utility function to identify the first atomic displacement in a geometry that is both (a) not the zero vector and (b) non-(anti-)parallel with a reference vector. Parameters ---------- vec ...
[ "First", "non", "-", "zero", "Atomic", "Displacement", "that", "is", "Non", "-", "Parallel", "with", "Vec" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/inertia.py#L674-L740
[ "def", "_fadn_par", "(", "vec", ",", "geom", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", ".", "const", "import", "PRM", "from", ".", ".", "error", "import", "InertiaError", "from",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
reference_contexts_for_variant
variant : varcode.Variant context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, optional If given, then only consider transcripts whose IDs are in this set. Returns list of ReferenceContext obj...
isovar/reference_context.py
def reference_contexts_for_variant( variant, context_size, transcript_id_whitelist=None): """ variant : varcode.Variant context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, ...
def reference_contexts_for_variant( variant, context_size, transcript_id_whitelist=None): """ variant : varcode.Variant context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, ...
[ "variant", ":", "varcode", ".", "Variant" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L98-L139
[ "def", "reference_contexts_for_variant", "(", "variant", ",", "context_size", ",", "transcript_id_whitelist", "=", "None", ")", ":", "overlapping_transcripts", "=", "reference_transcripts_for_variant", "(", "variant", "=", "variant", ",", "transcript_id_whitelist", "=", "...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reference_contexts_for_variants
Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, optional...
isovar/reference_context.py
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
[ "Extract", "a", "set", "of", "reference", "contexts", "for", "each", "variant", "in", "the", "collection", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L141-L168
[ "def", "reference_contexts_for_variants", "(", "variants", ",", "context_size", ",", "transcript_id_whitelist", "=", "None", ")", ":", "result", "=", "OrderedDict", "(", ")", "for", "variant", "in", "variants", ":", "result", "[", "variant", "]", "=", "reference...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
variants_to_reference_contexts_dataframe
Given a collection of variants, find all reference sequence contexts around each variant. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whi...
isovar/reference_context.py
def variants_to_reference_contexts_dataframe( variants, context_size, transcript_id_whitelist=None): """ Given a collection of variants, find all reference sequence contexts around each variant. Parameters ---------- variants : varcode.VariantCollection context_size...
def variants_to_reference_contexts_dataframe( variants, context_size, transcript_id_whitelist=None): """ Given a collection of variants, find all reference sequence contexts around each variant. Parameters ---------- variants : varcode.VariantCollection context_size...
[ "Given", "a", "collection", "of", "variants", "find", "all", "reference", "sequence", "contexts", "around", "each", "variant", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L170-L205
[ "def", "variants_to_reference_contexts_dataframe", "(", "variants", ",", "context_size", ",", "transcript_id_whitelist", "=", "None", ")", ":", "df_builder", "=", "DataFrameBuilder", "(", "ReferenceContext", ",", "exclude", "=", "[", "\"variant\"", "]", ",", "converte...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
gaussian
Two-dimensional oriented Gaussian pattern (i.e., 2D version of a bell curve, like a normal distribution but not necessarily summing to 1.0).
imagen/patternfn.py
def gaussian(x, y, xsigma, ysigma): """ Two-dimensional oriented Gaussian pattern (i.e., 2D version of a bell curve, like a normal distribution but not necessarily summing to 1.0). """ if xsigma==0.0 or ysigma==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,x...
def gaussian(x, y, xsigma, ysigma): """ Two-dimensional oriented Gaussian pattern (i.e., 2D version of a bell curve, like a normal distribution but not necessarily summing to 1.0). """ if xsigma==0.0 or ysigma==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,x...
[ "Two", "-", "dimensional", "oriented", "Gaussian", "pattern", "(", "i", ".", "e", ".", "2D", "version", "of", "a", "bell", "curve", "like", "a", "normal", "distribution", "but", "not", "necessarily", "summing", "to", "1", ".", "0", ")", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L39-L51
[ "def", "gaussian", "(", "x", ",", "y", ",", "xsigma", ",", "ysigma", ")", ":", "if", "xsigma", "==", "0.0", "or", "ysigma", "==", "0.0", ":", "return", "x", "*", "0.0", "with", "float_error_ignore", "(", ")", ":", "x_w", "=", "np", ".", "divide", ...
53c5685c880f54b42795964d8db50b02e8590e88
train
log_gaussian
Two-dimensional oriented Log Gaussian pattern (i.e., 2D version of a bell curve with an independent, movable peak). Much like a normal distribution, but not necessarily placing the peak above the center, and not necessarily summing to 1.0).
imagen/patternfn.py
def log_gaussian(x, y, x_sigma, y_sigma, mu): """ Two-dimensional oriented Log Gaussian pattern (i.e., 2D version of a bell curve with an independent, movable peak). Much like a normal distribution, but not necessarily placing the peak above the center, and not necessarily summing to 1.0). """ ...
def log_gaussian(x, y, x_sigma, y_sigma, mu): """ Two-dimensional oriented Log Gaussian pattern (i.e., 2D version of a bell curve with an independent, movable peak). Much like a normal distribution, but not necessarily placing the peak above the center, and not necessarily summing to 1.0). """ ...
[ "Two", "-", "dimensional", "oriented", "Log", "Gaussian", "pattern", "(", "i", ".", "e", ".", "2D", "version", "of", "a", "bell", "curve", "with", "an", "independent", "movable", "peak", ")", ".", "Much", "like", "a", "normal", "distribution", "but", "no...
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L54-L68
[ "def", "log_gaussian", "(", "x", ",", "y", ",", "x_sigma", ",", "y_sigma", ",", "mu", ")", ":", "if", "x_sigma", "==", "0.0", "or", "y_sigma", "==", "0.0", ":", "return", "x", "*", "0.0", "with", "float_error_ignore", "(", ")", ":", "x_w", "=", "np...
53c5685c880f54b42795964d8db50b02e8590e88
train
exponential
Two-dimensional oriented exponential decay pattern.
imagen/patternfn.py
def exponential(x, y, xscale, yscale): """ Two-dimensional oriented exponential decay pattern. """ if xscale==0.0 or yscale==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,xscale) y_h = np.divide(y,yscale) return np.exp(-np.sqrt(x_w*x_w+y_h*y_h))
def exponential(x, y, xscale, yscale): """ Two-dimensional oriented exponential decay pattern. """ if xscale==0.0 or yscale==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,xscale) y_h = np.divide(y,yscale) return np.exp(-np.sqrt(x_w*x_w+y_h*y_h))
[ "Two", "-", "dimensional", "oriented", "exponential", "decay", "pattern", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L82-L92
[ "def", "exponential", "(", "x", ",", "y", ",", "xscale", ",", "yscale", ")", ":", "if", "xscale", "==", "0.0", "or", "yscale", "==", "0.0", ":", "return", "x", "*", "0.0", "with", "float_error_ignore", "(", ")", ":", "x_w", "=", "np", ".", "divide"...
53c5685c880f54b42795964d8db50b02e8590e88
train
gabor
Gabor pattern (sine grating multiplied by a circular Gaussian).
imagen/patternfn.py
def gabor(x, y, xsigma, ysigma, frequency, phase): """ Gabor pattern (sine grating multiplied by a circular Gaussian). """ if xsigma==0.0 or ysigma==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,xsigma) y_h = np.divide(y,ysigma) p = np.exp(-0.5*x_w*x...
def gabor(x, y, xsigma, ysigma, frequency, phase): """ Gabor pattern (sine grating multiplied by a circular Gaussian). """ if xsigma==0.0 or ysigma==0.0: return x*0.0 with float_error_ignore(): x_w = np.divide(x,xsigma) y_h = np.divide(y,ysigma) p = np.exp(-0.5*x_w*x...
[ "Gabor", "pattern", "(", "sine", "grating", "multiplied", "by", "a", "circular", "Gaussian", ")", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L95-L106
[ "def", "gabor", "(", "x", ",", "y", ",", "xsigma", ",", "ysigma", ",", "frequency", ",", "phase", ")", ":", "if", "xsigma", "==", "0.0", "or", "ysigma", "==", "0.0", ":", "return", "x", "*", "0.0", "with", "float_error_ignore", "(", ")", ":", "x_w"...
53c5685c880f54b42795964d8db50b02e8590e88
train
line
Infinite-length line with a solid central region, then Gaussian fall-off at the edges.
imagen/patternfn.py
def line(y, thickness, gaussian_width): """ Infinite-length line with a solid central region, then Gaussian fall-off at the edges. """ distance_from_line = abs(y) gaussian_y_coord = distance_from_line - thickness/2.0 sigmasq = gaussian_width*gaussian_width if sigmasq==0.0: falloff =...
def line(y, thickness, gaussian_width): """ Infinite-length line with a solid central region, then Gaussian fall-off at the edges. """ distance_from_line = abs(y) gaussian_y_coord = distance_from_line - thickness/2.0 sigmasq = gaussian_width*gaussian_width if sigmasq==0.0: falloff =...
[ "Infinite", "-", "length", "line", "with", "a", "solid", "central", "region", "then", "Gaussian", "fall", "-", "off", "at", "the", "edges", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L114-L128
[ "def", "line", "(", "y", ",", "thickness", ",", "gaussian_width", ")", ":", "distance_from_line", "=", "abs", "(", "y", ")", "gaussian_y_coord", "=", "distance_from_line", "-", "thickness", "/", "2.0", "sigmasq", "=", "gaussian_width", "*", "gaussian_width", "...
53c5685c880f54b42795964d8db50b02e8590e88
train
disk
Circular disk with Gaussian fall-off after the solid central region.
imagen/patternfn.py
def disk(x, y, height, gaussian_width): """ Circular disk with Gaussian fall-off after the solid central region. """ disk_radius = height/2.0 distance_from_origin = np.sqrt(x**2+y**2) distance_outside_disk = distance_from_origin - disk_radius sigmasq = gaussian_width*gaussian_width if ...
def disk(x, y, height, gaussian_width): """ Circular disk with Gaussian fall-off after the solid central region. """ disk_radius = height/2.0 distance_from_origin = np.sqrt(x**2+y**2) distance_outside_disk = distance_from_origin - disk_radius sigmasq = gaussian_width*gaussian_width if ...
[ "Circular", "disk", "with", "Gaussian", "fall", "-", "off", "after", "the", "solid", "central", "region", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L131-L148
[ "def", "disk", "(", "x", ",", "y", ",", "height", ",", "gaussian_width", ")", ":", "disk_radius", "=", "height", "/", "2.0", "distance_from_origin", "=", "np", ".", "sqrt", "(", "x", "**", "2", "+", "y", "**", "2", ")", "distance_outside_disk", "=", ...
53c5685c880f54b42795964d8db50b02e8590e88
train
ring
Circular ring (annulus) with Gaussian fall-off after the solid ring-shaped region.
imagen/patternfn.py
def ring(x, y, height, thickness, gaussian_width): """ Circular ring (annulus) with Gaussian fall-off after the solid ring-shaped region. """ radius = height/2.0 half_thickness = thickness/2.0 distance_from_origin = np.sqrt(x**2+y**2) distance_outside_outer_disk = distance_from_origin - rad...
def ring(x, y, height, thickness, gaussian_width): """ Circular ring (annulus) with Gaussian fall-off after the solid ring-shaped region. """ radius = height/2.0 half_thickness = thickness/2.0 distance_from_origin = np.sqrt(x**2+y**2) distance_outside_outer_disk = distance_from_origin - rad...
[ "Circular", "ring", "(", "annulus", ")", "with", "Gaussian", "fall", "-", "off", "after", "the", "solid", "ring", "-", "shaped", "region", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L151-L175
[ "def", "ring", "(", "x", ",", "y", ",", "height", ",", "thickness", ",", "gaussian_width", ")", ":", "radius", "=", "height", "/", "2.0", "half_thickness", "=", "thickness", "/", "2.0", "distance_from_origin", "=", "np", ".", "sqrt", "(", "x", "**", "2...
53c5685c880f54b42795964d8db50b02e8590e88
train
smooth_rectangle
Rectangle with a solid central region, then Gaussian fall-off at the edges.
imagen/patternfn.py
def smooth_rectangle(x, y, rec_w, rec_h, gaussian_width_x, gaussian_width_y): """ Rectangle with a solid central region, then Gaussian fall-off at the edges. """ gaussian_x_coord = abs(x)-rec_w/2.0 gaussian_y_coord = abs(y)-rec_h/2.0 box_x=np.less(gaussian_x_coord,0.0) box_y=np.less(gaussi...
def smooth_rectangle(x, y, rec_w, rec_h, gaussian_width_x, gaussian_width_y): """ Rectangle with a solid central region, then Gaussian fall-off at the edges. """ gaussian_x_coord = abs(x)-rec_w/2.0 gaussian_y_coord = abs(y)-rec_h/2.0 box_x=np.less(gaussian_x_coord,0.0) box_y=np.less(gaussi...
[ "Rectangle", "with", "a", "solid", "central", "region", "then", "Gaussian", "fall", "-", "off", "at", "the", "edges", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L178-L197
[ "def", "smooth_rectangle", "(", "x", ",", "y", ",", "rec_w", ",", "rec_h", ",", "gaussian_width_x", ",", "gaussian_width_y", ")", ":", "gaussian_x_coord", "=", "abs", "(", "x", ")", "-", "rec_w", "/", "2.0", "gaussian_y_coord", "=", "abs", "(", "y", ")",...
53c5685c880f54b42795964d8db50b02e8590e88
train
arc_by_radian
Radial arc with Gaussian fall-off after the solid ring-shaped region with the given thickness, with shape specified by the (start,end) radian_range.
imagen/patternfn.py
def arc_by_radian(x, y, height, radian_range, thickness, gaussian_width): """ Radial arc with Gaussian fall-off after the solid ring-shaped region with the given thickness, with shape specified by the (start,end) radian_range. """ # Create a circular ring (copied from the ring function) rad...
def arc_by_radian(x, y, height, radian_range, thickness, gaussian_width): """ Radial arc with Gaussian fall-off after the solid ring-shaped region with the given thickness, with shape specified by the (start,end) radian_range. """ # Create a circular ring (copied from the ring function) rad...
[ "Radial", "arc", "with", "Gaussian", "fall", "-", "off", "after", "the", "solid", "ring", "-", "shaped", "region", "with", "the", "given", "thickness", "with", "shape", "specified", "by", "the", "(", "start", "end", ")", "radian_range", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L201-L259
[ "def", "arc_by_radian", "(", "x", ",", "y", ",", "height", ",", "radian_range", ",", "thickness", ",", "gaussian_width", ")", ":", "# Create a circular ring (copied from the ring function)", "radius", "=", "height", "/", "2.0", "half_thickness", "=", "thickness", "/...
53c5685c880f54b42795964d8db50b02e8590e88
train
arc_by_center
Arc with Gaussian fall-off after the solid ring-shaped region and specified by point of tangency (x and y) and arc width and height. This function calculates the start and end radian from the given width and height, and then calls arc_by_radian function to draw the curve.
imagen/patternfn.py
def arc_by_center(x, y, arc_box, constant_length, thickness, gaussian_width): """ Arc with Gaussian fall-off after the solid ring-shaped region and specified by point of tangency (x and y) and arc width and height. This function calculates the start and end radian from the given width and height, a...
def arc_by_center(x, y, arc_box, constant_length, thickness, gaussian_width): """ Arc with Gaussian fall-off after the solid ring-shaped region and specified by point of tangency (x and y) and arc width and height. This function calculates the start and end radian from the given width and height, a...
[ "Arc", "with", "Gaussian", "fall", "-", "off", "after", "the", "solid", "ring", "-", "shaped", "region", "and", "specified", "by", "point", "of", "tangency", "(", "x", "and", "y", ")", "and", "arc", "width", "and", "height", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patternfn.py#L262-L294
[ "def", "arc_by_center", "(", "x", ",", "y", ",", "arc_box", ",", "constant_length", ",", "thickness", ",", "gaussian_width", ")", ":", "arc_w", "=", "arc_box", "[", "0", "]", "arc_h", "=", "abs", "(", "arc_box", "[", "1", "]", ")", "if", "arc_w", "==...
53c5685c880f54b42795964d8db50b02e8590e88
train
skipPGVersionBefore
Skip PG versions below specific version i.e. (9, 5).
postpy/fixtures.py
def skipPGVersionBefore(*ver): """Skip PG versions below specific version i.e. (9, 5).""" ver = ver + (0,) * (3 - len(ver)) def skip_before_postgres_(func): @wraps(func) def skip_before_postgres__(obj, *args, **kwargs): if hasattr(obj.conn, 'server_version'): s...
def skipPGVersionBefore(*ver): """Skip PG versions below specific version i.e. (9, 5).""" ver = ver + (0,) * (3 - len(ver)) def skip_before_postgres_(func): @wraps(func) def skip_before_postgres__(obj, *args, **kwargs): if hasattr(obj.conn, 'server_version'): s...
[ "Skip", "PG", "versions", "below", "specific", "version", "i", ".", "e", ".", "(", "9", "5", ")", "." ]
portfoliome/postpy
python
https://github.com/portfoliome/postpy/blob/fe26199131b15295fc5f669a0ad2a7f47bf490ee/postpy/fixtures.py#L68-L88
[ "def", "skipPGVersionBefore", "(", "*", "ver", ")", ":", "ver", "=", "ver", "+", "(", "0", ",", ")", "*", "(", "3", "-", "len", "(", "ver", ")", ")", "def", "skip_before_postgres_", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", ...
fe26199131b15295fc5f669a0ad2a7f47bf490ee
train
pack_tups
Pack an arbitrary set of iterables and non-iterables into tuples. Function packs a set of inputs with arbitrary iterability into tuples. Iterability is tested with :func:`iterable`. Non-iterable inputs are repeated in each output tuple. Iterable inputs are expanded uniformly across the output tuples. ...
opan/utils/base.py
def pack_tups(*args): """Pack an arbitrary set of iterables and non-iterables into tuples. Function packs a set of inputs with arbitrary iterability into tuples. Iterability is tested with :func:`iterable`. Non-iterable inputs are repeated in each output tuple. Iterable inputs are expanded uniforml...
def pack_tups(*args): """Pack an arbitrary set of iterables and non-iterables into tuples. Function packs a set of inputs with arbitrary iterability into tuples. Iterability is tested with :func:`iterable`. Non-iterable inputs are repeated in each output tuple. Iterable inputs are expanded uniforml...
[ "Pack", "an", "arbitrary", "set", "of", "iterables", "and", "non", "-", "iterables", "into", "tuples", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L44-L139
[ "def", "pack_tups", "(", "*", "args", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Debug flag", "_DEBUG", "=", "False", "# Marker value for non-iterable items", "NOT_ITER", "=", "-", "1", "# Uninitialized test value", "UNINIT_VAL", "=", "-", "1", "# Pr...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
safe_cast
Performs a "safe" typecast. Ensures that `invar` properly casts to `totype`. Checks after casting that the result is actually of type `totype`. Any exceptions raised by the typecast itself are unhandled. Parameters ---------- invar (arbitrary) -- Value to be typecast. totype ...
opan/utils/base.py
def safe_cast(invar, totype): """Performs a "safe" typecast. Ensures that `invar` properly casts to `totype`. Checks after casting that the result is actually of type `totype`. Any exceptions raised by the typecast itself are unhandled. Parameters ---------- invar (arbitrary) -- Va...
def safe_cast(invar, totype): """Performs a "safe" typecast. Ensures that `invar` properly casts to `totype`. Checks after casting that the result is actually of type `totype`. Any exceptions raised by the typecast itself are unhandled. Parameters ---------- invar (arbitrary) -- Va...
[ "Performs", "a", "safe", "typecast", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L168-L205
[ "def", "safe_cast", "(", "invar", ",", "totype", ")", ":", "# Make the typecast. Just use Python built-in exceptioning", "outvar", "=", "totype", "(", "invar", ")", "# Check that the cast type matches", "if", "not", "isinstance", "(", "outvar", ",", "totype", ")", ":"...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
make_timestamp
Generate an hour-minutes-seconds timestamp from an interval in seconds. Assumes numeric input of a time interval in seconds. Converts this interval to a string of the format "#h #m #s", indicating the number of hours, minutes, and seconds in the interval. Intervals greater than 24h are unproblematic....
opan/utils/base.py
def make_timestamp(el_time): """ Generate an hour-minutes-seconds timestamp from an interval in seconds. Assumes numeric input of a time interval in seconds. Converts this interval to a string of the format "#h #m #s", indicating the number of hours, minutes, and seconds in the interval. Intervals gr...
def make_timestamp(el_time): """ Generate an hour-minutes-seconds timestamp from an interval in seconds. Assumes numeric input of a time interval in seconds. Converts this interval to a string of the format "#h #m #s", indicating the number of hours, minutes, and seconds in the interval. Intervals gr...
[ "Generate", "an", "hour", "-", "minutes", "-", "seconds", "timestamp", "from", "an", "interval", "in", "seconds", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L210-L244
[ "def", "make_timestamp", "(", "el_time", ")", ":", "# Calc hours", "hrs", "=", "el_time", "//", "3600.0", "# Calc minutes", "mins", "=", "(", "el_time", "%", "3600.0", ")", "//", "60.0", "# Calc seconds", "secs", "=", "el_time", "%", "60.0", "# Construct times...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
check_geom
Check for consistency of two geometries and atom symbol lists Cartesian coordinates are considered consistent with the input coords if each component matches to within `tol`. If coords or atoms vectors are passed that are of mismatched lengths, a |False| value is returned. Both coords vectors mus...
opan/utils/base.py
def check_geom(c1, a1, c2, a2, tol=_DEF.XYZ_COORD_MATCH_TOL): """ Check for consistency of two geometries and atom symbol lists Cartesian coordinates are considered consistent with the input coords if each component matches to within `tol`. If coords or atoms vectors are passed that are of mismatched ...
def check_geom(c1, a1, c2, a2, tol=_DEF.XYZ_COORD_MATCH_TOL): """ Check for consistency of two geometries and atom symbol lists Cartesian coordinates are considered consistent with the input coords if each component matches to within `tol`. If coords or atoms vectors are passed that are of mismatched ...
[ "Check", "for", "consistency", "of", "two", "geometries", "and", "atom", "symbol", "lists" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L250-L424
[ "def", "check_geom", "(", "c1", ",", "a1", ",", "c2", ",", "a2", ",", "tol", "=", "_DEF", ".", "XYZ_COORD_MATCH_TOL", ")", ":", "# Import(s)", "from", ".", ".", "const", "import", "atom_num", "import", "numpy", "as", "np", "from", ".", ".", "const", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
template_subst
Perform substitution of content into tagged string. For substitutions into template input files for external computational packages, no checks for valid syntax are performed. Each key in `subs` corresponds to a delimited substitution tag to be replaced in `template` by the entire text of the value...
opan/utils/base.py
def template_subst(template, subs, delims=('<', '>')): """ Perform substitution of content into tagged string. For substitutions into template input files for external computational packages, no checks for valid syntax are performed. Each key in `subs` corresponds to a delimited substitution tag t...
def template_subst(template, subs, delims=('<', '>')): """ Perform substitution of content into tagged string. For substitutions into template input files for external computational packages, no checks for valid syntax are performed. Each key in `subs` corresponds to a delimited substitution tag t...
[ "Perform", "substitution", "of", "content", "into", "tagged", "string", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L429-L488
[ "def", "template_subst", "(", "template", ",", "subs", ",", "delims", "=", "(", "'<'", ",", "'>'", ")", ")", ":", "# Store the template into the working variable", "subst_text", "=", "template", "# Iterate over subs and perform the .replace() calls", "for", "(", "k", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
assert_npfloatarray
Assert a value is an |nparray| of NumPy floats. Pass |None| to `varname` if `obj` itself is to be checked. Otherwise, `varname` is the string name of the attribute of `obj` to check. In either case, `desc` is a string description of the object to be checked, for use in raising of exceptions. Rais...
opan/utils/base.py
def assert_npfloatarray(obj, varname, desc, exc, tc, errsrc): """ Assert a value is an |nparray| of NumPy floats. Pass |None| to `varname` if `obj` itself is to be checked. Otherwise, `varname` is the string name of the attribute of `obj` to check. In either case, `desc` is a string description of the...
def assert_npfloatarray(obj, varname, desc, exc, tc, errsrc): """ Assert a value is an |nparray| of NumPy floats. Pass |None| to `varname` if `obj` itself is to be checked. Otherwise, `varname` is the string name of the attribute of `obj` to check. In either case, `desc` is a string description of the...
[ "Assert", "a", "value", "is", "an", "|nparray|", "of", "NumPy", "floats", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/base.py#L531-L609
[ "def", "assert_npfloatarray", "(", "obj", ",", "varname", ",", "desc", ",", "exc", ",", "tc", ",", "errsrc", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Check for whether member or object is to be checked", "if", "varname", "is", "None", ":", "var",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
tee_manager.advance
Advance the base iterator, publish to constituent iterators.
picklable_itertools/tee.py
def advance(self): """Advance the base iterator, publish to constituent iterators.""" elem = next(self._iterable) for deque in self._deques: deque.append(elem)
def advance(self): """Advance the base iterator, publish to constituent iterators.""" elem = next(self._iterable) for deque in self._deques: deque.append(elem)
[ "Advance", "the", "base", "iterator", "publish", "to", "constituent", "iterators", "." ]
mila-iqia/picklable-itertools
python
https://github.com/mila-iqia/picklable-itertools/blob/e00238867875df0258cf4f83f528d846e7c1afc4/picklable_itertools/tee.py#L36-L40
[ "def", "advance", "(", "self", ")", ":", "elem", "=", "next", "(", "self", ".", "_iterable", ")", "for", "deque", "in", "self", ".", "_deques", ":", "deque", ".", "append", "(", "elem", ")" ]
e00238867875df0258cf4f83f528d846e7c1afc4
train
SeparatedComposite.__distance_valid
Returns true if the distance between the (x,y) locations of two generators g0 and g1 is greater than a minimum separation. Can be extended easily to support other criteria.
imagen/deprecated.py
def __distance_valid(self, g0, g1, p): """ Returns true if the distance between the (x,y) locations of two generators g0 and g1 is greater than a minimum separation. Can be extended easily to support other criteria. """ dist = np.sqrt((g1.x - g0.x) ** 2 + ...
def __distance_valid(self, g0, g1, p): """ Returns true if the distance between the (x,y) locations of two generators g0 and g1 is greater than a minimum separation. Can be extended easily to support other criteria. """ dist = np.sqrt((g1.x - g0.x) ** 2 + ...
[ "Returns", "true", "if", "the", "distance", "between", "the", "(", "x", "y", ")", "locations", "of", "two", "generators", "g0", "and", "g1", "is", "greater", "than", "a", "minimum", "separation", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/deprecated.py#L52-L61
[ "def", "__distance_valid", "(", "self", ",", "g0", ",", "g1", ",", "p", ")", ":", "dist", "=", "np", ".", "sqrt", "(", "(", "g1", ".", "x", "-", "g0", ".", "x", ")", "**", "2", "+", "(", "g1", ".", "y", "-", "g0", ".", "y", ")", "**", "...
53c5685c880f54b42795964d8db50b02e8590e88
train
SeparatedComposite._advance_pattern_generators
Advance the parameters for each generator for this presentation. Picks a position for each generator that is accepted by __distance_valid for all combinations. Returns a new list of the generators, with some potentially omitted due to failure to meet the constraints.
imagen/deprecated.py
def _advance_pattern_generators(self,p): """ Advance the parameters for each generator for this presentation. Picks a position for each generator that is accepted by __distance_valid for all combinations. Returns a new list of the generators, with some potentially omitt...
def _advance_pattern_generators(self,p): """ Advance the parameters for each generator for this presentation. Picks a position for each generator that is accepted by __distance_valid for all combinations. Returns a new list of the generators, with some potentially omitt...
[ "Advance", "the", "parameters", "for", "each", "generator", "for", "this", "presentation", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/deprecated.py#L64-L92
[ "def", "_advance_pattern_generators", "(", "self", ",", "p", ")", ":", "valid_generators", "=", "[", "]", "for", "g", "in", "p", ".", "generators", ":", "for", "trial", "in", "range", "(", "self", ".", "max_trials", ")", ":", "# Generate a new position and a...
53c5685c880f54b42795964d8db50b02e8590e88
train
Translator._advance_params
Explicitly generate new values for these parameters only when appropriate.
imagen/deprecated.py
def _advance_params(self): """ Explicitly generate new values for these parameters only when appropriate. """ for p in ['x','y','direction']: self.force_new_dynamic_value(p) self.last_time = self.time_fn()
def _advance_params(self): """ Explicitly generate new values for these parameters only when appropriate. """ for p in ['x','y','direction']: self.force_new_dynamic_value(p) self.last_time = self.time_fn()
[ "Explicitly", "generate", "new", "values", "for", "these", "parameters", "only", "when", "appropriate", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/deprecated.py#L236-L243
[ "def", "_advance_params", "(", "self", ")", ":", "for", "p", "in", "[", "'x'", ",", "'y'", ",", "'direction'", "]", ":", "self", ".", "force_new_dynamic_value", "(", "p", ")", "self", ".", "last_time", "=", "self", ".", "time_fn", "(", ")" ]
53c5685c880f54b42795964d8db50b02e8590e88
train
OldSweeper.function
Selects and returns one of the patterns in the list.
imagen/deprecated.py
def function(self,p): """Selects and returns one of the patterns in the list.""" pg = p.generator motion_orientation=p.orientation+pi/2.0 new_x = p.x+p.size*pg.x new_y = p.y+p.size*pg.y image_array = pg(xdensity=p.xdensity,ydensity=p.ydensity,bounds=p.bounds, ...
def function(self,p): """Selects and returns one of the patterns in the list.""" pg = p.generator motion_orientation=p.orientation+pi/2.0 new_x = p.x+p.size*pg.x new_y = p.y+p.size*pg.y image_array = pg(xdensity=p.xdensity,ydensity=p.ydensity,bounds=p.bounds, ...
[ "Selects", "and", "returns", "one", "of", "the", "patterns", "in", "the", "list", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/deprecated.py#L329-L343
[ "def", "function", "(", "self", ",", "p", ")", ":", "pg", "=", "p", ".", "generator", "motion_orientation", "=", "p", ".", "orientation", "+", "pi", "/", "2.0", "new_x", "=", "p", ".", "x", "+", "p", ".", "size", "*", "pg", ".", "x", "new_y", "...
53c5685c880f54b42795964d8db50b02e8590e88
train
SuperOpanHess.check_geom
Check for consistency of Hessian geometry with input coords/atoms. The cartesian coordinates associated with a Hessian object are considered consistent with the input `coords` and `atoms` if each component matches to within `tol` and all atoms are identical. If `coords` or `ato...
opan/hess.py
def check_geom(self, coords, atoms, tol=_DEF.HESS_COORD_MATCH_TOL): """ Check for consistency of Hessian geometry with input coords/atoms. The cartesian coordinates associated with a Hessian object are considered consistent with the input `coords` and `atoms` if each component matches t...
def check_geom(self, coords, atoms, tol=_DEF.HESS_COORD_MATCH_TOL): """ Check for consistency of Hessian geometry with input coords/atoms. The cartesian coordinates associated with a Hessian object are considered consistent with the input `coords` and `atoms` if each component matches t...
[ "Check", "for", "consistency", "of", "Hessian", "geometry", "with", "input", "coords", "/", "atoms", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/hess.py#L258-L300
[ "def", "check_geom", "(", "self", ",", "coords", ",", "atoms", ",", "tol", "=", "_DEF", ".", "HESS_COORD_MATCH_TOL", ")", ":", "# Import(s)", "from", ".", "utils", "import", "check_geom", "as", "ucg", "# Wrapper call", "result", "=", "ucg", "(", "self", "....
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OrcaHess._load
Initialize OrcaHess Hessian object from .hess file Searches indicated file for data blocks within the .hess file. The geometry, Hessian block, frequencies, and normal modes must be present and will be retrieved; other blocks will be imported if present, or ignored if absent (stored as ...
opan/hess.py
def _load(self, **kwargs): """ Initialize OrcaHess Hessian object from .hess file Searches indicated file for data blocks within the .hess file. The geometry, Hessian block, frequencies, and normal modes must be present and will be retrieved; other blocks will be imported if present, o...
def _load(self, **kwargs): """ Initialize OrcaHess Hessian object from .hess file Searches indicated file for data blocks within the .hess file. The geometry, Hessian block, frequencies, and normal modes must be present and will be retrieved; other blocks will be imported if present, o...
[ "Initialize", "OrcaHess", "Hessian", "object", "from", ".", "hess", "file" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/hess.py#L906-L1470
[ "def", "_load", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Local method(s)", "def", "parse_multiblock", "(", "hesstext", ",", "p_block", ",", "p_sec", ",", "p_line", ",", "num_ats", ",", "blockname", ",", "tc", ")", ":", "\"\"\" Helper function for i...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
BaseSwitcher.register
Register a settings class with the switcher. Can be passed the settings class to register or be used as a decorator. :param settings_class: The class to register with the provided conditions. :param *simple_checks: A list of conditions for using the settings clas...
cbsettings/switching/__init__.py
def register(self, settings_class=NoSwitcher, *simple_checks, **conditions): """ Register a settings class with the switcher. Can be passed the settings class to register or be used as a decorator. :param settings_class: The class to register with the provided ...
def register(self, settings_class=NoSwitcher, *simple_checks, **conditions): """ Register a settings class with the switcher. Can be passed the settings class to register or be used as a decorator. :param settings_class: The class to register with the provided ...
[ "Register", "a", "settings", "class", "with", "the", "switcher", ".", "Can", "be", "passed", "the", "settings", "class", "to", "register", "or", "be", "used", "as", "a", "decorator", "." ]
matthewwithanm/django-classbasedsettings
python
https://github.com/matthewwithanm/django-classbasedsettings/blob/ac9e4362bd1f4954f3e4679b97726cab2b22aea9/cbsettings/switching/__init__.py#L32-L60
[ "def", "register", "(", "self", ",", "settings_class", "=", "NoSwitcher", ",", "*", "simple_checks", ",", "*", "*", "conditions", ")", ":", "if", "settings_class", "is", "NoSwitcher", ":", "def", "decorator", "(", "cls", ")", ":", "self", ".", "register", ...
ac9e4362bd1f4954f3e4679b97726cab2b22aea9
train
Parser._peek_buffer
Get the next line without consuming it.
haml/parse.py
def _peek_buffer(self, i=0): """Get the next line without consuming it.""" while len(self._buffer) <= i: self._buffer.append(next(self._source)) return self._buffer[i]
def _peek_buffer(self, i=0): """Get the next line without consuming it.""" while len(self._buffer) <= i: self._buffer.append(next(self._source)) return self._buffer[i]
[ "Get", "the", "next", "line", "without", "consuming", "it", "." ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/parse.py#L37-L41
[ "def", "_peek_buffer", "(", "self", ",", "i", "=", "0", ")", ":", "while", "len", "(", "self", ".", "_buffer", ")", "<=", "i", ":", "self", ".", "_buffer", ".", "append", "(", "next", "(", "self", ".", "_source", ")", ")", "return", "self", ".", ...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
Parser._make_readline_peeker
Make a readline-like function which peeks into the source.
haml/parse.py
def _make_readline_peeker(self): """Make a readline-like function which peeks into the source.""" counter = itertools.count(0) def readline(): try: return self._peek_buffer(next(counter)) except StopIteration: return '' return readl...
def _make_readline_peeker(self): """Make a readline-like function which peeks into the source.""" counter = itertools.count(0) def readline(): try: return self._peek_buffer(next(counter)) except StopIteration: return '' return readl...
[ "Make", "a", "readline", "-", "like", "function", "which", "peeks", "into", "the", "source", "." ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/parse.py#L52-L60
[ "def", "_make_readline_peeker", "(", "self", ")", ":", "counter", "=", "itertools", ".", "count", "(", "0", ")", "def", "readline", "(", ")", ":", "try", ":", "return", "self", ".", "_peek_buffer", "(", "next", "(", "counter", ")", ")", "except", "Stop...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
Parser._consume_python_token
Consume the buffer up to the given token (from _peek_python_tokens). Returns a single string that was consumed.
haml/parse.py
def _consume_python_token(self, token): """Consume the buffer up to the given token (from _peek_python_tokens). Returns a single string that was consumed. """ ret = [] line, col = token[3] if line > 1: ret = self._buffer[:line-1] self._buffer[:li...
def _consume_python_token(self, token): """Consume the buffer up to the given token (from _peek_python_tokens). Returns a single string that was consumed. """ ret = [] line, col = token[3] if line > 1: ret = self._buffer[:line-1] self._buffer[:li...
[ "Consume", "the", "buffer", "up", "to", "the", "given", "token", "(", "from", "_peek_python_tokens", ")", "." ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/parse.py#L70-L83
[ "def", "_consume_python_token", "(", "self", ",", "token", ")", ":", "ret", "=", "[", "]", "line", ",", "col", "=", "token", "[", "3", "]", "if", "line", ">", "1", ":", "ret", "=", "self", ".", "_buffer", "[", ":", "line", "-", "1", "]", "self"...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
Parser._add_node
Add a node to the graph, and the stack.
haml/parse.py
def _add_node(self, node, depth): """Add a node to the graph, and the stack.""" self._topmost_node.add_child(node, bool(depth[1])) self._stack.append((depth, node))
def _add_node(self, node, depth): """Add a node to the graph, and the stack.""" self._topmost_node.add_child(node, bool(depth[1])) self._stack.append((depth, node))
[ "Add", "a", "node", "to", "the", "graph", "and", "the", "stack", "." ]
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/haml/parse.py#L386-L389
[ "def", "_add_node", "(", "self", ",", "node", ",", "depth", ")", ":", "self", ".", "_topmost_node", ".", "add_child", "(", "node", ",", "bool", "(", "depth", "[", "1", "]", ")", ")", "self", ".", "_stack", ".", "append", "(", "(", "depth", ",", "...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
OpanXYZ._load_data
Internal function for making XYZ object from explicit geom data. Parameters ---------- atom_syms Squeezes to array of N |str| -- Element symbols for the XYZ. Must be valid elements as defined in the keys of :data:`const.atom_num <opan.const.atom_num>`. ...
opan/xyz.py
def _load_data(self, atom_syms, coords, bohrs=True): """ Internal function for making XYZ object from explicit geom data. Parameters ---------- atom_syms Squeezes to array of N |str| -- Element symbols for the XYZ. Must be valid elements as defined in ...
def _load_data(self, atom_syms, coords, bohrs=True): """ Internal function for making XYZ object from explicit geom data. Parameters ---------- atom_syms Squeezes to array of N |str| -- Element symbols for the XYZ. Must be valid elements as defined in ...
[ "Internal", "function", "for", "making", "XYZ", "object", "from", "explicit", "geom", "data", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L354-L438
[ "def", "_load_data", "(", "self", ",", "atom_syms", ",", "coords", ",", "bohrs", "=", "True", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", ".", "const", "import", "atom_num", ",", "PHYS", "from", ".", "error", "import", "XYZError", "# Gr...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ._load_file
Initialize OpanXYZ geometry object from OpenBabel file Import of an arbitrary number of multiple geometries from an OpenBabel file. All geometries must have the same number and type of atoms, and the ordering of atom types must be retained throughout. Parameters ---------- ...
opan/xyz.py
def _load_file(self, XYZ_path, bohrs=False): """ Initialize OpanXYZ geometry object from OpenBabel file Import of an arbitrary number of multiple geometries from an OpenBabel file. All geometries must have the same number and type of atoms, and the ordering of atom types must be retaine...
def _load_file(self, XYZ_path, bohrs=False): """ Initialize OpanXYZ geometry object from OpenBabel file Import of an arbitrary number of multiple geometries from an OpenBabel file. All geometries must have the same number and type of atoms, and the ordering of atom types must be retaine...
[ "Initialize", "OpanXYZ", "geometry", "object", "from", "OpenBabel", "file" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L443-L676
[ "def", "_load_file", "(", "self", ",", "XYZ_path", ",", "bohrs", "=", "False", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", ".", "const", "import", "CIC", ",", "PHYS", ",", "atom_num", ",", "atom_sym", "from", ".", "error", "import", "...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.geom_iter
Iterator over a subset of geometries. The indices of the geometries to be returned are indicated by an iterable of |int|\\ s passed as `g_nums`. As with :meth:`geom_single`, each geometry is returned as a length-3N |npfloat_| with each atom's x/y/z coordinates grouped together:...
opan/xyz.py
def geom_iter(self, g_nums): """Iterator over a subset of geometries. The indices of the geometries to be returned are indicated by an iterable of |int|\\ s passed as `g_nums`. As with :meth:`geom_single`, each geometry is returned as a length-3N |npfloat_| with each atom's x/y...
def geom_iter(self, g_nums): """Iterator over a subset of geometries. The indices of the geometries to be returned are indicated by an iterable of |int|\\ s passed as `g_nums`. As with :meth:`geom_single`, each geometry is returned as a length-3N |npfloat_| with each atom's x/y...
[ "Iterator", "over", "a", "subset", "of", "geometries", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L725-L770
[ "def", "geom_iter", "(", "self", ",", "g_nums", ")", ":", "# Using the custom coded pack_tups to not have to care whether the", "# input is iterable", "from", ".", "utils", "import", "pack_tups", "vals", "=", "pack_tups", "(", "g_nums", ")", "for", "val", "in", "vals...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.dist_single
Distance between two atoms. Parameters ---------- g_num |int| -- Index of the desired geometry at_1 |int| -- Index of the first atom at_2 |int| -- Index of the second atom Returns ------- dist |npfloat_| ...
opan/xyz.py
def dist_single(self, g_num, at_1, at_2): """ Distance between two atoms. Parameters ---------- g_num |int| -- Index of the desired geometry at_1 |int| -- Index of the first atom at_2 |int| -- Index of the second atom Return...
def dist_single(self, g_num, at_1, at_2): """ Distance between two atoms. Parameters ---------- g_num |int| -- Index of the desired geometry at_1 |int| -- Index of the first atom at_2 |int| -- Index of the second atom Return...
[ "Distance", "between", "two", "atoms", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L775-L836
[ "def", "dist_single", "(", "self", ",", "g_num", ",", "at_1", ",", "at_2", ")", ":", "# Import used math library function(s)", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", "utils", "import", "safe_cast", "as", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.dist_iter
Iterator over selected interatomic distances. Distances are in Bohrs as with :meth:`dist_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g_nums |int| or length-R iterable |int| or |None| -- ...
opan/xyz.py
def dist_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over selected interatomic distances. Distances are in Bohrs as with :meth:`dist_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
def dist_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over selected interatomic distances. Distances are in Bohrs as with :meth:`dist_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
[ "Iterator", "over", "selected", "interatomic", "distances", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L841-L913
[ "def", "dist_iter", "(", "self", ",", "g_nums", ",", "ats_1", ",", "ats_2", ",", "invalid_error", "=", "False", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", ".", "utils", "import", "pack_tups", "# Print the function inputs if debug mode is on", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.angle_single
Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`. Parameters ---------- g_num |int| -- Index of the desired geometry ...
opan/xyz.py
def angle_single(self, g_num, at_1, at_2, at_3): """ Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`. Parameters ---------- g_num ...
def angle_single(self, g_num, at_1, at_2, at_3): """ Spanning angle among three atoms. The indices `at_1` and `at_3` can be the same (yielding a trivial zero angle), but `at_2` must be different from both `at_1` and `at_3`. Parameters ---------- g_num ...
[ "Spanning", "angle", "among", "three", "atoms", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L919-L1010
[ "def", "angle_single", "(", "self", ",", "g_num", ",", "at_1", ",", "at_2", ",", "at_3", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", ".", "utils", "import", "safe_cast", "as", "scast", "from", ".", "utils", ".", "vector", "import", "v...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.angle_iter
Iterator over selected atomic angles. Angles are in degrees as with :meth:`angle_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g_nums |int| or iterable |int| or |None| -- Index of the desi...
opan/xyz.py
def angle_iter(self, g_nums, ats_1, ats_2, ats_3, invalid_error=False): """ Iterator over selected atomic angles. Angles are in degrees as with :meth:`angle_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
def angle_iter(self, g_nums, ats_1, ats_2, ats_3, invalid_error=False): """ Iterator over selected atomic angles. Angles are in degrees as with :meth:`angle_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g...
[ "Iterator", "over", "selected", "atomic", "angles", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1015-L1098
[ "def", "angle_iter", "(", "self", ",", "g_nums", ",", "ats_1", ",", "ats_2", ",", "ats_3", ",", "invalid_error", "=", "False", ")", ":", "# Suitability of ats_n indices will be checked within the", "# self.angle_single() calls and thus no check is needed here.", "# Import th...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.dihed_single
Dihedral/out-of-plane angle among four atoms. Returns the out-of-plane angle among four atoms from geometry `g_num`, in degrees. The reference plane is spanned by `at_1`, `at_2` and `at_3`. The out-of-plane angle is defined such that a positive angle represents a counter-clockwise ...
opan/xyz.py
def dihed_single(self, g_num, at_1, at_2, at_3, at_4): """ Dihedral/out-of-plane angle among four atoms. Returns the out-of-plane angle among four atoms from geometry `g_num`, in degrees. The reference plane is spanned by `at_1`, `at_2` and `at_3`. The out-of-plane angle is def...
def dihed_single(self, g_num, at_1, at_2, at_3, at_4): """ Dihedral/out-of-plane angle among four atoms. Returns the out-of-plane angle among four atoms from geometry `g_num`, in degrees. The reference plane is spanned by `at_1`, `at_2` and `at_3`. The out-of-plane angle is def...
[ "Dihedral", "/", "out", "-", "of", "-", "plane", "angle", "among", "four", "atoms", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1104-L1288
[ "def", "dihed_single", "(", "self", ",", "g_num", ",", "at_1", ",", "at_2", ",", "at_3", ",", "at_4", ")", ":", "# library imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", "utils", ".", "vector", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.dihed_iter
Iterator over selected dihedral angles. Angles are in degrees as with :meth:`dihed_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g_nums |int| or iterable |int| or |None| -- Indices of the...
opan/xyz.py
def dihed_iter(self, g_nums, ats_1, ats_2, ats_3, ats_4, \ invalid_error=False): """ Iterator over selected dihedral angles. Angles are in degrees as with :meth:`dihed_single`. See `above <toc-generators_>`_ for more information on ca...
def dihed_iter(self, g_nums, ats_1, ats_2, ats_3, ats_4, \ invalid_error=False): """ Iterator over selected dihedral angles. Angles are in degrees as with :meth:`dihed_single`. See `above <toc-generators_>`_ for more information on ca...
[ "Iterator", "over", "selected", "dihedral", "angles", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1293-L1384
[ "def", "dihed_iter", "(", "self", ",", "g_nums", ",", "ats_1", ",", "ats_2", ",", "ats_3", ",", "ats_4", ",", "invalid_error", "=", "False", ")", ":", "# Suitability of ats_n indices will be checked within the", "# self.dihed_single() calls and thus no check is needed here...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.displ_single
Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohrs. Parameters ---------- g_num...
opan/xyz.py
def displ_single(self, g_num, at_1, at_2): """ Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohr...
def displ_single(self, g_num, at_1, at_2): """ Displacement vector between two atoms. Returns the displacement vector pointing from `at_1` toward `at_2` from geometry `g_num`. If `at_1` == `at_2` a strict zero vector is returned. Displacement vector is returned in units of Bohr...
[ "Displacement", "vector", "between", "two", "atoms", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1390-L1457
[ "def", "displ_single", "(", "self", ",", "g_num", ",", "at_1", ",", "at_2", ")", ":", "# Library imports", "import", "numpy", "as", "np", "from", ".", "utils", "import", "safe_cast", "as", "scast", "# The below errors are explicitly thrown since they are multiplied by...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ.displ_iter
Iterator over indicated displacement vectors. Displacements are in Bohrs as with :meth:`displ_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- g_nums |int| or length-R iterable |int| or |None| -- ...
opan/xyz.py
def displ_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over indicated displacement vectors. Displacements are in Bohrs as with :meth:`displ_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- ...
def displ_iter(self, g_nums, ats_1, ats_2, invalid_error=False): """ Iterator over indicated displacement vectors. Displacements are in Bohrs as with :meth:`displ_single`. See `above <toc-generators_>`_ for more information on calling options. Parameters ---------- ...
[ "Iterator", "over", "indicated", "displacement", "vectors", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1462-L1531
[ "def", "displ_iter", "(", "self", ",", "g_nums", ",", "ats_1", ",", "ats_2", ",", "invalid_error", "=", "False", ")", ":", "# Import the tuple-generating function", "from", ".", "utils", "import", "pack_tups", "# Print the function inputs if debug mode is on", "if", "...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ._none_subst
Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after error-checking the arguments for a max of one |None| value, and ensuring that if a |Non...
opan/xyz.py
def _none_subst(self, *args): """ Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after error-checking the arguments for a max of one |None| ...
def _none_subst(self, *args): """ Helper function to insert full ranges for |None| for X_iter methods. Custom method, specifically tailored, taking in the arguments from an X_iter method and performing the replacement of |None| after error-checking the arguments for a max of one |None| ...
[ "Helper", "function", "to", "insert", "full", "ranges", "for", "|None|", "for", "X_iter", "methods", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1537-L1599
[ "def", "_none_subst", "(", "self", ",", "*", "args", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Initialize argument list return value, and as None not found", "arglist", "=", "[", "a", "for", "a", "in", "args", "]", "none_found", "=", "False", "# C...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
OpanXYZ._iter_return
Wrapper for exception/|None| output handling of X_iter methods. Attempts to pass `tup` as arguments to `fxn`. If the call is successful, returns the value produced. If :exc:`~exceptions.IndexError` or :exc:`~exceptions.ValueError` is raised, indicating an invalid index value, r...
opan/xyz.py
def _iter_return(tup, fxn, invalid_error): """ Wrapper for exception/|None| output handling of X_iter methods. Attempts to pass `tup` as arguments to `fxn`. If the call is successful, returns the value produced. If :exc:`~exceptions.IndexError` or :exc:`~exceptions.ValueError` ...
def _iter_return(tup, fxn, invalid_error): """ Wrapper for exception/|None| output handling of X_iter methods. Attempts to pass `tup` as arguments to `fxn`. If the call is successful, returns the value produced. If :exc:`~exceptions.IndexError` or :exc:`~exceptions.ValueError` ...
[ "Wrapper", "for", "exception", "/", "|None|", "output", "handling", "of", "X_iter", "methods", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/xyz.py#L1605-L1654
[ "def", "_iter_return", "(", "tup", ",", "fxn", ",", "invalid_error", ")", ":", "try", ":", "val", "=", "fxn", "(", "*", "tup", ")", "except", "(", "IndexError", ",", "ValueError", ")", ":", "if", "invalid_error", ":", "# Raise the exception if invalid_error ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
guess_external_url
Return a URL that is most likely to route to `local_host` from outside. The point is that we may be running on a remote host from the user's point of view, so they can't access `local_host` from a Web browser just by typing ``http://localhost:12345/``.
turq/util/http.py
def guess_external_url(local_host, port): """Return a URL that is most likely to route to `local_host` from outside. The point is that we may be running on a remote host from the user's point of view, so they can't access `local_host` from a Web browser just by typing ``http://localhost:12345/``. "...
def guess_external_url(local_host, port): """Return a URL that is most likely to route to `local_host` from outside. The point is that we may be running on a remote host from the user's point of view, so they can't access `local_host` from a Web browser just by typing ``http://localhost:12345/``. "...
[ "Return", "a", "URL", "that", "is", "most", "likely", "to", "route", "to", "local_host", "from", "outside", "." ]
vfaronov/turq
python
https://github.com/vfaronov/turq/blob/3ef1261442b90d6d947b8fe2362e19e7f47a64c3/turq/util/http.py#L49-L79
[ "def", "guess_external_url", "(", "local_host", ",", "port", ")", ":", "if", "local_host", "in", "[", "'0.0.0.0'", ",", "'::'", "]", ":", "# The server is listening on all interfaces, but we have to pick one.", "# The system's FQDN should give us a hint.", "local_host", "=", ...
3ef1261442b90d6d947b8fe2362e19e7f47a64c3
train
DataFrameBuilder._check_column_lengths
Make sure columns are of the same length or else DataFrame construction will fail.
isovar/dataframe_builder.py
def _check_column_lengths(self): """ Make sure columns are of the same length or else DataFrame construction will fail. """ column_lengths_dict = { name: len(xs) for (name, xs) in self.columns_dict.items() } unique_column_length...
def _check_column_lengths(self): """ Make sure columns are of the same length or else DataFrame construction will fail. """ column_lengths_dict = { name: len(xs) for (name, xs) in self.columns_dict.items() } unique_column_length...
[ "Make", "sure", "columns", "are", "of", "the", "same", "length", "or", "else", "DataFrame", "construction", "will", "fail", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/dataframe_builder.py#L169-L182
[ "def", "_check_column_lengths", "(", "self", ")", ":", "column_lengths_dict", "=", "{", "name", ":", "len", "(", "xs", ")", "for", "(", "name", ",", "xs", ")", "in", "self", ".", "columns_dict", ".", "items", "(", ")", "}", "unique_column_lengths", "=", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
OpanVPT2.new_from_files
Initialize with data from files.
opan/vpt2/base.py
def new_from_files(self, basepath, basename, repo, \ bohrs=False, \ software=_E_SW.ORCA, \ repo_clobber=False, **kwargs): """ Initialize with data from files. """ # Imports import os from os import path as osp ...
def new_from_files(self, basepath, basename, repo, \ bohrs=False, \ software=_E_SW.ORCA, \ repo_clobber=False, **kwargs): """ Initialize with data from files. """ # Imports import os from os import path as osp ...
[ "Initialize", "with", "data", "from", "files", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/vpt2/base.py#L54-L144
[ "def", "new_from_files", "(", "self", ",", "basepath", ",", "basename", ",", "repo", ",", "bohrs", "=", "False", ",", "software", "=", "_E_SW", ".", "ORCA", ",", "repo_clobber", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Imports", "import", "o...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
literal_eval
Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None.
scratch/parse_flexible_args.py
def literal_eval(node_or_string): """ Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None. """ _safe_names = { ...
def literal_eval(node_or_string): """ Safely evaluate an expression node or a string containing a Python expression. The string or node provided may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None. """ _safe_names = { ...
[ "Safely", "evaluate", "an", "expression", "node", "or", "a", "string", "containing", "a", "Python", "expression", ".", "The", "string", "or", "node", "provided", "may", "only", "consist", "of", "the", "following", "Python", "literal", "structures", ":", "strin...
mikeboers/PyHAML
python
https://github.com/mikeboers/PyHAML/blob/9ecb7c85349948428474869aad5b8d1c7de8dbed/scratch/parse_flexible_args.py#L46-L118
[ "def", "literal_eval", "(", "node_or_string", ")", ":", "_safe_names", "=", "{", "'None'", ":", "None", ",", "'True'", ":", "True", ",", "'False'", ":", "False", ",", "'dict'", ":", "dict", ",", "'list'", ":", "list", ",", "'sorted'", ":", "sorted", "}...
9ecb7c85349948428474869aad5b8d1c7de8dbed
train
remote_exception
Metaclass that wraps exception type in RemoteException
mentor/utils.py
def remote_exception(exc, tb): """ Metaclass that wraps exception type in RemoteException """ if type(exc) in exceptions: typ = exceptions[type(exc)] return typ(exc, tb) else: try: typ = type(exc.__class__.__name__, (RemoteException, type(exc)), ...
def remote_exception(exc, tb): """ Metaclass that wraps exception type in RemoteException """ if type(exc) in exceptions: typ = exceptions[type(exc)] return typ(exc, tb) else: try: typ = type(exc.__class__.__name__, (RemoteException, type(exc)), ...
[ "Metaclass", "that", "wraps", "exception", "type", "in", "RemoteException" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/utils.py#L61-L74
[ "def", "remote_exception", "(", "exc", ",", "tb", ")", ":", "if", "type", "(", "exc", ")", "in", "exceptions", ":", "typ", "=", "exceptions", "[", "type", "(", "exc", ")", "]", "return", "typ", "(", "exc", ",", "tb", ")", "else", ":", "try", ":",...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
allele_reads_from_locus_reads
Given a collection of LocusRead objects, returns a list of AlleleRead objects (which are split into prefix/allele/suffix nucleotide strings). Parameters ---------- locus_reads : sequence of LocusRead records n_ref : int Number of reference nucleotides affected by variant. Generate...
isovar/allele_reads.py
def allele_reads_from_locus_reads(locus_reads, n_ref): """ Given a collection of LocusRead objects, returns a list of AlleleRead objects (which are split into prefix/allele/suffix nucleotide strings). Parameters ---------- locus_reads : sequence of LocusRead records n_ref : int ...
def allele_reads_from_locus_reads(locus_reads, n_ref): """ Given a collection of LocusRead objects, returns a list of AlleleRead objects (which are split into prefix/allele/suffix nucleotide strings). Parameters ---------- locus_reads : sequence of LocusRead records n_ref : int ...
[ "Given", "a", "collection", "of", "LocusRead", "objects", "returns", "a", "list", "of", "AlleleRead", "objects", "(", "which", "are", "split", "into", "prefix", "/", "allele", "/", "suffix", "nucleotide", "strings", ")", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L142-L163
[ "def", "allele_reads_from_locus_reads", "(", "locus_reads", ",", "n_ref", ")", ":", "for", "locus_read", "in", "locus_reads", ":", "allele_read", "=", "AlleleRead", ".", "from_locus_read", "(", "locus_read", ",", "n_ref", ")", "if", "allele_read", "is", "None", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reads_overlapping_variant
Find reads in the given SAM/BAM file which overlap the given variant and return them as a list of AlleleRead objects. Parameters ---------- samfile : pysam.AlignmentFile variant : varcode.Variant chromosome : str use_duplicate_reads : bool Should we use reads that have been marke...
isovar/allele_reads.py
def reads_overlapping_variant( samfile, variant, chromosome=None, use_duplicate_reads=USE_DUPLICATE_READS, use_secondary_alignments=USE_SECONDARY_ALIGNMENTS, min_mapping_quality=MIN_READ_MAPPING_QUALITY): """ Find reads in the given SAM/BAM file which overlap the ...
def reads_overlapping_variant( samfile, variant, chromosome=None, use_duplicate_reads=USE_DUPLICATE_READS, use_secondary_alignments=USE_SECONDARY_ALIGNMENTS, min_mapping_quality=MIN_READ_MAPPING_QUALITY): """ Find reads in the given SAM/BAM file which overlap the ...
[ "Find", "reads", "in", "the", "given", "SAM", "/", "BAM", "file", "which", "overlap", "the", "given", "variant", "and", "return", "them", "as", "a", "list", "of", "AlleleRead", "objects", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L165-L232
[ "def", "reads_overlapping_variant", "(", "samfile", ",", "variant", ",", "chromosome", "=", "None", ",", "use_duplicate_reads", "=", "USE_DUPLICATE_READS", ",", "use_secondary_alignments", "=", "USE_SECONDARY_ALIGNMENTS", ",", "min_mapping_quality", "=", "MIN_READ_MAPPING_Q...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reads_overlapping_variants
Generates sequence of tuples, each containing a variant paired with a list of AlleleRead objects. Parameters ---------- variants : varcode.VariantCollection samfile : pysam.AlignmentFile use_duplicate_reads : bool Should we use reads that have been marked as PCR duplicates use_se...
isovar/allele_reads.py
def reads_overlapping_variants(variants, samfile, **kwargs): """ Generates sequence of tuples, each containing a variant paired with a list of AlleleRead objects. Parameters ---------- variants : varcode.VariantCollection samfile : pysam.AlignmentFile use_duplicate_reads : bool ...
def reads_overlapping_variants(variants, samfile, **kwargs): """ Generates sequence of tuples, each containing a variant paired with a list of AlleleRead objects. Parameters ---------- variants : varcode.VariantCollection samfile : pysam.AlignmentFile use_duplicate_reads : bool ...
[ "Generates", "sequence", "of", "tuples", "each", "containing", "a", "variant", "paired", "with", "a", "list", "of", "AlleleRead", "objects", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L234-L280
[ "def", "reads_overlapping_variants", "(", "variants", ",", "samfile", ",", "*", "*", "kwargs", ")", ":", "chromosome_names", "=", "set", "(", "samfile", ".", "references", ")", "for", "variant", "in", "variants", ":", "# I imagine the conversation went like this:", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
group_reads_by_allele
Returns dictionary mapping each allele's nucleotide sequence to a list of supporting AlleleRead objects.
isovar/allele_reads.py
def group_reads_by_allele(allele_reads): """ Returns dictionary mapping each allele's nucleotide sequence to a list of supporting AlleleRead objects. """ allele_to_reads_dict = defaultdict(list) for allele_read in allele_reads: allele_to_reads_dict[allele_read.allele].append(allele_read)...
def group_reads_by_allele(allele_reads): """ Returns dictionary mapping each allele's nucleotide sequence to a list of supporting AlleleRead objects. """ allele_to_reads_dict = defaultdict(list) for allele_read in allele_reads: allele_to_reads_dict[allele_read.allele].append(allele_read)...
[ "Returns", "dictionary", "mapping", "each", "allele", "s", "nucleotide", "sequence", "to", "a", "list", "of", "supporting", "AlleleRead", "objects", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L283-L291
[ "def", "group_reads_by_allele", "(", "allele_reads", ")", ":", "allele_to_reads_dict", "=", "defaultdict", "(", "list", ")", "for", "allele_read", "in", "allele_reads", ":", "allele_to_reads_dict", "[", "allele_read", ".", "allele", "]", ".", "append", "(", "allel...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
reads_to_dataframe
Parameters ---------- variants_and_allele_reads : sequence List or generator of pairs whose first element is a Variant and whose second element is a sequence of AlleleRead objects.
isovar/allele_reads.py
def reads_to_dataframe(variants_and_allele_reads): """ Parameters ---------- variants_and_allele_reads : sequence List or generator of pairs whose first element is a Variant and whose second element is a sequence of AlleleRead objects. """ df_builder = DataFrameBuilder( A...
def reads_to_dataframe(variants_and_allele_reads): """ Parameters ---------- variants_and_allele_reads : sequence List or generator of pairs whose first element is a Variant and whose second element is a sequence of AlleleRead objects. """ df_builder = DataFrameBuilder( A...
[ "Parameters", "----------", "variants_and_allele_reads", ":", "sequence", "List", "or", "generator", "of", "pairs", "whose", "first", "element", "is", "a", "Variant", "and", "whose", "second", "element", "is", "a", "sequence", "of", "AlleleRead", "objects", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L293-L308
[ "def", "reads_to_dataframe", "(", "variants_and_allele_reads", ")", ":", "df_builder", "=", "DataFrameBuilder", "(", "AlleleRead", ",", "extra_column_fns", "=", "{", "\"gene\"", ":", "lambda", "variant", ",", "_", ":", "\";\"", ".", "join", "(", "variant", ".", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
AlleleRead.from_locus_read
Given a single LocusRead object, return either an AlleleRead or None Parameters ---------- locus_read : LocusRead Read which overlaps a variant locus but doesn't necessarily contain the alternate nucleotides n_ref : int Number of reference positions ...
isovar/allele_reads.py
def from_locus_read(cls, locus_read, n_ref): """ Given a single LocusRead object, return either an AlleleRead or None Parameters ---------- locus_read : LocusRead Read which overlaps a variant locus but doesn't necessarily contain the alternate nucleotide...
def from_locus_read(cls, locus_read, n_ref): """ Given a single LocusRead object, return either an AlleleRead or None Parameters ---------- locus_read : LocusRead Read which overlaps a variant locus but doesn't necessarily contain the alternate nucleotide...
[ "Given", "a", "single", "LocusRead", "object", "return", "either", "an", "AlleleRead", "or", "None" ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/allele_reads.py#L52-L140
[ "def", "from_locus_read", "(", "cls", ",", "locus_read", ",", "n_ref", ")", ":", "sequence", "=", "locus_read", ".", "sequence", "reference_positions", "=", "locus_read", ".", "reference_positions", "# positions of the nucleotides before and after the variant within", "# th...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
nucleotide_counts
Count the number of times {A, C, T, G} occur at each position to the left and right of the variant. Parameters ---------- variant_reads : list of AlleleRead objects Expected to all contain the same variant allele. Returns a tuple with the following elements: - a matrix with four ro...
isovar/nucleotide_counts.py
def nucleotide_counts(variant_reads): """ Count the number of times {A, C, T, G} occur at each position to the left and right of the variant. Parameters ---------- variant_reads : list of AlleleRead objects Expected to all contain the same variant allele. Returns a tuple with the f...
def nucleotide_counts(variant_reads): """ Count the number of times {A, C, T, G} occur at each position to the left and right of the variant. Parameters ---------- variant_reads : list of AlleleRead objects Expected to all contain the same variant allele. Returns a tuple with the f...
[ "Count", "the", "number", "of", "times", "{", "A", "C", "T", "G", "}", "occur", "at", "each", "position", "to", "the", "left", "and", "right", "of", "the", "variant", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/nucleotide_counts.py#L29-L78
[ "def", "nucleotide_counts", "(", "variant_reads", ")", ":", "variant_seq", "=", "get_single_allele_from_reads", "(", "variant_reads", ")", "prefix_suffix_pairs", "=", "make_prefix_suffix_pairs", "(", "variant_reads", ")", "n_reads", "=", "len", "(", "prefix_suffix_pairs",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
most_common_nucleotides
Find the most common nucleotide at each offset to the left and right of a variant. Parameters ---------- partitioned_read_sequences : list of tuples Each tuple has three elements: - sequence before mutant nucleotides - mutant nucleotides - sequence after muta...
isovar/nucleotide_counts.py
def most_common_nucleotides(partitioned_read_sequences): """ Find the most common nucleotide at each offset to the left and right of a variant. Parameters ---------- partitioned_read_sequences : list of tuples Each tuple has three elements: - sequence before mutant nucleotid...
def most_common_nucleotides(partitioned_read_sequences): """ Find the most common nucleotide at each offset to the left and right of a variant. Parameters ---------- partitioned_read_sequences : list of tuples Each tuple has three elements: - sequence before mutant nucleotid...
[ "Find", "the", "most", "common", "nucleotide", "at", "each", "offset", "to", "the", "left", "and", "right", "of", "a", "variant", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/nucleotide_counts.py#L81-L112
[ "def", "most_common_nucleotides", "(", "partitioned_read_sequences", ")", ":", "counts", ",", "variant_column_indices", "=", "nucleotide_counts", "(", "partitioned_read_sequences", ")", "max_count_per_column", "=", "counts", ".", "max", "(", "axis", "=", "0", ")", "as...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
point_displ
Calculate the displacement vector between two n-D points. pt1 - pt2 .. todo:: Complete point_disp docstring
opan/utils/symm.py
def point_displ(pt1, pt2): """ Calculate the displacement vector between two n-D points. pt1 - pt2 .. todo:: Complete point_disp docstring """ #Imports import numpy as np # Make iterable if not np.iterable(pt1): pt1 = np.float64(np.array([pt1])) else: pt1 = np.fl...
def point_displ(pt1, pt2): """ Calculate the displacement vector between two n-D points. pt1 - pt2 .. todo:: Complete point_disp docstring """ #Imports import numpy as np # Make iterable if not np.iterable(pt1): pt1 = np.float64(np.array([pt1])) else: pt1 = np.fl...
[ "Calculate", "the", "displacement", "vector", "between", "two", "n", "-", "D", "points", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L42-L68
[ "def", "point_displ", "(", "pt1", ",", "pt2", ")", ":", "#Imports", "import", "numpy", "as", "np", "# Make iterable", "if", "not", "np", ".", "iterable", "(", "pt1", ")", ":", "pt1", "=", "np", ".", "float64", "(", "np", ".", "array", "(", "[", "pt...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
point_dist
Calculate the Euclidean distance between two n-D points. |pt1 - pt2| .. todo:: Complete point_dist docstring
opan/utils/symm.py
def point_dist(pt1, pt2): """ Calculate the Euclidean distance between two n-D points. |pt1 - pt2| .. todo:: Complete point_dist docstring """ # Imports from scipy import linalg as spla dist = spla.norm(point_displ(pt1, pt2)) return dist
def point_dist(pt1, pt2): """ Calculate the Euclidean distance between two n-D points. |pt1 - pt2| .. todo:: Complete point_dist docstring """ # Imports from scipy import linalg as spla dist = spla.norm(point_displ(pt1, pt2)) return dist
[ "Calculate", "the", "Euclidean", "distance", "between", "two", "n", "-", "D", "points", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L73-L86
[ "def", "point_dist", "(", "pt1", ",", "pt2", ")", ":", "# Imports", "from", "scipy", "import", "linalg", "as", "spla", "dist", "=", "spla", ".", "norm", "(", "point_displ", "(", "pt1", ",", "pt2", ")", ")", "return", "dist" ]
0b1b21662df6abc971407a9386db21a8796fbfe5
train
point_rotate
Rotate a 3-D point around a 3-D axis through the origin. Handedness is a counter-clockwise rotation when viewing the rotation axis as pointing at the observer. Thus, in a right-handed x-y-z frame, a 90deg rotation of (1,0,0) around the z-axis (0,0,1) yields a point at (0,1,0). .. todo:: Complete ...
opan/utils/symm.py
def point_rotate(pt, ax, theta): """ Rotate a 3-D point around a 3-D axis through the origin. Handedness is a counter-clockwise rotation when viewing the rotation axis as pointing at the observer. Thus, in a right-handed x-y-z frame, a 90deg rotation of (1,0,0) around the z-axis (0,0,1) yields a point...
def point_rotate(pt, ax, theta): """ Rotate a 3-D point around a 3-D axis through the origin. Handedness is a counter-clockwise rotation when viewing the rotation axis as pointing at the observer. Thus, in a right-handed x-y-z frame, a 90deg rotation of (1,0,0) around the z-axis (0,0,1) yields a point...
[ "Rotate", "a", "3", "-", "D", "point", "around", "a", "3", "-", "D", "axis", "through", "the", "origin", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L91-L118
[ "def", "point_rotate", "(", "pt", ",", "ax", ",", "theta", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Ensure pt is reducible to 3-D vector.", "pt", "=", "make_nd_vec", "(", "pt", ",", "nd", "=", "3", ",", "t", "=", "np", ".", "float64", ","...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
point_reflect
Reflect a 3-D point through a plane intersecting the origin. nv defines the normal vector to the plane (needs not be normalized) .. todo:: Complete point_reflect docstring Raises ------ ValueError : If pt or nv are not reducible to 3-D vectors ValueError : If norm of nv is too small
opan/utils/symm.py
def point_reflect(pt, nv): """ Reflect a 3-D point through a plane intersecting the origin. nv defines the normal vector to the plane (needs not be normalized) .. todo:: Complete point_reflect docstring Raises ------ ValueError : If pt or nv are not reducible to 3-D vectors ValueError : I...
def point_reflect(pt, nv): """ Reflect a 3-D point through a plane intersecting the origin. nv defines the normal vector to the plane (needs not be normalized) .. todo:: Complete point_reflect docstring Raises ------ ValueError : If pt or nv are not reducible to 3-D vectors ValueError : I...
[ "Reflect", "a", "3", "-", "D", "point", "through", "a", "plane", "intersecting", "the", "origin", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L123-L145
[ "def", "point_reflect", "(", "pt", ",", "nv", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "# Ensure pt is reducible to 3-D vector", "pt", "=", "make_nd_vec", "(", "pt", ",", "nd", "=", "3", ",", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_reflect
Reflection symmetry operation. nv is normal vector to reflection plane g is assumed already translated to center of mass @ origin .. todo:: Complete geom_reflect docstring
opan/utils/symm.py
def geom_reflect(g, nv): """ Reflection symmetry operation. nv is normal vector to reflection plane g is assumed already translated to center of mass @ origin .. todo:: Complete geom_reflect docstring """ # Imports import numpy as np # Force g to n-vector g = make_nd_vec(g, nd=N...
def geom_reflect(g, nv): """ Reflection symmetry operation. nv is normal vector to reflection plane g is assumed already translated to center of mass @ origin .. todo:: Complete geom_reflect docstring """ # Imports import numpy as np # Force g to n-vector g = make_nd_vec(g, nd=N...
[ "Reflection", "symmetry", "operation", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L150-L169
[ "def", "geom_reflect", "(", "g", ",", "nv", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Force g to n-vector", "g", "=", "make_nd_vec", "(", "g", ",", "nd", "=", "None", ",", "t", "=", "np", ".", "float64", ",", "norm", "=", "False", ")",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_rotate
Rotation symmetry operation. ax is rotation axis g is assumed already translated to center of mass @ origin Sense of rotation is the same as point_rotate .. todo:: Complete geom_rotate docstring
opan/utils/symm.py
def geom_rotate(g, ax, theta): """ Rotation symmetry operation. ax is rotation axis g is assumed already translated to center of mass @ origin Sense of rotation is the same as point_rotate .. todo:: Complete geom_rotate docstring """ # Imports import numpy as np # Force g to n-...
def geom_rotate(g, ax, theta): """ Rotation symmetry operation. ax is rotation axis g is assumed already translated to center of mass @ origin Sense of rotation is the same as point_rotate .. todo:: Complete geom_rotate docstring """ # Imports import numpy as np # Force g to n-...
[ "Rotation", "symmetry", "operation", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L174-L195
[ "def", "geom_rotate", "(", "g", ",", "ax", ",", "theta", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Force g to n-vector", "g", "=", "make_nd_vec", "(", "g", ",", "nd", "=", "None", ",", "t", "=", "np", ".", "float64", ",", "norm", "=", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
symm_op
Perform general point symmetry operation on a geometry. .. todo:: Complete symm_op docstring
opan/utils/symm.py
def symm_op(g, ax, theta, do_refl): """ Perform general point symmetry operation on a geometry. .. todo:: Complete symm_op docstring """ # Imports import numpy as np # Depend on lower functions' geometry vector coercion. Just # do the rotation and, if indicated, the reflection. gx =...
def symm_op(g, ax, theta, do_refl): """ Perform general point symmetry operation on a geometry. .. todo:: Complete symm_op docstring """ # Imports import numpy as np # Depend on lower functions' geometry vector coercion. Just # do the rotation and, if indicated, the reflection. gx =...
[ "Perform", "general", "point", "symmetry", "operation", "on", "a", "geometry", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L200-L218
[ "def", "symm_op", "(", "g", ",", "ax", ",", "theta", ",", "do_refl", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Depend on lower functions' geometry vector coercion. Just", "# do the rotation and, if indicated, the reflection.", "gx", "=", "geom_rotate", "("...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_symm_match
[Revised match factor calculation] .. todo:: Complete geom_symm_match docstring
opan/utils/symm.py
def geom_symm_match(g, atwts, ax, theta, do_refl): """ [Revised match factor calculation] .. todo:: Complete geom_symm_match docstring """ # Imports import numpy as np from scipy import linalg as spla # Convert g and atwts to n-D vectors g = make_nd_vec(g, nd=None, t=np.float64, norm...
def geom_symm_match(g, atwts, ax, theta, do_refl): """ [Revised match factor calculation] .. todo:: Complete geom_symm_match docstring """ # Imports import numpy as np from scipy import linalg as spla # Convert g and atwts to n-D vectors g = make_nd_vec(g, nd=None, t=np.float64, norm...
[ "[", "Revised", "match", "factor", "calculation", "]" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L223-L300
[ "def", "geom_symm_match", "(", "g", ",", "atwts", ",", "ax", ",", "theta", ",", "do_refl", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "# Convert g and atwts to n-D vectors", "g", "=", "make_nd_vec",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_find_rotsymm
Identify highest-order symmetry for a geometry on a given axis. Regular and improper axes possible. .. todo:: Complete geom_find_rotsymm docstring
opan/utils/symm.py
def geom_find_rotsymm(g, atwts, ax, improp, \ nmax=_DEF.SYMM_MATCH_NMAX, \ tol=_DEF.SYMM_MATCH_TOL): """ Identify highest-order symmetry for a geometry on a given axis. Regular and improper axes possible. .. todo:: Complete geom_find_rotsymm docstring """ # Imports import num...
def geom_find_rotsymm(g, atwts, ax, improp, \ nmax=_DEF.SYMM_MATCH_NMAX, \ tol=_DEF.SYMM_MATCH_TOL): """ Identify highest-order symmetry for a geometry on a given axis. Regular and improper axes possible. .. todo:: Complete geom_find_rotsymm docstring """ # Imports import num...
[ "Identify", "highest", "-", "order", "symmetry", "for", "a", "geometry", "on", "a", "given", "axis", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L305-L345
[ "def", "geom_find_rotsymm", "(", "g", ",", "atwts", ",", "ax", ",", "improp", ",", "nmax", "=", "_DEF", ".", "SYMM_MATCH_NMAX", ",", "tol", "=", "_DEF", ".", "SYMM_MATCH_TOL", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Vectorize the geometry", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_check_axis
[Get max proper order and reflection for an axis] .. todo:: Complete geom_parse_axis docstring
opan/utils/symm.py
def geom_check_axis(g, atwts, ax, nmax=_DEF.SYMM_MATCH_NMAX, tol=_DEF.SYMM_MATCH_TOL): """ [Get max proper order and reflection for an axis] .. todo:: Complete geom_parse_axis docstring """ # Imports import numpy as np # Store the max found rotation order of the geometry. ...
def geom_check_axis(g, atwts, ax, nmax=_DEF.SYMM_MATCH_NMAX, tol=_DEF.SYMM_MATCH_TOL): """ [Get max proper order and reflection for an axis] .. todo:: Complete geom_parse_axis docstring """ # Imports import numpy as np # Store the max found rotation order of the geometry. ...
[ "[", "Get", "max", "proper", "order", "and", "reflection", "for", "an", "axis", "]" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L350-L370
[ "def", "geom_check_axis", "(", "g", ",", "atwts", ",", "ax", ",", "nmax", "=", "_DEF", ".", "SYMM_MATCH_NMAX", ",", "tol", "=", "_DEF", ".", "SYMM_MATCH_TOL", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Store the max found rotation order of the geom...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
geom_find_group
[Find all(?) proper rotation axes (n > 1) and reflection planes.] .. todo:: Complete geom_find_axes docstring INCLUDING NEW HEADER LINE DEPENDS on principal axes and moments being sorted such that: I_A <= I_B <= I_C Logic flow developed using: 1) http://symmetry.otterbein.edu/common/image...
opan/utils/symm.py
def geom_find_group(g, atwts, pr_ax, mom, tt, \ nmax=_DEF.SYMM_MATCH_NMAX, \ tol=_DEF.SYMM_MATCH_TOL, \ dig=_DEF.SYMM_ATWT_ROUND_DIGITS, avmax=_DEF.SYMM_AVG_MAX): """ [Find all(?) proper rotation axes (n > 1) and reflection planes.] .. todo:: Complete geom_find_axes docstring IN...
def geom_find_group(g, atwts, pr_ax, mom, tt, \ nmax=_DEF.SYMM_MATCH_NMAX, \ tol=_DEF.SYMM_MATCH_TOL, \ dig=_DEF.SYMM_ATWT_ROUND_DIGITS, avmax=_DEF.SYMM_AVG_MAX): """ [Find all(?) proper rotation axes (n > 1) and reflection planes.] .. todo:: Complete geom_find_axes docstring IN...
[ "[", "Find", "all", "(", "?", ")", "proper", "rotation", "axes", "(", "n", ">", "1", ")", "and", "reflection", "planes", ".", "]" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L375-L693
[ "def", "geom_find_group", "(", "g", ",", "atwts", ",", "pr_ax", ",", "mom", ",", "tt", ",", "nmax", "=", "_DEF", ".", "SYMM_MATCH_NMAX", ",", "tol", "=", "_DEF", ".", "SYMM_MATCH_TOL", ",", "dig", "=", "_DEF", ".", "SYMM_ATWT_ROUND_DIGITS", ",", "avmax",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
g_subset
Extract a subset of a geometry matching a desired atom. .. todo:: Complete g_subset docstring
opan/utils/symm.py
def g_subset(g, atwts, atwt, digits=_DEF.SYMM_ATWT_ROUND_DIGITS): """ Extract a subset of a geometry matching a desired atom. .. todo:: Complete g_subset docstring """ # Imports import numpy as np # Ensure g and atwts are n-D vectors g = make_nd_vec(g, nd=None, t=np.float64, ...
def g_subset(g, atwts, atwt, digits=_DEF.SYMM_ATWT_ROUND_DIGITS): """ Extract a subset of a geometry matching a desired atom. .. todo:: Complete g_subset docstring """ # Imports import numpy as np # Ensure g and atwts are n-D vectors g = make_nd_vec(g, nd=None, t=np.float64, ...
[ "Extract", "a", "subset", "of", "a", "geometry", "matching", "a", "desired", "atom", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L698-L734
[ "def", "g_subset", "(", "g", ",", "atwts", ",", "atwt", ",", "digits", "=", "_DEF", ".", "SYMM_ATWT_ROUND_DIGITS", ")", ":", "# Imports", "import", "numpy", "as", "np", "# Ensure g and atwts are n-D vectors", "g", "=", "make_nd_vec", "(", "g", ",", "nd", "="...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
make_nd_vec
Coerce input to np.array() and validate dimensionality. Ensure dimensionality 'n' if passed. Cast to type 't' if passed Normalize output if norm=True .. todo:: Complete make_nd_vec docstring
opan/utils/symm.py
def make_nd_vec(v, nd=None, t=None, norm=False): """ Coerce input to np.array() and validate dimensionality. Ensure dimensionality 'n' if passed. Cast to type 't' if passed Normalize output if norm=True .. todo:: Complete make_nd_vec docstring """ # Imports import numpy as np fro...
def make_nd_vec(v, nd=None, t=None, norm=False): """ Coerce input to np.array() and validate dimensionality. Ensure dimensionality 'n' if passed. Cast to type 't' if passed Normalize output if norm=True .. todo:: Complete make_nd_vec docstring """ # Imports import numpy as np fro...
[ "Coerce", "input", "to", "np", ".", "array", "()", "and", "validate", "dimensionality", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L739-L774
[ "def", "make_nd_vec", "(", "v", ",", "nd", "=", "None", ",", "t", "=", "None", ",", "norm", "=", "False", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "# Reduce the input to the extent possible", ...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
mtx_refl
Generate block-diagonal reflection matrix about nv. reps must be >=1 and indicates the number of times the reflection matrix should be repeated along the block diagonal. Typically this will be the number of atoms in a geometry. .. todo:: Complete mtx_refl docstring
opan/utils/symm.py
def mtx_refl(nv, reps=1): """ Generate block-diagonal reflection matrix about nv. reps must be >=1 and indicates the number of times the reflection matrix should be repeated along the block diagonal. Typically this will be the number of atoms in a geometry. .. todo:: Complete mtx_refl docstring ...
def mtx_refl(nv, reps=1): """ Generate block-diagonal reflection matrix about nv. reps must be >=1 and indicates the number of times the reflection matrix should be repeated along the block diagonal. Typically this will be the number of atoms in a geometry. .. todo:: Complete mtx_refl docstring ...
[ "Generate", "block", "-", "diagonal", "reflection", "matrix", "about", "nv", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L779-L832
[ "def", "mtx_refl", "(", "nv", ",", "reps", "=", "1", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", ".", "const", "import", "PRM", "# Ensure |nv| is large enough for confident directionality"...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
mtx_rot
Generate block-diagonal rotation matrix about ax. [copy handedness from somewhere] .. todo:: Complete mtx_rot docstring
opan/utils/symm.py
def mtx_rot(ax, theta, reps=1): """ Generate block-diagonal rotation matrix about ax. [copy handedness from somewhere] .. todo:: Complete mtx_rot docstring """ # Imports import numpy as np from scipy import linalg as spla from ..const import PRM # Ensure |ax| is large enough for...
def mtx_rot(ax, theta, reps=1): """ Generate block-diagonal rotation matrix about ax. [copy handedness from somewhere] .. todo:: Complete mtx_rot docstring """ # Imports import numpy as np from scipy import linalg as spla from ..const import PRM # Ensure |ax| is large enough for...
[ "Generate", "block", "-", "diagonal", "rotation", "matrix", "about", "ax", "." ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/utils/symm.py#L837-L896
[ "def", "mtx_rot", "(", "ax", ",", "theta", ",", "reps", "=", "1", ")", ":", "# Imports", "import", "numpy", "as", "np", "from", "scipy", "import", "linalg", "as", "spla", "from", ".", ".", "const", "import", "PRM", "# Ensure |ax| is large enough for confiden...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
ff
First-Fit This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. Complexity O(n^2)
mentor/binpack.py
def ff(items, targets): """First-Fit This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: for target, content in bins: if item...
def ff(items, targets): """First-Fit This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: for target, content in bins: if item...
[ "First", "-", "Fit" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/binpack.py#L22-L40
[ "def", "ff", "(", "items", ",", "targets", ")", ":", "bins", "=", "[", "(", "target", ",", "[", "]", ")", "for", "target", "in", "targets", "]", "skip", "=", "[", "]", "for", "item", "in", "items", ":", "for", "target", ",", "content", "in", "b...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
ffd
First-Fit Decreasing This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. This algorithm differs only from Next-Fit Decreasing in having a 'sort'; that is, the items are pre-sorted (largest to smallest). Complexity O(n^2)
mentor/binpack.py
def ffd(items, targets, **kwargs): """First-Fit Decreasing This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. This algorithm differs only from Next-Fit Decreasing in having a 'sort'; that is, the items are pre-sorted (largest to smallest). Com...
def ffd(items, targets, **kwargs): """First-Fit Decreasing This is perhaps the simplest packing heuristic; it simply packs items in the next available bin. This algorithm differs only from Next-Fit Decreasing in having a 'sort'; that is, the items are pre-sorted (largest to smallest). Com...
[ "First", "-", "Fit", "Decreasing" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/binpack.py#L43-L58
[ "def", "ffd", "(", "items", ",", "targets", ",", "*", "*", "kwargs", ")", ":", "sizes", "=", "zip", "(", "items", ",", "weight", "(", "items", ",", "*", "*", "kwargs", ")", ")", "sizes", "=", "sorted", "(", "sizes", ",", "key", "=", "operator", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
mr
Max-Rest Complexity O(n^2)
mentor/binpack.py
def mr(items, targets, **kwargs): """Max-Rest Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: capacities = [target - sum(content) for target, content in bins] weighted = weight(capacities, **kwargs) (target, content), capa...
def mr(items, targets, **kwargs): """Max-Rest Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: capacities = [target - sum(content) for target, content in bins] weighted = weight(capacities, **kwargs) (target, content), capa...
[ "Max", "-", "Rest" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/binpack.py#L61-L79
[ "def", "mr", "(", "items", ",", "targets", ",", "*", "*", "kwargs", ")", ":", "bins", "=", "[", "(", "target", ",", "[", "]", ")", "for", "target", "in", "targets", "]", "skip", "=", "[", "]", "for", "item", "in", "items", ":", "capacities", "=...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
bf
Best-Fit Complexity O(n^2)
mentor/binpack.py
def bf(items, targets, **kwargs): """Best-Fit Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: containers = [] capacities = [] for target, content in bins: capacity = target - sum(content) if item <= ...
def bf(items, targets, **kwargs): """Best-Fit Complexity O(n^2) """ bins = [(target, []) for target in targets] skip = [] for item in items: containers = [] capacities = [] for target, content in bins: capacity = target - sum(content) if item <= ...
[ "Best", "-", "Fit" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/binpack.py#L90-L113
[ "def", "bf", "(", "items", ",", "targets", ",", "*", "*", "kwargs", ")", ":", "bins", "=", "[", "(", "target", ",", "[", "]", ")", "for", "target", "in", "targets", "]", "skip", "=", "[", "]", "for", "item", "in", "items", ":", "containers", "=...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
bfd
Best-Fit Decreasing Complexity O(n^2)
mentor/binpack.py
def bfd(items, targets, **kwargs): """Best-Fit Decreasing Complexity O(n^2) """ sizes = zip(items, weight(items, **kwargs)) sizes = sorted(sizes, key=operator.itemgetter(1), reverse=True) items = map(operator.itemgetter(0), sizes) return bf(items, targets, **kwargs)
def bfd(items, targets, **kwargs): """Best-Fit Decreasing Complexity O(n^2) """ sizes = zip(items, weight(items, **kwargs)) sizes = sorted(sizes, key=operator.itemgetter(1), reverse=True) items = map(operator.itemgetter(0), sizes) return bf(items, targets, **kwargs)
[ "Best", "-", "Fit", "Decreasing" ]
daskos/mentor
python
https://github.com/daskos/mentor/blob/b5fd64e3a3192f5664fa5c03e8517cacb4e0590f/mentor/binpack.py#L116-L124
[ "def", "bfd", "(", "items", ",", "targets", ",", "*", "*", "kwargs", ")", ":", "sizes", "=", "zip", "(", "items", ",", "weight", "(", "items", ",", "*", "*", "kwargs", ")", ")", "sizes", "=", "sorted", "(", "sizes", ",", "key", "=", "operator", ...
b5fd64e3a3192f5664fa5c03e8517cacb4e0590f
train
trim_sequences
A VariantSequence and ReferenceContext may contain a different number of nucleotides before the variant locus. Furthermore, the VariantSequence is always expressed in terms of the positive strand against which it aligned, but reference transcripts may have sequences from the negative strand of the genom...
isovar/variant_sequence_in_reading_frame.py
def trim_sequences(variant_sequence, reference_context): """ A VariantSequence and ReferenceContext may contain a different number of nucleotides before the variant locus. Furthermore, the VariantSequence is always expressed in terms of the positive strand against which it aligned, but reference tra...
def trim_sequences(variant_sequence, reference_context): """ A VariantSequence and ReferenceContext may contain a different number of nucleotides before the variant locus. Furthermore, the VariantSequence is always expressed in terms of the positive strand against which it aligned, but reference tra...
[ "A", "VariantSequence", "and", "ReferenceContext", "may", "contain", "a", "different", "number", "of", "nucleotides", "before", "the", "variant", "locus", ".", "Furthermore", "the", "VariantSequence", "is", "always", "expressed", "in", "terms", "of", "the", "posit...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L140-L213
[ "def", "trim_sequences", "(", "variant_sequence", ",", "reference_context", ")", ":", "cdna_prefix", "=", "variant_sequence", ".", "prefix", "cdna_alt", "=", "variant_sequence", ".", "alt", "cdna_suffix", "=", "variant_sequence", ".", "suffix", "# if the transcript is o...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
count_mismatches_before_variant
Computes the number of mismatching nucleotides between two cDNA sequences before a variant locus. Parameters ---------- reference_prefix : str cDNA sequence of a reference transcript before a variant locus cdna_prefix : str cDNA sequence detected from RNAseq before a variant locus
isovar/variant_sequence_in_reading_frame.py
def count_mismatches_before_variant(reference_prefix, cdna_prefix): """ Computes the number of mismatching nucleotides between two cDNA sequences before a variant locus. Parameters ---------- reference_prefix : str cDNA sequence of a reference transcript before a variant locus cdna...
def count_mismatches_before_variant(reference_prefix, cdna_prefix): """ Computes the number of mismatching nucleotides between two cDNA sequences before a variant locus. Parameters ---------- reference_prefix : str cDNA sequence of a reference transcript before a variant locus cdna...
[ "Computes", "the", "number", "of", "mismatching", "nucleotides", "between", "two", "cDNA", "sequences", "before", "a", "variant", "locus", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L216-L233
[ "def", "count_mismatches_before_variant", "(", "reference_prefix", ",", "cdna_prefix", ")", ":", "if", "len", "(", "reference_prefix", ")", "!=", "len", "(", "cdna_prefix", ")", ":", "raise", "ValueError", "(", "\"Expected reference prefix '%s' to be same length as %s\"",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
count_mismatches_after_variant
Computes the number of mismatching nucleotides between two cDNA sequences after a variant locus. Parameters ---------- reference_suffix : str cDNA sequence of a reference transcript after a variant locus cdna_suffix : str cDNA sequence detected from RNAseq after a variant locus
isovar/variant_sequence_in_reading_frame.py
def count_mismatches_after_variant(reference_suffix, cdna_suffix): """ Computes the number of mismatching nucleotides between two cDNA sequences after a variant locus. Parameters ---------- reference_suffix : str cDNA sequence of a reference transcript after a variant locus cdna_suffix...
def count_mismatches_after_variant(reference_suffix, cdna_suffix): """ Computes the number of mismatching nucleotides between two cDNA sequences after a variant locus. Parameters ---------- reference_suffix : str cDNA sequence of a reference transcript after a variant locus cdna_suffix...
[ "Computes", "the", "number", "of", "mismatching", "nucleotides", "between", "two", "cDNA", "sequences", "after", "a", "variant", "locus", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L236-L253
[ "def", "count_mismatches_after_variant", "(", "reference_suffix", ",", "cdna_suffix", ")", ":", "len_diff", "=", "len", "(", "cdna_suffix", ")", "-", "len", "(", "reference_suffix", ")", "# if the reference is shorter than the read, the read runs into the intron - these count a...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
compute_offset_to_first_complete_codon
Once we've aligned the variant sequence to the ReferenceContext, we need to transfer reading frame from the reference transcripts to the variant sequences. Parameters ---------- offset_to_first_complete_reference_codon : int n_trimmed_from_reference_sequence : int Returns an offset into t...
isovar/variant_sequence_in_reading_frame.py
def compute_offset_to_first_complete_codon( offset_to_first_complete_reference_codon, n_trimmed_from_reference_sequence): """ Once we've aligned the variant sequence to the ReferenceContext, we need to transfer reading frame from the reference transcripts to the variant sequences. P...
def compute_offset_to_first_complete_codon( offset_to_first_complete_reference_codon, n_trimmed_from_reference_sequence): """ Once we've aligned the variant sequence to the ReferenceContext, we need to transfer reading frame from the reference transcripts to the variant sequences. P...
[ "Once", "we", "ve", "aligned", "the", "variant", "sequence", "to", "the", "ReferenceContext", "we", "need", "to", "transfer", "reading", "frame", "from", "the", "reference", "transcripts", "to", "the", "variant", "sequences", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L256-L282
[ "def", "compute_offset_to_first_complete_codon", "(", "offset_to_first_complete_reference_codon", ",", "n_trimmed_from_reference_sequence", ")", ":", "if", "n_trimmed_from_reference_sequence", "<=", "offset_to_first_complete_reference_codon", ":", "return", "(", "offset_to_first_comple...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
match_variant_sequence_to_reference_context
Iteratively trim low-coverage subsequences of a variant sequence until it either matches the given reference context or there are too few nucleotides left in the variant sequence. Parameters ---------- variant_sequence : VariantSequence Assembled sequence from RNA reads, will need to be to ...
isovar/variant_sequence_in_reading_frame.py
def match_variant_sequence_to_reference_context( variant_sequence, reference_context, min_transcript_prefix_length, max_transcript_mismatches, include_mismatches_after_variant=False, max_trimming_attempts=2): """ Iteratively trim low-coverage subsequences of a var...
def match_variant_sequence_to_reference_context( variant_sequence, reference_context, min_transcript_prefix_length, max_transcript_mismatches, include_mismatches_after_variant=False, max_trimming_attempts=2): """ Iteratively trim low-coverage subsequences of a var...
[ "Iteratively", "trim", "low", "-", "coverage", "subsequences", "of", "a", "variant", "sequence", "until", "it", "either", "matches", "the", "given", "reference", "context", "or", "there", "are", "too", "few", "nucleotides", "left", "in", "the", "variant", "seq...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L285-L392
[ "def", "match_variant_sequence_to_reference_context", "(", "variant_sequence", ",", "reference_context", ",", "min_transcript_prefix_length", ",", "max_transcript_mismatches", ",", "include_mismatches_after_variant", "=", "False", ",", "max_trimming_attempts", "=", "2", ")", ":...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
VariantSequenceInReadingFrame.from_variant_sequence_and_reference_context
Combines a VariantSequence with the reading frame implied by a ReferenceContext, reverse complementing if necessary and finding the offset to the first complete codon in the cDNA sequence. Parameters ---------- variant_sequence : VariantSequence reference_context : Refer...
isovar/variant_sequence_in_reading_frame.py
def from_variant_sequence_and_reference_context( cls, variant_sequence, reference_context): """ Combines a VariantSequence with the reading frame implied by a ReferenceContext, reverse complementing if necessary and finding the offset to the first complete codon in the cDNA s...
def from_variant_sequence_and_reference_context( cls, variant_sequence, reference_context): """ Combines a VariantSequence with the reading frame implied by a ReferenceContext, reverse complementing if necessary and finding the offset to the first complete codon in the cDNA s...
[ "Combines", "a", "VariantSequence", "with", "the", "reading", "frame", "implied", "by", "a", "ReferenceContext", "reverse", "complementing", "if", "necessary", "and", "finding", "the", "offset", "to", "the", "first", "complete", "codon", "in", "the", "cDNA", "se...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/variant_sequence_in_reading_frame.py#L85-L137
[ "def", "from_variant_sequence_and_reference_context", "(", "cls", ",", "variant_sequence", ",", "reference_context", ")", ":", "(", "cdna_prefix", ",", "cdna_alt", ",", "cdna_suffix", ",", "reference_prefix", ",", "reference_suffix", ",", "n_trimmed_from_reference", ")", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
translate_cdna
Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just ran out of codons). Parameters ---------- cdna_sequence : str cDNA sequence which is expected to st...
isovar/genetic_code.py
def translate_cdna( cdna_sequence, first_codon_is_start=False, mitochondrial=False): """ Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just...
def translate_cdna( cdna_sequence, first_codon_is_start=False, mitochondrial=False): """ Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just...
[ "Given", "a", "cDNA", "sequence", "which", "is", "aligned", "to", "a", "reading", "frame", "returns", "the", "translated", "protein", "sequence", "and", "a", "boolean", "flag", "indicating", "whether", "the", "translated", "sequence", "ended", "on", "a", "stop...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/genetic_code.py#L192-L221
[ "def", "translate_cdna", "(", "cdna_sequence", ",", "first_codon_is_start", "=", "False", ",", "mitochondrial", "=", "False", ")", ":", "# once we drop some of the prefix nucleotides, we should be in a reading frame", "# which allows us to translate this protein", "if", "mitochondr...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
GeneticCode._check_codons
If codon table is missing stop codons, then add them.
isovar/genetic_code.py
def _check_codons(self): """ If codon table is missing stop codons, then add them. """ for stop_codon in self.stop_codons: if stop_codon in self.codon_table: if self.codon_table[stop_codon] != "*": raise ValueError( ...
def _check_codons(self): """ If codon table is missing stop codons, then add them. """ for stop_codon in self.stop_codons: if stop_codon in self.codon_table: if self.codon_table[stop_codon] != "*": raise ValueError( ...
[ "If", "codon", "table", "is", "missing", "stop", "codons", "then", "add", "them", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/genetic_code.py#L26-L54
[ "def", "_check_codons", "(", "self", ")", ":", "for", "stop_codon", "in", "self", ".", "stop_codons", ":", "if", "stop_codon", "in", "self", ".", "codon_table", ":", "if", "self", ".", "codon_table", "[", "stop_codon", "]", "!=", "\"*\"", ":", "raise", "...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
GeneticCode.translate
Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just ran out of codons). Parameters ---------- cdna_sequence : str cDNA sequence...
isovar/genetic_code.py
def translate(self, cdna_sequence, first_codon_is_start=False): """ Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just ran out of codons). ...
def translate(self, cdna_sequence, first_codon_is_start=False): """ Given a cDNA sequence which is aligned to a reading frame, returns the translated protein sequence and a boolean flag indicating whether the translated sequence ended on a stop codon (or just ran out of codons). ...
[ "Given", "a", "cDNA", "sequence", "which", "is", "aligned", "to", "a", "reading", "frame", "returns", "the", "translated", "protein", "sequence", "and", "a", "boolean", "flag", "indicating", "whether", "the", "translated", "sequence", "ended", "on", "a", "stop...
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/genetic_code.py#L56-L98
[ "def", "translate", "(", "self", ",", "cdna_sequence", ",", "first_codon_is_start", "=", "False", ")", ":", "if", "not", "isinstance", "(", "cdna_sequence", ",", "str", ")", ":", "cdna_sequence", "=", "str", "(", "cdna_sequence", ")", "n", "=", "len", "(",...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
GeneticCode.copy
Make copy of this GeneticCode object with optional replacement values for all fields.
isovar/genetic_code.py
def copy( self, name, start_codons=None, stop_codons=None, codon_table=None, codon_table_changes=None): """ Make copy of this GeneticCode object with optional replacement values for all fields. """ new_start_...
def copy( self, name, start_codons=None, stop_codons=None, codon_table=None, codon_table_changes=None): """ Make copy of this GeneticCode object with optional replacement values for all fields. """ new_start_...
[ "Make", "copy", "of", "this", "GeneticCode", "object", "with", "optional", "replacement", "values", "for", "all", "fields", "." ]
openvax/isovar
python
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/genetic_code.py#L100-L133
[ "def", "copy", "(", "self", ",", "name", ",", "start_codons", "=", "None", ",", "stop_codons", "=", "None", ",", "codon_table", "=", "None", ",", "codon_table_changes", "=", "None", ")", ":", "new_start_codons", "=", "(", "self", ".", "start_codons", ".", ...
b39b684920e3f6b344851d6598a1a1c67bce913b
train
OrcaEngrad._load
Initialize :class:`OrcaEngrad` object from .engrad file Searches indicated file for energy, geometry, gradient, and number of atoms and stores in the corresponding instance variables. Parameters ---------- path |str| -- Complete path to the .engrad file to be read....
opan/grad.py
def _load(self, **kwargs): """ Initialize :class:`OrcaEngrad` object from .engrad file Searches indicated file for energy, geometry, gradient, and number of atoms and stores in the corresponding instance variables. Parameters ---------- path |str| -- Comple...
def _load(self, **kwargs): """ Initialize :class:`OrcaEngrad` object from .engrad file Searches indicated file for energy, geometry, gradient, and number of atoms and stores in the corresponding instance variables. Parameters ---------- path |str| -- Comple...
[ "Initialize", ":", "class", ":", "OrcaEngrad", "object", "from", ".", "engrad", "file" ]
bskinn/opan
python
https://github.com/bskinn/opan/blob/0b1b21662df6abc971407a9386db21a8796fbfe5/opan/grad.py#L440-L587
[ "def", "_load", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Imports", "from", ".", "const", "import", "CIC", ",", "atom_sym", ",", "atom_num", "from", ".", "error", "import", "GradError", "from", ".", "utils", "import", "safe_cast", "as", "scast",...
0b1b21662df6abc971407a9386db21a8796fbfe5
train
Listener.start
Start listening to changes
raildriver/events.py
def start(self): """ Start listening to changes """ self.running = True self.thread = threading.Thread(target=self._main_loop) self.thread.start()
def start(self): """ Start listening to changes """ self.running = True self.thread = threading.Thread(target=self._main_loop) self.thread.start()
[ "Start", "listening", "to", "changes" ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/events.py#L86-L92
[ "def", "start", "(", "self", ")", ":", "self", ".", "running", "=", "True", "self", ".", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_main_loop", ")", "self", ".", "thread", ".", "start", "(", ")" ]
c7f5f551e0436451b9507fc63a62e49a229282b9
train
Listener.subscribe
Subscribe to given fields. Special fields cannot be subscribed to and will be checked on every iteration. These include: * loco name * coordinates * fuel level * gradient * current heading * is in tunnel * time You can of course still receive no...
raildriver/events.py
def subscribe(self, field_names): """ Subscribe to given fields. Special fields cannot be subscribed to and will be checked on every iteration. These include: * loco name * coordinates * fuel level * gradient * current heading * is in tunnel ...
def subscribe(self, field_names): """ Subscribe to given fields. Special fields cannot be subscribed to and will be checked on every iteration. These include: * loco name * coordinates * fuel level * gradient * current heading * is in tunnel ...
[ "Subscribe", "to", "given", "fields", "." ]
centralniak/py-raildriver
python
https://github.com/centralniak/py-raildriver/blob/c7f5f551e0436451b9507fc63a62e49a229282b9/raildriver/events.py#L101-L127
[ "def", "subscribe", "(", "self", ",", "field_names", ")", ":", "available_controls", "=", "dict", "(", "self", ".", "raildriver", ".", "get_controller_list", "(", ")", ")", ".", "values", "(", ")", "for", "field", "in", "field_names", ":", "if", "field", ...
c7f5f551e0436451b9507fc63a62e49a229282b9
train
PatternGenerator.channels
Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel average (if multichannel); the successive elements are the individual chann...
imagen/patterngenerator.py
def channels(self, use_cached=False, **params_to_override): """ Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel ave...
def channels(self, use_cached=False, **params_to_override): """ Channels() adds a shared interface for single channel and multichannel structures. It will always return an ordered dict: its first element is the single channel of the pattern (if single-channel) or the channel ave...
[ "Channels", "()", "adds", "a", "shared", "interface", "for", "single", "channel", "and", "multichannel", "structures", ".", "It", "will", "always", "return", "an", "ordered", "dict", ":", "its", "first", "element", "is", "the", "single", "channel", "of", "th...
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L188-L197
[ "def", "channels", "(", "self", ",", "use_cached", "=", "False", ",", "*", "*", "params_to_override", ")", ":", "return", "collections", ".", "OrderedDict", "(", "{", "'default'", ":", "self", ".", "__call__", "(", "*", "*", "params_to_override", ")", "}",...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator._setup_xy
Produce pattern coordinate matrices from the bounds and density (or rows and cols), and transforms them according to x, y, and orientation.
imagen/patterngenerator.py
def _setup_xy(self,bounds,xdensity,ydensity,x,y,orientation): """ Produce pattern coordinate matrices from the bounds and density (or rows and cols), and transforms them according to x, y, and orientation. """ self.debug("bounds=%s, xdensity=%s, ydensity=%s, x=%s, y=%s, o...
def _setup_xy(self,bounds,xdensity,ydensity,x,y,orientation): """ Produce pattern coordinate matrices from the bounds and density (or rows and cols), and transforms them according to x, y, and orientation. """ self.debug("bounds=%s, xdensity=%s, ydensity=%s, x=%s, y=%s, o...
[ "Produce", "pattern", "coordinate", "matrices", "from", "the", "bounds", "and", "density", "(", "or", "rows", "and", "cols", ")", "and", "transforms", "them", "according", "to", "x", "y", "and", "orientation", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L213-L228
[ "def", "_setup_xy", "(", "self", ",", "bounds", ",", "xdensity", ",", "ydensity", ",", "x", ",", "y", ",", "orientation", ")", ":", "self", ".", "debug", "(", "\"bounds=%s, xdensity=%s, ydensity=%s, x=%s, y=%s, orientation=%s\"", ",", "bounds", ",", "xdensity", ...
53c5685c880f54b42795964d8db50b02e8590e88
train
PatternGenerator._create_and_rotate_coordinate_arrays
Create pattern matrices from x and y vectors, and rotate them to the specified orientation.
imagen/patterngenerator.py
def _create_and_rotate_coordinate_arrays(self, x, y, orientation): """ Create pattern matrices from x and y vectors, and rotate them to the specified orientation. """ # Using this two-liner requires that x increase from left to # right and y decrease from left to right; I...
def _create_and_rotate_coordinate_arrays(self, x, y, orientation): """ Create pattern matrices from x and y vectors, and rotate them to the specified orientation. """ # Using this two-liner requires that x increase from left to # right and y decrease from left to right; I...
[ "Create", "pattern", "matrices", "from", "x", "and", "y", "vectors", "and", "rotate", "them", "to", "the", "specified", "orientation", "." ]
pyviz/imagen
python
https://github.com/pyviz/imagen/blob/53c5685c880f54b42795964d8db50b02e8590e88/imagen/patterngenerator.py#L246-L257
[ "def", "_create_and_rotate_coordinate_arrays", "(", "self", ",", "x", ",", "y", ",", "orientation", ")", ":", "# Using this two-liner requires that x increase from left to", "# right and y decrease from left to right; I don't think it", "# can be rewritten in so little code otherwise - b...
53c5685c880f54b42795964d8db50b02e8590e88