partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Hiveplot.connect
Draw edges as Bézier curves. Start and end points map to the coordinates of the given nodes which in turn are set when adding nodes to an axis with the Axis.add_node() method, by using the placement information of the axis and a specified offset from its start point. Co...
pyveplot/__init__.py
def connect(self, axis0, n0_index, source_angle, axis1, n1_index, target_angle, **kwargs): """Draw edges as Bézier curves. Start and end points map to the coordinates of the given nodes which in turn are set when adding nodes to an axis with the Axis.add_node() method, by using the plac...
def connect(self, axis0, n0_index, source_angle, axis1, n1_index, target_angle, **kwargs): """Draw edges as Bézier curves. Start and end points map to the coordinates of the given nodes which in turn are set when adding nodes to an axis with the Axis.add_node() method, by using the plac...
[ "Draw", "edges", "as", "Bézier", "curves", "." ]
rgarcia-herrera/pyveplot
python
https://github.com/rgarcia-herrera/pyveplot/blob/57ceadcca47e79c94ee22efc9ba1e4962f462015/pyveplot/__init__.py#L74-L121
[ "def", "connect", "(", "self", ",", "axis0", ",", "n0_index", ",", "source_angle", ",", "axis1", ",", "n1_index", ",", "target_angle", ",", "*", "*", "kwargs", ")", ":", "n0", "=", "axis0", ".", "nodes", "[", "n0_index", "]", "n1", "=", "axis1", ".",...
57ceadcca47e79c94ee22efc9ba1e4962f462015
valid
Axis.add_node
Add a Node object to nodes dictionary, calculating its coordinates using offset Parameters ---------- node : a Node object offset : float number between 0 and 1 that sets the distance from the start point at which the node will be placed
pyveplot/__init__.py
def add_node(self, node, offset): """Add a Node object to nodes dictionary, calculating its coordinates using offset Parameters ---------- node : a Node object offset : float number between 0 and 1 that sets the distance from the start point ...
def add_node(self, node, offset): """Add a Node object to nodes dictionary, calculating its coordinates using offset Parameters ---------- node : a Node object offset : float number between 0 and 1 that sets the distance from the start point ...
[ "Add", "a", "Node", "object", "to", "nodes", "dictionary", "calculating", "its", "coordinates", "using", "offset" ]
rgarcia-herrera/pyveplot
python
https://github.com/rgarcia-herrera/pyveplot/blob/57ceadcca47e79c94ee22efc9ba1e4962f462015/pyveplot/__init__.py#L158-L174
[ "def", "add_node", "(", "self", ",", "node", ",", "offset", ")", ":", "# calculate x,y from offset considering axis start and end points", "width", "=", "self", ".", "end", "[", "0", "]", "-", "self", ".", "start", "[", "0", "]", "height", "=", "self", ".", ...
57ceadcca47e79c94ee22efc9ba1e4962f462015
valid
get_settings_path
Hunt down the settings.py module by going up the FS path
nosedjango/nosedjango.py
def get_settings_path(settings_module): ''' Hunt down the settings.py module by going up the FS path ''' cwd = os.getcwd() settings_filename = '%s.py' % ( settings_module.split('.')[-1] ) while cwd: if settings_filename in os.listdir(cwd): break cwd = os.p...
def get_settings_path(settings_module): ''' Hunt down the settings.py module by going up the FS path ''' cwd = os.getcwd() settings_filename = '%s.py' % ( settings_module.split('.')[-1] ) while cwd: if settings_filename in os.listdir(cwd): break cwd = os.p...
[ "Hunt", "down", "the", "settings", ".", "py", "module", "by", "going", "up", "the", "FS", "path" ]
nosedjango/nosedjango
python
https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L29-L45
[ "def", "get_settings_path", "(", "settings_module", ")", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "settings_filename", "=", "'%s.py'", "%", "(", "settings_module", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "while", "cwd", ":", "if"...
cd4d06857c88291769bc38e5c9573f43b7ffcd6a
valid
NoseDjango.begin
Create the test database and schema, if needed, and switch the connection over to that database. Then call install() to install all apps listed in the loaded settings module.
nosedjango/nosedjango.py
def begin(self): """ Create the test database and schema, if needed, and switch the connection over to that database. Then call install() to install all apps listed in the loaded settings module. """ for plugin in self.nose_config.plugins.plugins: if getattr(p...
def begin(self): """ Create the test database and schema, if needed, and switch the connection over to that database. Then call install() to install all apps listed in the loaded settings module. """ for plugin in self.nose_config.plugins.plugins: if getattr(p...
[ "Create", "the", "test", "database", "and", "schema", "if", "needed", "and", "switch", "the", "connection", "over", "to", "that", "database", ".", "Then", "call", "install", "()", "to", "install", "all", "apps", "listed", "in", "the", "loaded", "settings", ...
nosedjango/nosedjango
python
https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L232-L317
[ "def", "begin", "(", "self", ")", ":", "for", "plugin", "in", "self", ".", "nose_config", ".", "plugins", ".", "plugins", ":", "if", "getattr", "(", "plugin", ",", "'django_plugin'", ",", "False", ")", ":", "self", ".", "django_plugins", ".", "append", ...
cd4d06857c88291769bc38e5c9573f43b7ffcd6a
valid
NoseDjango._should_use_transaction_isolation
Determine if the given test supports transaction management for database rollback test isolation and also whether or not the test has opted out of that support. Transactions make database rollback much quicker when supported, with the caveat that any tests that are explicitly testing tr...
nosedjango/nosedjango.py
def _should_use_transaction_isolation(self, test, settings): """ Determine if the given test supports transaction management for database rollback test isolation and also whether or not the test has opted out of that support. Transactions make database rollback much quicker when...
def _should_use_transaction_isolation(self, test, settings): """ Determine if the given test supports transaction management for database rollback test isolation and also whether or not the test has opted out of that support. Transactions make database rollback much quicker when...
[ "Determine", "if", "the", "given", "test", "supports", "transaction", "management", "for", "database", "rollback", "test", "isolation", "and", "also", "whether", "or", "not", "the", "test", "has", "opted", "out", "of", "that", "support", "." ]
nosedjango/nosedjango
python
https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L319-L342
[ "def", "_should_use_transaction_isolation", "(", "self", ",", "test", ",", "settings", ")", ":", "if", "not", "getattr", "(", "test", ".", "context", ",", "'use_transaction_isolation'", ",", "True", ")", ":", "# The test explicitly says not to use transaction isolation"...
cd4d06857c88291769bc38e5c9573f43b7ffcd6a
valid
NoseDjango.finalize
Clean up any created database and schema.
nosedjango/nosedjango.py
def finalize(self, result=None): """ Clean up any created database and schema. """ if not self.settings_path: # short circuit if no settings file can be found return from django.test.utils import teardown_test_environment from django.db import con...
def finalize(self, result=None): """ Clean up any created database and schema. """ if not self.settings_path: # short circuit if no settings file can be found return from django.test.utils import teardown_test_environment from django.db import con...
[ "Clean", "up", "any", "created", "database", "and", "schema", "." ]
nosedjango/nosedjango
python
https://github.com/nosedjango/nosedjango/blob/cd4d06857c88291769bc38e5c9573f43b7ffcd6a/nosedjango/nosedjango.py#L508-L534
[ "def", "finalize", "(", "self", ",", "result", "=", "None", ")", ":", "if", "not", "self", ".", "settings_path", ":", "# short circuit if no settings file can be found", "return", "from", "django", ".", "test", ".", "utils", "import", "teardown_test_environment", ...
cd4d06857c88291769bc38e5c9573f43b7ffcd6a
valid
norm
Truncates field to 0,1; then normalizes to a uin8 on [0,255]
peri/viz/render.py
def norm(field, vmin=0, vmax=255): """Truncates field to 0,1; then normalizes to a uin8 on [0,255]""" field = 255*np.clip(field, 0, 1) field = field.astype('uint8') return field
def norm(field, vmin=0, vmax=255): """Truncates field to 0,1; then normalizes to a uin8 on [0,255]""" field = 255*np.clip(field, 0, 1) field = field.astype('uint8') return field
[ "Truncates", "field", "to", "0", "1", ";", "then", "normalizes", "to", "a", "uin8", "on", "[", "0", "255", "]" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/render.py#L12-L16
[ "def", "norm", "(", "field", ",", "vmin", "=", "0", ",", "vmax", "=", "255", ")", ":", "field", "=", "255", "*", "np", ".", "clip", "(", "field", ",", "0", ",", "1", ")", "field", "=", "field", ".", "astype", "(", "'uint8'", ")", "return", "f...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
extract_field
Given a state, extracts a field. Extracted value depends on the value of field: 'exp-particles' : The inverted data in the regions of the particles, zeros otherwise -- i.e. particles + noise. 'exp-platonic' : Same as above, but nonzero in the region of the entire pla...
peri/viz/render.py
def extract_field(state, field='exp-particles'): """ Given a state, extracts a field. Extracted value depends on the value of field: 'exp-particles' : The inverted data in the regions of the particles, zeros otherwise -- i.e. particles + noise. 'exp-platonic' : Same as above...
def extract_field(state, field='exp-particles'): """ Given a state, extracts a field. Extracted value depends on the value of field: 'exp-particles' : The inverted data in the regions of the particles, zeros otherwise -- i.e. particles + noise. 'exp-platonic' : Same as above...
[ "Given", "a", "state", "extracts", "a", "field", ".", "Extracted", "value", "depends", "on", "the", "value", "of", "field", ":", "exp", "-", "particles", ":", "The", "inverted", "data", "in", "the", "regions", "of", "the", "particles", "zeros", "otherwise"...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/render.py#L24-L57
[ "def", "extract_field", "(", "state", ",", "field", "=", "'exp-particles'", ")", ":", "es", ",", "pp", "=", "field", ".", "split", "(", "'-'", ")", "#exp vs sim, particles vs platonic", "#1. The weights for the field, based off the platonic vs particles", "if", "pp", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
volume_render
Uses vtk to make render an image of a field, with control over the camera angle and colormap. Input Parameters ---------------- field : np.ndarray 3D array of the field to render. outfile : string The save name of the image. maxopacity : Float Def...
peri/viz/render.py
def volume_render(field, outfile, maxopacity=1.0, cmap='bone', size=600, elevation=45, azimuth=45, bkg=(0.0, 0.0, 0.0), opacitycut=0.35, offscreen=False, rayfunction='smart'): """ Uses vtk to make render an image of a field, with control over the camera angle and colormap. Input Paramet...
def volume_render(field, outfile, maxopacity=1.0, cmap='bone', size=600, elevation=45, azimuth=45, bkg=(0.0, 0.0, 0.0), opacitycut=0.35, offscreen=False, rayfunction='smart'): """ Uses vtk to make render an image of a field, with control over the camera angle and colormap. Input Paramet...
[ "Uses", "vtk", "to", "make", "render", "an", "image", "of", "a", "field", "with", "control", "over", "the", "camera", "angle", "and", "colormap", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/render.py#L68-L192
[ "def", "volume_render", "(", "field", ",", "outfile", ",", "maxopacity", "=", "1.0", ",", "cmap", "=", "'bone'", ",", "size", "=", "600", ",", "elevation", "=", "45", ",", "azimuth", "=", "45", ",", "bkg", "=", "(", "0.0", ",", "0.0", ",", "0.0", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
make_clean_figure
Makes a `matplotlib.pyplot.Figure` without tooltips or keybindings Parameters ---------- figsize : tuple Figsize as passed to `matplotlib.pyplot.figure` remove_tooltips, remove_keybindings : bool Set to True to remove the tooltips bar or any key bindings, respectively. Default i...
peri/viz/interaction.py
def make_clean_figure(figsize, remove_tooltips=False, remove_keybindings=False): """ Makes a `matplotlib.pyplot.Figure` without tooltips or keybindings Parameters ---------- figsize : tuple Figsize as passed to `matplotlib.pyplot.figure` remove_tooltips, remove_keybindings : bool ...
def make_clean_figure(figsize, remove_tooltips=False, remove_keybindings=False): """ Makes a `matplotlib.pyplot.Figure` without tooltips or keybindings Parameters ---------- figsize : tuple Figsize as passed to `matplotlib.pyplot.figure` remove_tooltips, remove_keybindings : bool ...
[ "Makes", "a", "matplotlib", ".", "pyplot", ".", "Figure", "without", "tooltips", "or", "keybindings" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/interaction.py#L14-L37
[ "def", "make_clean_figure", "(", "figsize", ",", "remove_tooltips", "=", "False", ",", "remove_keybindings", "=", "False", ")", ":", "tooltip", "=", "mpl", ".", "rcParams", "[", "'toolbar'", "]", "if", "remove_tooltips", ":", "mpl", ".", "rcParams", "[", "'t...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
OrthoPrefeature._particle_func
Draws a gaussian, range is (0,1]. Coords = [3,n]
peri/viz/interaction.py
def _particle_func(self, coords, pos, wid): """Draws a gaussian, range is (0,1]. Coords = [3,n]""" dx, dy, dz = [c - p for c,p in zip(coords, pos)] dr2 = dx*dx + dy*dy + dz*dz return np.exp(-dr2/(2*wid*wid))
def _particle_func(self, coords, pos, wid): """Draws a gaussian, range is (0,1]. Coords = [3,n]""" dx, dy, dz = [c - p for c,p in zip(coords, pos)] dr2 = dx*dx + dy*dy + dz*dz return np.exp(-dr2/(2*wid*wid))
[ "Draws", "a", "gaussian", "range", "is", "(", "0", "1", "]", ".", "Coords", "=", "[", "3", "n", "]" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/interaction.py#L634-L638
[ "def", "_particle_func", "(", "self", ",", "coords", ",", "pos", ",", "wid", ")", ":", "dx", ",", "dy", ",", "dz", "=", "[", "c", "-", "p", "for", "c", ",", "p", "in", "zip", "(", "coords", ",", "pos", ")", "]", "dr2", "=", "dx", "*", "dx",...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
OrthoPrefeature.update_field
updates self.field
peri/viz/interaction.py
def update_field(self, poses=None): """updates self.field""" m = np.clip(self.particle_field, 0, 1) part_color = np.zeros(self._image.shape) for a in range(4): part_color[:,:,:,a] = self.part_col[a] self.field = np.zeros(self._image.shape) for a in range(4): s...
def update_field(self, poses=None): """updates self.field""" m = np.clip(self.particle_field, 0, 1) part_color = np.zeros(self._image.shape) for a in range(4): part_color[:,:,:,a] = self.part_col[a] self.field = np.zeros(self._image.shape) for a in range(4): s...
[ "updates", "self", ".", "field" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/interaction.py#L656-L663
[ "def", "update_field", "(", "self", ",", "poses", "=", "None", ")", ":", "m", "=", "np", ".", "clip", "(", "self", ".", "particle_field", ",", "0", ",", "1", ")", "part_color", "=", "np", ".", "zeros", "(", "self", ".", "_image", ".", "shape", ")...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
OrthoPrefeature._remove_closest_particle
removes the closest particle in self.pos to ``p``
peri/viz/interaction.py
def _remove_closest_particle(self, p): """removes the closest particle in self.pos to ``p``""" #1. find closest pos: dp = self.pos - p dist2 = (dp*dp).sum(axis=1) ind = dist2.argmin() rp = self.pos[ind].copy() #2. delete self.pos = np.delete(self.pos, ind,...
def _remove_closest_particle(self, p): """removes the closest particle in self.pos to ``p``""" #1. find closest pos: dp = self.pos - p dist2 = (dp*dp).sum(axis=1) ind = dist2.argmin() rp = self.pos[ind].copy() #2. delete self.pos = np.delete(self.pos, ind,...
[ "removes", "the", "closest", "particle", "in", "self", ".", "pos", "to", "p" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/viz/interaction.py#L778-L787
[ "def", "_remove_closest_particle", "(", "self", ",", "p", ")", ":", "#1. find closest pos:", "dp", "=", "self", ".", "pos", "-", "p", "dist2", "=", "(", "dp", "*", "dp", ")", ".", "sum", "(", "axis", "=", "1", ")", "ind", "=", "dist2", ".", "argmin...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
diffusion
See `diffusion_correlated` for information related to units, etc
scripts/does_matter/brownian-motion.py
def diffusion(diffusion_constant=0.2, exposure_time=0.05, samples=200): """ See `diffusion_correlated` for information related to units, etc """ radius = 5 psfsize = np.array([2.0, 1.0, 3.0]) # create a base image of one particle s0 = init.create_single_particle_state(imsize=4*radius, ...
def diffusion(diffusion_constant=0.2, exposure_time=0.05, samples=200): """ See `diffusion_correlated` for information related to units, etc """ radius = 5 psfsize = np.array([2.0, 1.0, 3.0]) # create a base image of one particle s0 = init.create_single_particle_state(imsize=4*radius, ...
[ "See", "diffusion_correlated", "for", "information", "related", "to", "units", "etc" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/brownian-motion.py#L11-L43
[ "def", "diffusion", "(", "diffusion_constant", "=", "0.2", ",", "exposure_time", "=", "0.05", ",", "samples", "=", "200", ")", ":", "radius", "=", "5", "psfsize", "=", "np", ".", "array", "(", "[", "2.0", ",", "1.0", ",", "3.0", "]", ")", "# create a...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
diffusion_correlated
Calculate the (perhaps) correlated diffusion effect between particles during the exposure time of the confocal microscope. diffusion_constant is in terms of seconds and pixel sizes exposure_time is in seconds 1 micron radius particle: D = kT / (6 a\pi\eta) for 80/20 g/w (60 mPas), 3600 nm^2...
scripts/does_matter/brownian-motion.py
def diffusion_correlated(diffusion_constant=0.2, exposure_time=0.05, samples=40, phi=0.25): """ Calculate the (perhaps) correlated diffusion effect between particles during the exposure time of the confocal microscope. diffusion_constant is in terms of seconds and pixel sizes exposure_time is in...
def diffusion_correlated(diffusion_constant=0.2, exposure_time=0.05, samples=40, phi=0.25): """ Calculate the (perhaps) correlated diffusion effect between particles during the exposure time of the confocal microscope. diffusion_constant is in terms of seconds and pixel sizes exposure_time is in...
[ "Calculate", "the", "(", "perhaps", ")", "correlated", "diffusion", "effect", "between", "particles", "during", "the", "exposure", "time", "of", "the", "confocal", "microscope", ".", "diffusion_constant", "is", "in", "terms", "of", "seconds", "and", "pixel", "si...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/brownian-motion.py#L45-L105
[ "def", "diffusion_correlated", "(", "diffusion_constant", "=", "0.2", ",", "exposure_time", "=", "0.05", ",", "samples", "=", "40", ",", "phi", "=", "0.25", ")", ":", "radius", "=", "5", "psfsize", "=", "np", ".", "array", "(", "[", "2.0", ",", "1.0", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
dorun
we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8)
scripts/does_matter/brownian-motion.py
def dorun(SNR=20, ntimes=20, samples=10, noise_samples=10, sweeps=20, burn=10, correlated=False): """ we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8) """ if n...
def dorun(SNR=20, ntimes=20, samples=10, noise_samples=10, sweeps=20, burn=10, correlated=False): """ we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8) """ if n...
[ "we", "want", "to", "display", "the", "errors", "introduced", "by", "pixelation", "so", "we", "plot", ":", "*", "CRB", "sampled", "error", "vs", "exposure", "time" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/brownian-motion.py#L107-L150
[ "def", "dorun", "(", "SNR", "=", "20", ",", "ntimes", "=", "20", ",", "samples", "=", "10", ",", "noise_samples", "=", "10", ",", "sweeps", "=", "20", ",", "burn", "=", "10", ",", "correlated", "=", "False", ")", ":", "if", "not", "correlated", "...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
feature_guess
Makes a guess at particle positions using heuristic centroid methods. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. rad : Float The feature size for featuring. invert : {'guess', True, False}, optional Whether to invert the ima...
peri/opt/addsubtract.py
def feature_guess(st, rad, invert='guess', minmass=None, use_tp=False, trim_edge=False, **kwargs): """ Makes a guess at particle positions using heuristic centroid methods. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. ra...
def feature_guess(st, rad, invert='guess', minmass=None, use_tp=False, trim_edge=False, **kwargs): """ Makes a guess at particle positions using heuristic centroid methods. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. ra...
[ "Makes", "a", "guess", "at", "particle", "positions", "using", "heuristic", "centroid", "methods", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L14-L56
[ "def", "feature_guess", "(", "st", ",", "rad", ",", "invert", "=", "'guess'", ",", "minmass", "=", "None", ",", "use_tp", "=", "False", ",", "trim_edge", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# FIXME does not use the **kwargs, but needs b/c called ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
_feature_guess
Workhorse of feature_guess
peri/opt/addsubtract.py
def _feature_guess(im, rad, minmass=None, use_tp=False, trim_edge=False): """Workhorse of feature_guess""" if minmass is None: # we use 1% of the feature size mass as a cutoff; # it's easier to remove than to add minmass = rad**3 * 4/3.*np.pi * 0.01 # 0.03 is a magic number; work...
def _feature_guess(im, rad, minmass=None, use_tp=False, trim_edge=False): """Workhorse of feature_guess""" if minmass is None: # we use 1% of the feature size mass as a cutoff; # it's easier to remove than to add minmass = rad**3 * 4/3.*np.pi * 0.01 # 0.03 is a magic number; work...
[ "Workhorse", "of", "feature_guess" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L59-L82
[ "def", "_feature_guess", "(", "im", ",", "rad", ",", "minmass", "=", "None", ",", "use_tp", "=", "False", ",", "trim_edge", "=", "False", ")", ":", "if", "minmass", "is", "None", ":", "# we use 1% of the feature size mass as a cutoff;", "# it's easier to remove th...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
check_add_particles
Checks whether to add particles at a given position by seeing if adding the particle improves the fit of the state. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. guess : [N,3] list-like The positions of particles to check to add. r...
peri/opt/addsubtract.py
def check_add_particles(st, guess, rad='calc', do_opt=True, im_change_frac=0.2, min_derr='3sig', **kwargs): """ Checks whether to add particles at a given position by seeing if adding the particle improves the fit of the state. Parameters ---------- st : :class:`peri.sta...
def check_add_particles(st, guess, rad='calc', do_opt=True, im_change_frac=0.2, min_derr='3sig', **kwargs): """ Checks whether to add particles at a given position by seeing if adding the particle improves the fit of the state. Parameters ---------- st : :class:`peri.sta...
[ "Checks", "whether", "to", "add", "particles", "at", "a", "given", "position", "by", "seeing", "if", "adding", "the", "particle", "improves", "the", "fit", "of", "the", "state", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L85-L159
[ "def", "check_add_particles", "(", "st", ",", "guess", ",", "rad", "=", "'calc'", ",", "do_opt", "=", "True", ",", "im_change_frac", "=", "0.2", ",", "min_derr", "=", "'3sig'", ",", "*", "*", "kwargs", ")", ":", "# FIXME does not use the **kwargs, but needs b/...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
check_remove_particle
Checks whether to remove particle 'ind' from state 'st'. If removing the particle increases the error by less than max( min_derr, change in image * im_change_frac), then the particle is removed. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. ...
peri/opt/addsubtract.py
def check_remove_particle(st, ind, im_change_frac=0.2, min_derr='3sig', **kwargs): """ Checks whether to remove particle 'ind' from state 'st'. If removing the particle increases the error by less than max( min_derr, change in image * im_change_frac), then the particle is remov...
def check_remove_particle(st, ind, im_change_frac=0.2, min_derr='3sig', **kwargs): """ Checks whether to remove particle 'ind' from state 'st'. If removing the particle increases the error by less than max( min_derr, change in image * im_change_frac), then the particle is remov...
[ "Checks", "whether", "to", "remove", "particle", "ind", "from", "state", "st", ".", "If", "removing", "the", "particle", "increases", "the", "error", "by", "less", "than", "max", "(", "min_derr", "change", "in", "image", "*", "im_change_frac", ")", "then", ...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L162-L210
[ "def", "check_remove_particle", "(", "st", ",", "ind", ",", "im_change_frac", "=", "0.2", ",", "min_derr", "=", "'3sig'", ",", "*", "*", "kwargs", ")", ":", "# FIXME does not use the **kwargs, but needs b/c called with wrong kwargs", "if", "min_derr", "==", "'3sig'", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
should_particle_exist
Checks whether or not adding a particle should be present. Parameters ---------- absent_err : Float The state error without the particle. present_err : Float The state error with the particle. absent_d : numpy.ndarray The state residuals without the particle. present_d :...
peri/opt/addsubtract.py
def should_particle_exist(absent_err, present_err, absent_d, present_d, im_change_frac=0.2, min_derr=0.1): """ Checks whether or not adding a particle should be present. Parameters ---------- absent_err : Float The state error without the particle. present_err ...
def should_particle_exist(absent_err, present_err, absent_d, present_d, im_change_frac=0.2, min_derr=0.1): """ Checks whether or not adding a particle should be present. Parameters ---------- absent_err : Float The state error without the particle. present_err ...
[ "Checks", "whether", "or", "not", "adding", "a", "particle", "should", "be", "present", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L213-L243
[ "def", "should_particle_exist", "(", "absent_err", ",", "present_err", ",", "absent_d", ",", "present_d", ",", "im_change_frac", "=", "0.2", ",", "min_derr", "=", "0.1", ")", ":", "delta_im", "=", "np", ".", "ravel", "(", "present_d", "-", "absent_d", ")", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
add_missing_particles
Attempts to add missing particles to the state. Operates by: (1) featuring the difference image using feature_guess, (2) attempting to add the featured positions using check_add_particles. Parameters ---------- st : :class:`peri.states.State` The state to check adding particles to. ...
peri/opt/addsubtract.py
def add_missing_particles(st, rad='calc', tries=50, **kwargs): """ Attempts to add missing particles to the state. Operates by: (1) featuring the difference image using feature_guess, (2) attempting to add the featured positions using check_add_particles. Parameters ---------- st : :cl...
def add_missing_particles(st, rad='calc', tries=50, **kwargs): """ Attempts to add missing particles to the state. Operates by: (1) featuring the difference image using feature_guess, (2) attempting to add the featured positions using check_add_particles. Parameters ---------- st : :cl...
[ "Attempts", "to", "add", "missing", "particles", "to", "the", "state", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L246-L306
[ "def", "add_missing_particles", "(", "st", ",", "rad", "=", "'calc'", ",", "tries", "=", "50", ",", "*", "*", "kwargs", ")", ":", "if", "rad", "==", "'calc'", ":", "rad", "=", "guess_add_radii", "(", "st", ")", "guess", ",", "npart", "=", "feature_gu...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
remove_bad_particles
Removes improperly-featured particles from the state, based on a combination of particle size and the change in error on removal. Parameters ----------- st : :class:`peri.states.State` The state to remove bad particles from. min_rad : Float, optional All particles with radius below ...
peri/opt/addsubtract.py
def remove_bad_particles(st, min_rad='calc', max_rad='calc', min_edge_dist=2.0, check_rad_cutoff=[3.5, 15], check_outside_im=True, tries=50, im_change_frac=0.2, **kwargs): """ Removes improperly-featured particles from the state, based on a combination of pa...
def remove_bad_particles(st, min_rad='calc', max_rad='calc', min_edge_dist=2.0, check_rad_cutoff=[3.5, 15], check_outside_im=True, tries=50, im_change_frac=0.2, **kwargs): """ Removes improperly-featured particles from the state, based on a combination of pa...
[ "Removes", "improperly", "-", "featured", "particles", "from", "the", "state", "based", "on", "a", "combination", "of", "particle", "size", "and", "the", "change", "in", "error", "on", "removal", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L309-L425
[ "def", "remove_bad_particles", "(", "st", ",", "min_rad", "=", "'calc'", ",", "max_rad", "=", "'calc'", ",", "min_edge_dist", "=", "2.0", ",", "check_rad_cutoff", "=", "[", "3.5", ",", "15", "]", ",", "check_outside_im", "=", "True", ",", "tries", "=", "...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
add_subtract
Automatically adds and subtracts missing & extra particles. Operates by removing bad particles then adding missing particles on repeat, until either no particles are added/removed or after `max_iter` attempts. Parameters ---------- st: :class:`peri.states.State` The state to add and su...
peri/opt/addsubtract.py
def add_subtract(st, max_iter=7, max_npart='calc', max_mem=2e8, always_check_remove=False, **kwargs): """ Automatically adds and subtracts missing & extra particles. Operates by removing bad particles then adding missing particles on repeat, until either no particles are added/removed ...
def add_subtract(st, max_iter=7, max_npart='calc', max_mem=2e8, always_check_remove=False, **kwargs): """ Automatically adds and subtracts missing & extra particles. Operates by removing bad particles then adding missing particles on repeat, until either no particles are added/removed ...
[ "Automatically", "adds", "and", "subtracts", "missing", "&", "extra", "particles", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L428-L569
[ "def", "add_subtract", "(", "st", ",", "max_iter", "=", "7", ",", "max_npart", "=", "'calc'", ",", "max_mem", "=", "2e8", ",", "always_check_remove", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "max_npart", "==", "'calc'", ":", "max_npart", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
identify_misfeatured_regions
Identifies regions of missing/misfeatured particles based on the residuals' local deviation from uniform Gaussian noise. Parameters ---------- st : :class:`peri.states.State` The state in which to identify mis-featured regions. filter_size : Int, best if odd. The size of the filter...
peri/opt/addsubtract.py
def identify_misfeatured_regions(st, filter_size=5, sigma_cutoff=8.): """ Identifies regions of missing/misfeatured particles based on the residuals' local deviation from uniform Gaussian noise. Parameters ---------- st : :class:`peri.states.State` The state in which to identify mis-fea...
def identify_misfeatured_regions(st, filter_size=5, sigma_cutoff=8.): """ Identifies regions of missing/misfeatured particles based on the residuals' local deviation from uniform Gaussian noise. Parameters ---------- st : :class:`peri.states.State` The state in which to identify mis-fea...
[ "Identifies", "regions", "of", "missing", "/", "misfeatured", "particles", "based", "on", "the", "residuals", "local", "deviation", "from", "uniform", "Gaussian", "noise", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L572-L647
[ "def", "identify_misfeatured_regions", "(", "st", ",", "filter_size", "=", "5", ",", "sigma_cutoff", "=", "8.", ")", ":", "# 1. Field of local std", "r", "=", "st", ".", "residuals", "weights", "=", "np", ".", "ones", "(", "[", "filter_size", "]", "*", "le...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
add_subtract_misfeatured_tile
Automatically adds and subtracts missing & extra particles in a region of poor fit. Parameters ---------- st: :class:`peri.states.State` The state to add and subtract particles to. tile : :class:`peri.util.Tile` The poorly-fit region to examine. rad : Float or 'calc', optional ...
peri/opt/addsubtract.py
def add_subtract_misfeatured_tile( st, tile, rad='calc', max_iter=3, invert='guess', max_allowed_remove=20, minmass=None, use_tp=False, **kwargs): """ Automatically adds and subtracts missing & extra particles in a region of poor fit. Parameters ---------- st: :class:`peri.state...
def add_subtract_misfeatured_tile( st, tile, rad='calc', max_iter=3, invert='guess', max_allowed_remove=20, minmass=None, use_tp=False, **kwargs): """ Automatically adds and subtracts missing & extra particles in a region of poor fit. Parameters ---------- st: :class:`peri.state...
[ "Automatically", "adds", "and", "subtracts", "missing", "&", "extra", "particles", "in", "a", "region", "of", "poor", "fit", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L650-L786
[ "def", "add_subtract_misfeatured_tile", "(", "st", ",", "tile", ",", "rad", "=", "'calc'", ",", "max_iter", "=", "3", ",", "invert", "=", "'guess'", ",", "max_allowed_remove", "=", "20", ",", "minmass", "=", "None", ",", "use_tp", "=", "False", ",", "*",...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
add_subtract_locally
Automatically adds and subtracts missing particles based on local regions of poor fit. Calls identify_misfeatured_regions to identify regions, then add_subtract_misfeatured_tile on the tiles in order of size until region_depth tiles have been checked without adding any particles. Parameters --...
peri/opt/addsubtract.py
def add_subtract_locally(st, region_depth=3, filter_size=5, sigma_cutoff=8, **kwargs): """ Automatically adds and subtracts missing particles based on local regions of poor fit. Calls identify_misfeatured_regions to identify regions, then add_subtract_misfeatured_tile on th...
def add_subtract_locally(st, region_depth=3, filter_size=5, sigma_cutoff=8, **kwargs): """ Automatically adds and subtracts missing particles based on local regions of poor fit. Calls identify_misfeatured_regions to identify regions, then add_subtract_misfeatured_tile on th...
[ "Automatically", "adds", "and", "subtracts", "missing", "particles", "based", "on", "local", "regions", "of", "poor", "fit", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L789-L914
[ "def", "add_subtract_locally", "(", "st", ",", "region_depth", "=", "3", ",", "filter_size", "=", "5", ",", "sigma_cutoff", "=", "8", ",", "*", "*", "kwargs", ")", ":", "# 1. Find regions of poor tiles:", "tiles", "=", "identify_misfeatured_regions", "(", "st", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
guess_invert
Guesses whether particles are bright on a dark bkg or vice-versa Works by checking whether the intensity at the particle centers is brighter or darker than the average intensity of the image, by comparing the median intensities of each. Parameters ---------- st : :class:`peri.states.ImageState...
peri/opt/addsubtract.py
def guess_invert(st): """Guesses whether particles are bright on a dark bkg or vice-versa Works by checking whether the intensity at the particle centers is brighter or darker than the average intensity of the image, by comparing the median intensities of each. Parameters ---------- st : :...
def guess_invert(st): """Guesses whether particles are bright on a dark bkg or vice-versa Works by checking whether the intensity at the particle centers is brighter or darker than the average intensity of the image, by comparing the median intensities of each. Parameters ---------- st : :...
[ "Guesses", "whether", "particles", "are", "bright", "on", "a", "dark", "bkg", "or", "vice", "-", "versa" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/addsubtract.py#L917-L939
[ "def", "guess_invert", "(", "st", ")", ":", "pos", "=", "st", ".", "obj_get_positions", "(", ")", "pxinds_ar", "=", "np", ".", "round", "(", "pos", ")", ".", "astype", "(", "'int'", ")", "inim", "=", "st", ".", "ishape", ".", "translate", "(", "-",...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
load_wisdom
Prime FFTW with knowledge of which FFTs are best on this machine by loading 'wisdom' from the file ``wisdomfile``
peri/fft.py
def load_wisdom(wisdomfile): """ Prime FFTW with knowledge of which FFTs are best on this machine by loading 'wisdom' from the file ``wisdomfile`` """ if wisdomfile is None: return try: pyfftw.import_wisdom(pickle.load(open(wisdomfile, 'rb'))) except (IOError, TypeError) as ...
def load_wisdom(wisdomfile): """ Prime FFTW with knowledge of which FFTs are best on this machine by loading 'wisdom' from the file ``wisdomfile`` """ if wisdomfile is None: return try: pyfftw.import_wisdom(pickle.load(open(wisdomfile, 'rb'))) except (IOError, TypeError) as ...
[ "Prime", "FFTW", "with", "knowledge", "of", "which", "FFTs", "are", "best", "on", "this", "machine", "by", "loading", "wisdom", "from", "the", "file", "wisdomfile" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/fft.py#L48-L60
[ "def", "load_wisdom", "(", "wisdomfile", ")", ":", "if", "wisdomfile", "is", "None", ":", "return", "try", ":", "pyfftw", ".", "import_wisdom", "(", "pickle", ".", "load", "(", "open", "(", "wisdomfile", ",", "'rb'", ")", ")", ")", "except", "(", "IOEr...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
save_wisdom
Save the acquired 'wisdom' generated by FFTW to file so that future initializations of FFTW will be faster.
peri/fft.py
def save_wisdom(wisdomfile): """ Save the acquired 'wisdom' generated by FFTW to file so that future initializations of FFTW will be faster. """ if wisdomfile is None: return if wisdomfile: pickle.dump( pyfftw.export_wisdom(), open(wisdomfile, 'wb'), prot...
def save_wisdom(wisdomfile): """ Save the acquired 'wisdom' generated by FFTW to file so that future initializations of FFTW will be faster. """ if wisdomfile is None: return if wisdomfile: pickle.dump( pyfftw.export_wisdom(), open(wisdomfile, 'wb'), prot...
[ "Save", "the", "acquired", "wisdom", "generated", "by", "FFTW", "to", "file", "so", "that", "future", "initializations", "of", "FFTW", "will", "be", "faster", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/fft.py#L62-L74
[ "def", "save_wisdom", "(", "wisdomfile", ")", ":", "if", "wisdomfile", "is", "None", ":", "return", "if", "wisdomfile", ":", "pickle", ".", "dump", "(", "pyfftw", ".", "export_wisdom", "(", ")", ",", "open", "(", "wisdomfile", ",", "'wb'", ")", ",", "p...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
tile_overlap
How much of inner is in outer by volume
peri/opt/tiling.py
def tile_overlap(inner, outer, norm=False): """ How much of inner is in outer by volume """ div = 1.0/inner.volume if norm else 1.0 return div*(inner.volume - util.Tile.intersection(inner, outer).volume)
def tile_overlap(inner, outer, norm=False): """ How much of inner is in outer by volume """ div = 1.0/inner.volume if norm else 1.0 return div*(inner.volume - util.Tile.intersection(inner, outer).volume)
[ "How", "much", "of", "inner", "is", "in", "outer", "by", "volume" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/tiling.py#L23-L26
[ "def", "tile_overlap", "(", "inner", ",", "outer", ",", "norm", "=", "False", ")", ":", "div", "=", "1.0", "/", "inner", ".", "volume", "if", "norm", "else", "1.0", "return", "div", "*", "(", "inner", ".", "volume", "-", "util", ".", "Tile", ".", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
closest_uniform_tile
Given a tiling of space (by state, shift, and size), find the closest tile to another external tile
peri/opt/tiling.py
def closest_uniform_tile(s, shift, size, other): """ Given a tiling of space (by state, shift, and size), find the closest tile to another external tile """ region = util.Tile(size, dim=s.dim, dtype='float').translate(shift - s.pad) vec = np.round((other.center - region.center) / region.shape) ...
def closest_uniform_tile(s, shift, size, other): """ Given a tiling of space (by state, shift, and size), find the closest tile to another external tile """ region = util.Tile(size, dim=s.dim, dtype='float').translate(shift - s.pad) vec = np.round((other.center - region.center) / region.shape) ...
[ "Given", "a", "tiling", "of", "space", "(", "by", "state", "shift", "and", "size", ")", "find", "the", "closest", "tile", "to", "another", "external", "tile" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/tiling.py#L45-L52
[ "def", "closest_uniform_tile", "(", "s", ",", "shift", ",", "size", ",", "other", ")", ":", "region", "=", "util", ".", "Tile", "(", "size", ",", "dim", "=", "s", ".", "dim", ",", "dtype", "=", "'float'", ")", ".", "translate", "(", "shift", "-", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
separate_particles_into_groups
Given a state, returns a list of groups of particles. Each group of particles are located near each other in the image. Every particle located in the desired region is contained in exactly 1 group. Parameters: ----------- s : state The PERI state to find particles in. region_size: int ...
peri/opt/tiling.py
def separate_particles_into_groups(s, region_size=40, bounds=None): """ Given a state, returns a list of groups of particles. Each group of particles are located near each other in the image. Every particle located in the desired region is contained in exactly 1 group. Parameters: ----------- ...
def separate_particles_into_groups(s, region_size=40, bounds=None): """ Given a state, returns a list of groups of particles. Each group of particles are located near each other in the image. Every particle located in the desired region is contained in exactly 1 group. Parameters: ----------- ...
[ "Given", "a", "state", "returns", "a", "list", "of", "groups", "of", "particles", ".", "Each", "group", "of", "particles", "are", "located", "near", "each", "other", "in", "the", "image", ".", "Every", "particle", "located", "in", "the", "desired", "region...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/opt/tiling.py#L170-L220
[ "def", "separate_particles_into_groups", "(", "s", ",", "region_size", "=", "40", ",", "bounds", "=", "None", ")", ":", "imtile", "=", "(", "s", ".", "oshape", ".", "translate", "(", "-", "s", ".", "pad", ")", "if", "bounds", "is", "None", "else", "u...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
create_comparison_state
Take a platonic image and position and create a state which we can use to sample the error for peri. Also return the blurred platonic image so we can vary the noise on it later
scripts/does_matter/platonic-form.py
def create_comparison_state(image, position, radius=5.0, snr=20, method='constrained-cubic', extrapad=2, zscale=1.0): """ Take a platonic image and position and create a state which we can use to sample the error for peri. Also return the blurred platonic image so we can vary the noise on it lat...
def create_comparison_state(image, position, radius=5.0, snr=20, method='constrained-cubic', extrapad=2, zscale=1.0): """ Take a platonic image and position and create a state which we can use to sample the error for peri. Also return the blurred platonic image so we can vary the noise on it lat...
[ "Take", "a", "platonic", "image", "and", "position", "and", "create", "a", "state", "which", "we", "can", "use", "to", "sample", "the", "error", "for", "peri", ".", "Also", "return", "the", "blurred", "platonic", "image", "so", "we", "can", "vary", "the"...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/platonic-form.py#L10-L30
[ "def", "create_comparison_state", "(", "image", ",", "position", ",", "radius", "=", "5.0", ",", "snr", "=", "20", ",", "method", "=", "'constrained-cubic'", ",", "extrapad", "=", "2", ",", "zscale", "=", "1.0", ")", ":", "# first pad the image slightly since ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
dorun
platonics = create_many_platonics(N=50) dorun(platonics)
scripts/does_matter/platonic-form.py
def dorun(method, platonics=None, nsnrs=20, noise_samples=30, sweeps=30, burn=15): """ platonics = create_many_platonics(N=50) dorun(platonics) """ sigmas = np.logspace(np.log10(1.0/2048), 0, nsnrs) crbs, vals, errs, poss = [], [], [], [] for sigma in sigmas: print "#### sigma:", si...
def dorun(method, platonics=None, nsnrs=20, noise_samples=30, sweeps=30, burn=15): """ platonics = create_many_platonics(N=50) dorun(platonics) """ sigmas = np.logspace(np.log10(1.0/2048), 0, nsnrs) crbs, vals, errs, poss = [], [], [], [] for sigma in sigmas: print "#### sigma:", si...
[ "platonics", "=", "create_many_platonics", "(", "N", "=", "50", ")", "dorun", "(", "platonics", ")" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/platonic-form.py#L32-L65
[ "def", "dorun", "(", "method", ",", "platonics", "=", "None", ",", "nsnrs", "=", "20", ",", "noise_samples", "=", "30", ",", "sweeps", "=", "30", ",", "burn", "=", "15", ")", ":", "sigmas", "=", "np", ".", "logspace", "(", "np", ".", "log10", "("...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
perfect_platonic_per_pixel
Create a perfect platonic sphere of a given radius R by supersampling by a factor scale on a grid of size N. Scale must be odd. We are able to perfectly position these particles up to 1/scale. Therefore, let's only allow those types of shifts for now, but return the actual position used for the placem...
scripts/does_matter/common.py
def perfect_platonic_per_pixel(N, R, scale=11, pos=None, zscale=1.0, returnpix=None): """ Create a perfect platonic sphere of a given radius R by supersampling by a factor scale on a grid of size N. Scale must be odd. We are able to perfectly position these particles up to 1/scale. Therefore, let'...
def perfect_platonic_per_pixel(N, R, scale=11, pos=None, zscale=1.0, returnpix=None): """ Create a perfect platonic sphere of a given radius R by supersampling by a factor scale on a grid of size N. Scale must be odd. We are able to perfectly position these particles up to 1/scale. Therefore, let'...
[ "Create", "a", "perfect", "platonic", "sphere", "of", "a", "given", "radius", "R", "by", "supersampling", "by", "a", "factor", "scale", "on", "a", "grid", "of", "size", "N", ".", "Scale", "must", "be", "odd", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/common.py#L68-L127
[ "def", "perfect_platonic_per_pixel", "(", "N", ",", "R", ",", "scale", "=", "11", ",", "pos", "=", "None", ",", "zscale", "=", "1.0", ",", "returnpix", "=", "None", ")", ":", "# enforce odd scale size", "if", "scale", "%", "2", "!=", "1", ":", "scale",...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
translate_fourier
Translate an image in fourier-space with plane waves
scripts/does_matter/common.py
def translate_fourier(image, dx): """ Translate an image in fourier-space with plane waves """ N = image.shape[0] f = 2*np.pi*np.fft.fftfreq(N) kx,ky,kz = np.meshgrid(*(f,)*3, indexing='ij') kv = np.array([kx,ky,kz]).T q = np.fft.fftn(image)*np.exp(-1.j*(kv*dx).sum(axis=-1)).T return np.re...
def translate_fourier(image, dx): """ Translate an image in fourier-space with plane waves """ N = image.shape[0] f = 2*np.pi*np.fft.fftfreq(N) kx,ky,kz = np.meshgrid(*(f,)*3, indexing='ij') kv = np.array([kx,ky,kz]).T q = np.fft.fftn(image)*np.exp(-1.j*(kv*dx).sum(axis=-1)).T return np.re...
[ "Translate", "an", "image", "in", "fourier", "-", "space", "with", "plane", "waves" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/common.py#L129-L138
[ "def", "translate_fourier", "(", "image", ",", "dx", ")", ":", "N", "=", "image", ".", "shape", "[", "0", "]", "f", "=", "2", "*", "np", ".", "pi", "*", "np", ".", "fft", ".", "fftfreq", "(", "N", ")", "kx", ",", "ky", ",", "kz", "=", "np",...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
doplot
Standardizing the plot format of the does_matter section. See any of the accompaning files to see how to use this generalized plot. image0 : ground true image1 : difference image xs : list of x values for the plots crbs : list of lines of values of the crbs errors : list of lines of errors ...
scripts/does_matter/common.py
def doplot(image0, image1, xs, crbs, errors, labels, diff_image_scale=0.1, dolabels=True, multiple_crbs=True, xlim=None, ylim=None, highlight=None, detailed_labels=False, xlabel="", title=""): """ Standardizing the plot format of the does_matter section. See any of the accompaning files to ...
def doplot(image0, image1, xs, crbs, errors, labels, diff_image_scale=0.1, dolabels=True, multiple_crbs=True, xlim=None, ylim=None, highlight=None, detailed_labels=False, xlabel="", title=""): """ Standardizing the plot format of the does_matter section. See any of the accompaning files to ...
[ "Standardizing", "the", "plot", "format", "of", "the", "does_matter", "section", ".", "See", "any", "of", "the", "accompaning", "files", "to", "see", "how", "to", "use", "this", "generalized", "plot", "." ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/common.py#L165-L233
[ "def", "doplot", "(", "image0", ",", "image1", ",", "xs", ",", "crbs", ",", "errors", ",", "labels", ",", "diff_image_scale", "=", "0.1", ",", "dolabels", "=", "True", ",", "multiple_crbs", "=", "True", ",", "xlim", "=", "None", ",", "ylim", "=", "No...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
users
Load default users and groups.
examples/app.py
def users(): """Load default users and groups.""" from invenio_groups.models import Group, Membership, \ PrivacyPolicy, SubscriptionPolicy admin = accounts.datastore.create_user( email='admin@inveniosoftware.org', password=encrypt_password('123456'), active=True, ) r...
def users(): """Load default users and groups.""" from invenio_groups.models import Group, Membership, \ PrivacyPolicy, SubscriptionPolicy admin = accounts.datastore.create_user( email='admin@inveniosoftware.org', password=encrypt_password('123456'), active=True, ) r...
[ "Load", "default", "users", "and", "groups", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/examples/app.py#L83-L103
[ "def", "users", "(", ")", ":", "from", "invenio_groups", ".", "models", "import", "Group", ",", "Membership", ",", "PrivacyPolicy", ",", "SubscriptionPolicy", "admin", "=", "accounts", ".", "datastore", ".", "create_user", "(", "email", "=", "'admin@inveniosoftw...
109481d6b02701db00b72223dd4a65e167c589a6
valid
HardSphereOverlapNaive._calculate
# This is equivalent for i in range(self.N-1): for j in range(i+1, self.N): d = ((self.zscale*(self.pos[i] - self.pos[j]))**2).sum(axis=-1) r = (self.rad[i] + self.rad[j])**2 cost = self.prior_func(d - r) self.logpriors[i] += cost ...
peri/priors/overlap.py
def _calculate(self): self.logpriors = np.zeros_like(self.rad) for i in range(self.N-1): o = np.arange(i+1, self.N) dist = ((self.zscale*(self.pos[i] - self.pos[o]))**2).sum(axis=-1) dist0 = (self.rad[i] + self.rad[o])**2 update = self.prior_func(dist -...
def _calculate(self): self.logpriors = np.zeros_like(self.rad) for i in range(self.N-1): o = np.arange(i+1, self.N) dist = ((self.zscale*(self.pos[i] - self.pos[o]))**2).sum(axis=-1) dist0 = (self.rad[i] + self.rad[o])**2 update = self.prior_func(dist -...
[ "#", "This", "is", "equivalent", "for", "i", "in", "range", "(", "self", ".", "N", "-", "1", ")", ":", "for", "j", "in", "range", "(", "i", "+", "1", "self", ".", "N", ")", ":", "d", "=", "((", "self", ".", "zscale", "*", "(", "self", ".", ...
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/priors/overlap.py#L21-L44
[ "def", "_calculate", "(", "self", ")", ":", "self", ".", "logpriors", "=", "np", ".", "zeros_like", "(", "self", ".", "rad", ")", "for", "i", "in", "range", "(", "self", ".", "N", "-", "1", ")", ":", "o", "=", "np", ".", "arange", "(", "i", "...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
BarnesInterpolation1D._weight
weighting function for Barnes
peri/interpolation.py
def _weight(self, rsq, sigma=None): """weighting function for Barnes""" sigma = sigma or self.filter_size if not self.clip: o = np.exp(-rsq / (2*sigma**2)) else: o = np.zeros(rsq.shape, dtype='float') m = (rsq < self.clipsize**2) o[m] = np...
def _weight(self, rsq, sigma=None): """weighting function for Barnes""" sigma = sigma or self.filter_size if not self.clip: o = np.exp(-rsq / (2*sigma**2)) else: o = np.zeros(rsq.shape, dtype='float') m = (rsq < self.clipsize**2) o[m] = np...
[ "weighting", "function", "for", "Barnes" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L92-L102
[ "def", "_weight", "(", "self", ",", "rsq", ",", "sigma", "=", "None", ")", ":", "sigma", "=", "sigma", "or", "self", ".", "filter_size", "if", "not", "self", ".", "clip", ":", "o", "=", "np", ".", "exp", "(", "-", "rsq", "/", "(", "2", "*", "...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
BarnesInterpolation1D._eval_firstorder
The first-order Barnes approximation
peri/interpolation.py
def _eval_firstorder(self, rvecs, data, sigma): """The first-order Barnes approximation""" if not self.blocksize: dist_between_points = self._distance_matrix(rvecs, self.x) gaussian_weights = self._weight(dist_between_points, sigma=sigma) return gaussian_weights.dot(d...
def _eval_firstorder(self, rvecs, data, sigma): """The first-order Barnes approximation""" if not self.blocksize: dist_between_points = self._distance_matrix(rvecs, self.x) gaussian_weights = self._weight(dist_between_points, sigma=sigma) return gaussian_weights.dot(d...
[ "The", "first", "-", "order", "Barnes", "approximation" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L113-L128
[ "def", "_eval_firstorder", "(", "self", ",", "rvecs", ",", "data", ",", "sigma", ")", ":", "if", "not", "self", ".", "blocksize", ":", "dist_between_points", "=", "self", ".", "_distance_matrix", "(", "rvecs", ",", "self", ".", "x", ")", "gaussian_weights"...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
BarnesInterpolation1D._newcall
Correct, normalized version of Barnes
peri/interpolation.py
def _newcall(self, rvecs): """Correct, normalized version of Barnes""" # 1. Initial guess for output: sigma = 1*self.filter_size out = self._eval_firstorder(rvecs, self.d, sigma) # 2. There are differences between 0th order at the points and # the passed data, so we it...
def _newcall(self, rvecs): """Correct, normalized version of Barnes""" # 1. Initial guess for output: sigma = 1*self.filter_size out = self._eval_firstorder(rvecs, self.d, sigma) # 2. There are differences between 0th order at the points and # the passed data, so we it...
[ "Correct", "normalized", "version", "of", "Barnes" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L130-L142
[ "def", "_newcall", "(", "self", ",", "rvecs", ")", ":", "# 1. Initial guess for output:", "sigma", "=", "1", "*", "self", ".", "filter_size", "out", "=", "self", ".", "_eval_firstorder", "(", "rvecs", ",", "self", ".", "d", ",", "sigma", ")", "# 2. There a...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
BarnesInterpolation1D._oldcall
Barnes w/o normalizing the weights
peri/interpolation.py
def _oldcall(self, rvecs): """Barnes w/o normalizing the weights""" g = self.filter_size dist0 = self._distance_matrix(self.x, self.x) dist1 = self._distance_matrix(rvecs, self.x) tmp = self._weight(dist0, g).dot(self.d) out = self._weight(dist1, g).dot(self.d) ...
def _oldcall(self, rvecs): """Barnes w/o normalizing the weights""" g = self.filter_size dist0 = self._distance_matrix(self.x, self.x) dist1 = self._distance_matrix(rvecs, self.x) tmp = self._weight(dist0, g).dot(self.d) out = self._weight(dist1, g).dot(self.d) ...
[ "Barnes", "w", "/", "o", "normalizing", "the", "weights" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L144-L158
[ "def", "_oldcall", "(", "self", ",", "rvecs", ")", ":", "g", "=", "self", ".", "filter_size", "dist0", "=", "self", ".", "_distance_matrix", "(", "self", ".", "x", ",", "self", ".", "x", ")", "dist1", "=", "self", ".", "_distance_matrix", "(", "rvecs...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
BarnesInterpolationND._distance_matrix
Pairwise distance between each point in `a` and each point in `b`
peri/interpolation.py
def _distance_matrix(self, a, b): """Pairwise distance between each point in `a` and each point in `b`""" def sq(x): return (x * x) # matrix = np.sum(map(lambda a,b: sq(a[:,None] - b[None,:]), a.T, # b.T), axis=0) # A faster version than above: matrix = sq(a[:, 0][:, No...
def _distance_matrix(self, a, b): """Pairwise distance between each point in `a` and each point in `b`""" def sq(x): return (x * x) # matrix = np.sum(map(lambda a,b: sq(a[:,None] - b[None,:]), a.T, # b.T), axis=0) # A faster version than above: matrix = sq(a[:, 0][:, No...
[ "Pairwise", "distance", "between", "each", "point", "in", "a", "and", "each", "point", "in", "b" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L192-L201
[ "def", "_distance_matrix", "(", "self", ",", "a", ",", "b", ")", ":", "def", "sq", "(", "x", ")", ":", "return", "(", "x", "*", "x", ")", "# matrix = np.sum(map(lambda a,b: sq(a[:,None] - b[None,:]), a.T,", "# b.T), axis=0)", "# A faster version than above:", "mat...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
ChebyshevInterpolation1D._x2c
Convert windowdow coordinates to cheb coordinates [-1,1]
peri/interpolation.py
def _x2c(self, x): """ Convert windowdow coordinates to cheb coordinates [-1,1] """ return ((2 * x - self.window[1] - self.window[0]) / (self.window[1] - self.window[0]))
def _x2c(self, x): """ Convert windowdow coordinates to cheb coordinates [-1,1] """ return ((2 * x - self.window[1] - self.window[0]) / (self.window[1] - self.window[0]))
[ "Convert", "windowdow", "coordinates", "to", "cheb", "coordinates", "[", "-", "1", "1", "]" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L246-L249
[ "def", "_x2c", "(", "self", ",", "x", ")", ":", "return", "(", "(", "2", "*", "x", "-", "self", ".", "window", "[", "1", "]", "-", "self", ".", "window", "[", "0", "]", ")", "/", "(", "self", ".", "window", "[", "1", "]", "-", "self", "."...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
ChebyshevInterpolation1D._c2x
Convert cheb coordinates to windowdow coordinates
peri/interpolation.py
def _c2x(self, c): """ Convert cheb coordinates to windowdow coordinates """ return 0.5 * (self.window[0] + self.window[1] + c * (self.window[1] - self.window[0]))
def _c2x(self, c): """ Convert cheb coordinates to windowdow coordinates """ return 0.5 * (self.window[0] + self.window[1] + c * (self.window[1] - self.window[0]))
[ "Convert", "cheb", "coordinates", "to", "windowdow", "coordinates" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L251-L254
[ "def", "_c2x", "(", "self", ",", "c", ")", ":", "return", "0.5", "*", "(", "self", ".", "window", "[", "0", "]", "+", "self", ".", "window", "[", "1", "]", "+", "c", "*", "(", "self", ".", "window", "[", "1", "]", "-", "self", ".", "window"...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
ChebyshevInterpolation1D._construct_coefficients
Calculate the coefficients based on the func, degree, and interpolating points. _coeffs is a [order, N,M,....] array Notes ----- Moved the -c0 to the coefficients defintion app -= 0.5 * self._coeffs[0] -- moving this to the coefficients
peri/interpolation.py
def _construct_coefficients(self): """Calculate the coefficients based on the func, degree, and interpolating points. _coeffs is a [order, N,M,....] array Notes ----- Moved the -c0 to the coefficients defintion app -= 0.5 * self._coeffs[0] -- moving this to the c...
def _construct_coefficients(self): """Calculate the coefficients based on the func, degree, and interpolating points. _coeffs is a [order, N,M,....] array Notes ----- Moved the -c0 to the coefficients defintion app -= 0.5 * self._coeffs[0] -- moving this to the c...
[ "Calculate", "the", "coefficients", "based", "on", "the", "func", "degree", "and", "interpolating", "points", ".", "_coeffs", "is", "a", "[", "order", "N", "M", "....", "]", "array" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L256-L282
[ "def", "_construct_coefficients", "(", "self", ")", ":", "coeffs", "=", "[", "0", "]", "*", "self", ".", "degree", "N", "=", "float", "(", "self", ".", "evalpts", ")", "lvals", "=", "np", ".", "arange", "(", "self", ".", "evalpts", ")", ".", "astyp...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
ChebyshevInterpolation1D.tk
Evaluates an individual Chebyshev polynomial `k` in coordinate space with proper transformation given the window
peri/interpolation.py
def tk(self, k, x): """ Evaluates an individual Chebyshev polynomial `k` in coordinate space with proper transformation given the window """ weights = np.diag(np.ones(k+1))[k] return np.polynomial.chebyshev.chebval(self._x2c(x), weights)
def tk(self, k, x): """ Evaluates an individual Chebyshev polynomial `k` in coordinate space with proper transformation given the window """ weights = np.diag(np.ones(k+1))[k] return np.polynomial.chebyshev.chebval(self._x2c(x), weights)
[ "Evaluates", "an", "individual", "Chebyshev", "polynomial", "k", "in", "coordinate", "space", "with", "proper", "transformation", "given", "the", "window" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/interpolation.py#L297-L303
[ "def", "tk", "(", "self", ",", "k", ",", "x", ")", ":", "weights", "=", "np", ".", "diag", "(", "np", ".", "ones", "(", "k", "+", "1", ")", ")", "[", "k", "]", "return", "np", ".", "polynomial", ".", "chebyshev", ".", "chebval", "(", "self", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
resolve_admin_type
Determine admin type.
invenio_groups/models.py
def resolve_admin_type(admin): """Determine admin type.""" if admin is current_user or isinstance(admin, UserMixin): return 'User' else: return admin.__class__.__name__
def resolve_admin_type(admin): """Determine admin type.""" if admin is current_user or isinstance(admin, UserMixin): return 'User' else: return admin.__class__.__name__
[ "Determine", "admin", "type", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L812-L817
[ "def", "resolve_admin_type", "(", "admin", ")", ":", "if", "admin", "is", "current_user", "or", "isinstance", "(", "admin", ",", "UserMixin", ")", ":", "return", "'User'", "else", ":", "return", "admin", ".", "__class__", ".", "__name__" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
SubscriptionPolicy.validate
Validate subscription policy value.
invenio_groups/models.py
def validate(cls, policy): """Validate subscription policy value.""" return policy in [cls.OPEN, cls.APPROVAL, cls.CLOSED]
def validate(cls, policy): """Validate subscription policy value.""" return policy in [cls.OPEN, cls.APPROVAL, cls.CLOSED]
[ "Validate", "subscription", "policy", "value", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L71-L73
[ "def", "validate", "(", "cls", ",", "policy", ")", ":", "return", "policy", "in", "[", "cls", ".", "OPEN", ",", "cls", ".", "APPROVAL", ",", "cls", ".", "CLOSED", "]" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
PrivacyPolicy.validate
Validate privacy policy value.
invenio_groups/models.py
def validate(cls, policy): """Validate privacy policy value.""" return policy in [cls.PUBLIC, cls.MEMBERS, cls.ADMINS]
def validate(cls, policy): """Validate privacy policy value.""" return policy in [cls.PUBLIC, cls.MEMBERS, cls.ADMINS]
[ "Validate", "privacy", "policy", "value", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L105-L107
[ "def", "validate", "(", "cls", ",", "policy", ")", ":", "return", "policy", "in", "[", "cls", ".", "PUBLIC", ",", "cls", ".", "MEMBERS", ",", "cls", ".", "ADMINS", "]" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
MembershipState.validate
Validate state value.
invenio_groups/models.py
def validate(cls, state): """Validate state value.""" return state in [cls.ACTIVE, cls.PENDING_ADMIN, cls.PENDING_USER]
def validate(cls, state): """Validate state value.""" return state in [cls.ACTIVE, cls.PENDING_ADMIN, cls.PENDING_USER]
[ "Validate", "state", "value", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L123-L125
[ "def", "validate", "(", "cls", ",", "state", ")", ":", "return", "state", "in", "[", "cls", ".", "ACTIVE", ",", "cls", ".", "PENDING_ADMIN", ",", "cls", ".", "PENDING_USER", "]" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.create
Create a new group. :param name: Name of group. Required and must be unique. :param description: Description of group. Default: ``''`` :param privacy_policy: PrivacyPolicy :param subscription_policy: SubscriptionPolicy :param admins: list of user and/or group objects. Default: `...
invenio_groups/models.py
def create(cls, name=None, description='', privacy_policy=None, subscription_policy=None, is_managed=False, admins=None): """Create a new group. :param name: Name of group. Required and must be unique. :param description: Description of group. Default: ``''`` :param priva...
def create(cls, name=None, description='', privacy_policy=None, subscription_policy=None, is_managed=False, admins=None): """Create a new group. :param name: Name of group. Required and must be unique. :param description: Description of group. Default: ``''`` :param priva...
[ "Create", "a", "new", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L206-L239
[ "def", "create", "(", "cls", ",", "name", "=", "None", ",", "description", "=", "''", ",", "privacy_policy", "=", "None", ",", "subscription_policy", "=", "None", ",", "is_managed", "=", "False", ",", "admins", "=", "None", ")", ":", "assert", "name", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.delete
Delete a group and all associated memberships.
invenio_groups/models.py
def delete(self): """Delete a group and all associated memberships.""" with db.session.begin_nested(): Membership.query_by_group(self).delete() GroupAdmin.query_by_group(self).delete() GroupAdmin.query_by_admin(self).delete() db.session.delete(self)
def delete(self): """Delete a group and all associated memberships.""" with db.session.begin_nested(): Membership.query_by_group(self).delete() GroupAdmin.query_by_group(self).delete() GroupAdmin.query_by_admin(self).delete() db.session.delete(self)
[ "Delete", "a", "group", "and", "all", "associated", "memberships", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L241-L247
[ "def", "delete", "(", "self", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "Membership", ".", "query_by_group", "(", "self", ")", ".", "delete", "(", ")", "GroupAdmin", ".", "query_by_group", "(", "self", ")", ".", "delet...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.update
Update group. :param name: Name of group. :param description: Description of group. :param privacy_policy: PrivacyPolicy :param subscription_policy: SubscriptionPolicy :returns: Updated group
invenio_groups/models.py
def update(self, name=None, description=None, privacy_policy=None, subscription_policy=None, is_managed=None): """Update group. :param name: Name of group. :param description: Description of group. :param privacy_policy: PrivacyPolicy :param subscription_policy: S...
def update(self, name=None, description=None, privacy_policy=None, subscription_policy=None, is_managed=None): """Update group. :param name: Name of group. :param description: Description of group. :param privacy_policy: PrivacyPolicy :param subscription_policy: S...
[ "Update", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L249-L279
[ "def", "update", "(", "self", ",", "name", "=", "None", ",", "description", "=", "None", ",", "privacy_policy", "=", "None", ",", "subscription_policy", "=", "None", ",", "is_managed", "=", "None", ")", ":", "with", "db", ".", "session", ".", "begin_nest...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.get_by_name
Query group by a group name. :param name: Name of a group to search for. :returns: Group object or None.
invenio_groups/models.py
def get_by_name(cls, name): """Query group by a group name. :param name: Name of a group to search for. :returns: Group object or None. """ try: return cls.query.filter_by(name=name).one() except NoResultFound: return None
def get_by_name(cls, name): """Query group by a group name. :param name: Name of a group to search for. :returns: Group object or None. """ try: return cls.query.filter_by(name=name).one() except NoResultFound: return None
[ "Query", "group", "by", "a", "group", "name", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L282-L291
[ "def", "get_by_name", "(", "cls", ",", "name", ")", ":", "try", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "name", "=", "name", ")", ".", "one", "(", ")", "except", "NoResultFound", ":", "return", "None" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.query_by_names
Query group by a list of group names. :param list names: List of the group names. :returns: Query object.
invenio_groups/models.py
def query_by_names(cls, names): """Query group by a list of group names. :param list names: List of the group names. :returns: Query object. """ assert isinstance(names, list) return cls.query.filter(cls.name.in_(names))
def query_by_names(cls, names): """Query group by a list of group names. :param list names: List of the group names. :returns: Query object. """ assert isinstance(names, list) return cls.query.filter(cls.name.in_(names))
[ "Query", "group", "by", "a", "list", "of", "group", "names", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L294-L301
[ "def", "query_by_names", "(", "cls", ",", "names", ")", ":", "assert", "isinstance", "(", "names", ",", "list", ")", "return", "cls", ".", "query", ".", "filter", "(", "cls", ".", "name", ".", "in_", "(", "names", ")", ")" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.query_by_user
Query group by user. :param user: User object. :param bool with_pending: Whether to include pending users. :param bool eager: Eagerly fetch group members. :returns: Query object.
invenio_groups/models.py
def query_by_user(cls, user, with_pending=False, eager=False): """Query group by user. :param user: User object. :param bool with_pending: Whether to include pending users. :param bool eager: Eagerly fetch group members. :returns: Query object. """ q1 = Group.que...
def query_by_user(cls, user, with_pending=False, eager=False): """Query group by user. :param user: User object. :param bool with_pending: Whether to include pending users. :param bool eager: Eagerly fetch group members. :returns: Query object. """ q1 = Group.que...
[ "Query", "group", "by", "user", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L304-L325
[ "def", "query_by_user", "(", "cls", ",", "user", ",", "with_pending", "=", "False", ",", "eager", "=", "False", ")", ":", "q1", "=", "Group", ".", "query", ".", "join", "(", "Membership", ")", ".", "filter_by", "(", "user_id", "=", "user", ".", "get_...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.search
Modify query as so include only specific group names. :param query: Query object. :param str q: Search string. :returs: Query object.
invenio_groups/models.py
def search(cls, query, q): """Modify query as so include only specific group names. :param query: Query object. :param str q: Search string. :returs: Query object. """ return query.filter(Group.name.like('%{0}%'.format(q)))
def search(cls, query, q): """Modify query as so include only specific group names. :param query: Query object. :param str q: Search string. :returs: Query object. """ return query.filter(Group.name.like('%{0}%'.format(q)))
[ "Modify", "query", "as", "so", "include", "only", "specific", "group", "names", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L328-L335
[ "def", "search", "(", "cls", ",", "query", ",", "q", ")", ":", "return", "query", ".", "filter", "(", "Group", ".", "name", ".", "like", "(", "'%{0}%'", ".", "format", "(", "q", ")", ")", ")" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.add_member
Invite a user to a group. :param user: User to be added as a group member. :param state: MembershipState. Default: MembershipState.ACTIVE. :returns: Membership object or None.
invenio_groups/models.py
def add_member(self, user, state=MembershipState.ACTIVE): """Invite a user to a group. :param user: User to be added as a group member. :param state: MembershipState. Default: MembershipState.ACTIVE. :returns: Membership object or None. """ return Membership.create(self,...
def add_member(self, user, state=MembershipState.ACTIVE): """Invite a user to a group. :param user: User to be added as a group member. :param state: MembershipState. Default: MembershipState.ACTIVE. :returns: Membership object or None. """ return Membership.create(self,...
[ "Invite", "a", "user", "to", "a", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L352-L359
[ "def", "add_member", "(", "self", ",", "user", ",", "state", "=", "MembershipState", ".", "ACTIVE", ")", ":", "return", "Membership", ".", "create", "(", "self", ",", "user", ",", "state", ")" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.invite
Invite a user to a group (should be done by admins). Wrapper around ``add_member()`` to ensure proper membership state. :param user: User to invite. :param admin: Admin doing the action. If provided, user is only invited if the object is an admin for this group. Default: None. ...
invenio_groups/models.py
def invite(self, user, admin=None): """Invite a user to a group (should be done by admins). Wrapper around ``add_member()`` to ensure proper membership state. :param user: User to invite. :param admin: Admin doing the action. If provided, user is only invited if the object ...
def invite(self, user, admin=None): """Invite a user to a group (should be done by admins). Wrapper around ``add_member()`` to ensure proper membership state. :param user: User to invite. :param admin: Admin doing the action. If provided, user is only invited if the object ...
[ "Invite", "a", "user", "to", "a", "group", "(", "should", "be", "done", "by", "admins", ")", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L368-L380
[ "def", "invite", "(", "self", ",", "user", ",", "admin", "=", "None", ")", ":", "if", "admin", "is", "None", "or", "self", ".", "is_admin", "(", "admin", ")", ":", "return", "self", ".", "add_member", "(", "user", ",", "state", "=", "MembershipState"...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.invite_by_emails
Invite users to a group by emails. :param list emails: Emails of users that shall be invited. :returns list: Newly created Memberships or Nones.
invenio_groups/models.py
def invite_by_emails(self, emails): """Invite users to a group by emails. :param list emails: Emails of users that shall be invited. :returns list: Newly created Memberships or Nones. """ assert emails is None or isinstance(emails, list) results = [] for email ...
def invite_by_emails(self, emails): """Invite users to a group by emails. :param list emails: Emails of users that shall be invited. :returns list: Newly created Memberships or Nones. """ assert emails is None or isinstance(emails, list) results = [] for email ...
[ "Invite", "users", "to", "a", "group", "by", "emails", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L382-L399
[ "def", "invite_by_emails", "(", "self", ",", "emails", ")", ":", "assert", "emails", "is", "None", "or", "isinstance", "(", "emails", ",", "list", ")", "results", "=", "[", "]", "for", "email", "in", "emails", ":", "try", ":", "user", "=", "User", "....
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.subscribe
Subscribe a user to a group (done by users). Wrapper around ``add_member()`` which checks subscription policy. :param user: User to subscribe. :returns: Newly created Membership or None.
invenio_groups/models.py
def subscribe(self, user): """Subscribe a user to a group (done by users). Wrapper around ``add_member()`` which checks subscription policy. :param user: User to subscribe. :returns: Newly created Membership or None. """ if self.subscription_policy == SubscriptionPolicy...
def subscribe(self, user): """Subscribe a user to a group (done by users). Wrapper around ``add_member()`` which checks subscription policy. :param user: User to subscribe. :returns: Newly created Membership or None. """ if self.subscription_policy == SubscriptionPolicy...
[ "Subscribe", "a", "user", "to", "a", "group", "(", "done", "by", "users", ")", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L401-L414
[ "def", "subscribe", "(", "self", ",", "user", ")", ":", "if", "self", ".", "subscription_policy", "==", "SubscriptionPolicy", ".", "OPEN", ":", "return", "self", ".", "add_member", "(", "user", ")", "elif", "self", ".", "subscription_policy", "==", "Subscrip...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.is_member
Verify if given user is a group member. :param user: User to be checked. :param bool with_pending: Whether to include pending users or not. :returns: True or False.
invenio_groups/models.py
def is_member(self, user, with_pending=False): """Verify if given user is a group member. :param user: User to be checked. :param bool with_pending: Whether to include pending users or not. :returns: True or False. """ m = Membership.get(self, user) if m is not N...
def is_member(self, user, with_pending=False): """Verify if given user is a group member. :param user: User to be checked. :param bool with_pending: Whether to include pending users or not. :returns: True or False. """ m = Membership.get(self, user) if m is not N...
[ "Verify", "if", "given", "user", "is", "a", "group", "member", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L426-L439
[ "def", "is_member", "(", "self", ",", "user", ",", "with_pending", "=", "False", ")", ":", "m", "=", "Membership", ".", "get", "(", "self", ",", "user", ")", "if", "m", "is", "not", "None", ":", "if", "with_pending", ":", "return", "True", "elif", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.can_see_members
Determine if given user can see other group members. :param user: User to be checked. :returns: True or False.
invenio_groups/models.py
def can_see_members(self, user): """Determine if given user can see other group members. :param user: User to be checked. :returns: True or False. """ if self.privacy_policy == PrivacyPolicy.PUBLIC: return True elif self.privacy_policy == PrivacyPolicy.MEMBER...
def can_see_members(self, user): """Determine if given user can see other group members. :param user: User to be checked. :returns: True or False. """ if self.privacy_policy == PrivacyPolicy.PUBLIC: return True elif self.privacy_policy == PrivacyPolicy.MEMBER...
[ "Determine", "if", "given", "user", "can", "see", "other", "group", "members", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L441-L452
[ "def", "can_see_members", "(", "self", ",", "user", ")", ":", "if", "self", ".", "privacy_policy", "==", "PrivacyPolicy", ".", "PUBLIC", ":", "return", "True", "elif", "self", ".", "privacy_policy", "==", "PrivacyPolicy", ".", "MEMBERS", ":", "return", "self...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Group.can_invite_others
Determine if user can invite people to a group. Be aware that this check is independent from the people (users) which are going to be invited. The checked user is the one who invites someone, NOT who is going to be invited. :param user: User to be checked. :returns: True or Fal...
invenio_groups/models.py
def can_invite_others(self, user): """Determine if user can invite people to a group. Be aware that this check is independent from the people (users) which are going to be invited. The checked user is the one who invites someone, NOT who is going to be invited. :param user: Use...
def can_invite_others(self, user): """Determine if user can invite people to a group. Be aware that this check is independent from the people (users) which are going to be invited. The checked user is the one who invites someone, NOT who is going to be invited. :param user: Use...
[ "Determine", "if", "user", "can", "invite", "people", "to", "a", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L465-L482
[ "def", "can_invite_others", "(", "self", ",", "user", ")", ":", "if", "self", ".", "is_managed", ":", "return", "False", "elif", "self", ".", "is_admin", "(", "user", ")", ":", "return", "True", "elif", "self", ".", "subscription_policy", "!=", "Subscripti...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.get
Get membership for given user and group. :param group: Group object. :param user: User object. :returns: Membership or None.
invenio_groups/models.py
def get(cls, group, user): """Get membership for given user and group. :param group: Group object. :param user: User object. :returns: Membership or None. """ try: m = cls.query.filter_by(user_id=user.get_id(), group=group).one() return m ...
def get(cls, group, user): """Get membership for given user and group. :param group: Group object. :param user: User object. :returns: Membership or None. """ try: m = cls.query.filter_by(user_id=user.get_id(), group=group).one() return m ...
[ "Get", "membership", "for", "given", "user", "and", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L548-L559
[ "def", "get", "(", "cls", ",", "group", ",", "user", ")", ":", "try", ":", "m", "=", "cls", ".", "query", ".", "filter_by", "(", "user_id", "=", "user", ".", "get_id", "(", ")", ",", "group", "=", "group", ")", ".", "one", "(", ")", "return", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership._filter
Filter a query result.
invenio_groups/models.py
def _filter(cls, query, state=MembershipState.ACTIVE, eager=None): """Filter a query result.""" query = query.filter_by(state=state) eager = eager or [] for field in eager: query = query.options(joinedload(field)) return query
def _filter(cls, query, state=MembershipState.ACTIVE, eager=None): """Filter a query result.""" query = query.filter_by(state=state) eager = eager or [] for field in eager: query = query.options(joinedload(field)) return query
[ "Filter", "a", "query", "result", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L562-L570
[ "def", "_filter", "(", "cls", ",", "query", ",", "state", "=", "MembershipState", ".", "ACTIVE", ",", "eager", "=", "None", ")", ":", "query", "=", "query", ".", "filter_by", "(", "state", "=", "state", ")", "eager", "=", "eager", "or", "[", "]", "...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.query_by_user
Get a user's memberships.
invenio_groups/models.py
def query_by_user(cls, user, **kwargs): """Get a user's memberships.""" return cls._filter( cls.query.filter_by(user_id=user.get_id()), **kwargs )
def query_by_user(cls, user, **kwargs): """Get a user's memberships.""" return cls._filter( cls.query.filter_by(user_id=user.get_id()), **kwargs )
[ "Get", "a", "user", "s", "memberships", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L573-L578
[ "def", "query_by_user", "(", "cls", ",", "user", ",", "*", "*", "kwargs", ")", ":", "return", "cls", ".", "_filter", "(", "cls", ".", "query", ".", "filter_by", "(", "user_id", "=", "user", ".", "get_id", "(", ")", ")", ",", "*", "*", "kwargs", "...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.query_invitations
Get all invitations for given user.
invenio_groups/models.py
def query_invitations(cls, user, eager=False): """Get all invitations for given user.""" if eager: eager = [Membership.group] return cls.query_by_user(user, state=MembershipState.PENDING_USER, eager=eager)
def query_invitations(cls, user, eager=False): """Get all invitations for given user.""" if eager: eager = [Membership.group] return cls.query_by_user(user, state=MembershipState.PENDING_USER, eager=eager)
[ "Get", "all", "invitations", "for", "given", "user", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L581-L586
[ "def", "query_invitations", "(", "cls", ",", "user", ",", "eager", "=", "False", ")", ":", "if", "eager", ":", "eager", "=", "[", "Membership", ".", "group", "]", "return", "cls", ".", "query_by_user", "(", "user", ",", "state", "=", "MembershipState", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.query_requests
Get all pending group requests.
invenio_groups/models.py
def query_requests(cls, admin, eager=False): """Get all pending group requests.""" # Get direct pending request if hasattr(admin, 'is_superadmin') and admin.is_superadmin: q1 = GroupAdmin.query.with_entities( GroupAdmin.group_id) else: q1 = GroupAd...
def query_requests(cls, admin, eager=False): """Get all pending group requests.""" # Get direct pending request if hasattr(admin, 'is_superadmin') and admin.is_superadmin: q1 = GroupAdmin.query.with_entities( GroupAdmin.group_id) else: q1 = GroupAd...
[ "Get", "all", "pending", "group", "requests", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L589-L616
[ "def", "query_requests", "(", "cls", ",", "admin", ",", "eager", "=", "False", ")", ":", "# Get direct pending request", "if", "hasattr", "(", "admin", ",", "'is_superadmin'", ")", "and", "admin", ".", "is_superadmin", ":", "q1", "=", "GroupAdmin", ".", "que...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.query_by_group
Get a group's members.
invenio_groups/models.py
def query_by_group(cls, group_or_id, with_invitations=False, **kwargs): """Get a group's members.""" if isinstance(group_or_id, Group): id_group = group_or_id.id else: id_group = group_or_id if not with_invitations: return cls._filter( ...
def query_by_group(cls, group_or_id, with_invitations=False, **kwargs): """Get a group's members.""" if isinstance(group_or_id, Group): id_group = group_or_id.id else: id_group = group_or_id if not with_invitations: return cls._filter( ...
[ "Get", "a", "group", "s", "members", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L619-L638
[ "def", "query_by_group", "(", "cls", ",", "group_or_id", ",", "with_invitations", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "group_or_id", ",", "Group", ")", ":", "id_group", "=", "group_or_id", ".", "id", "else", ":", "id...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.search
Modify query as so include only specific members. :param query: Query object. :param str q: Search string. :returs: Query object.
invenio_groups/models.py
def search(cls, query, q): """Modify query as so include only specific members. :param query: Query object. :param str q: Search string. :returs: Query object. """ query = query.join(User).filter( User.email.like('%{0}%'.format(q)), ) retu...
def search(cls, query, q): """Modify query as so include only specific members. :param query: Query object. :param str q: Search string. :returs: Query object. """ query = query.join(User).filter( User.email.like('%{0}%'.format(q)), ) retu...
[ "Modify", "query", "as", "so", "include", "only", "specific", "members", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L641-L651
[ "def", "search", "(", "cls", ",", "query", ",", "q", ")", ":", "query", "=", "query", ".", "join", "(", "User", ")", ".", "filter", "(", "User", ".", "email", ".", "like", "(", "'%{0}%'", ".", "format", "(", "q", ")", ")", ",", ")", "return", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.order
Modify query as so to order the results. :param query: Query object. :param str s: Orderinig: ``asc`` or ``desc``. :returs: Query object.
invenio_groups/models.py
def order(cls, query, field, s): """Modify query as so to order the results. :param query: Query object. :param str s: Orderinig: ``asc`` or ``desc``. :returs: Query object. """ if s == 'asc': query = query.order_by(asc(field)) elif s == 'desc': ...
def order(cls, query, field, s): """Modify query as so to order the results. :param query: Query object. :param str s: Orderinig: ``asc`` or ``desc``. :returs: Query object. """ if s == 'asc': query = query.order_by(asc(field)) elif s == 'desc': ...
[ "Modify", "query", "as", "so", "to", "order", "the", "results", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L654-L665
[ "def", "order", "(", "cls", ",", "query", ",", "field", ",", "s", ")", ":", "if", "s", "==", "'asc'", ":", "query", "=", "query", ".", "order_by", "(", "asc", "(", "field", ")", ")", "elif", "s", "==", "'desc'", ":", "query", "=", "query", ".",...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.create
Create a new membership.
invenio_groups/models.py
def create(cls, group, user, state=MembershipState.ACTIVE): """Create a new membership.""" with db.session.begin_nested(): membership = cls( user_id=user.get_id(), id_group=group.id, state=state, ) db.session.add(members...
def create(cls, group, user, state=MembershipState.ACTIVE): """Create a new membership.""" with db.session.begin_nested(): membership = cls( user_id=user.get_id(), id_group=group.id, state=state, ) db.session.add(members...
[ "Create", "a", "new", "membership", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L668-L677
[ "def", "create", "(", "cls", ",", "group", ",", "user", ",", "state", "=", "MembershipState", ".", "ACTIVE", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "membership", "=", "cls", "(", "user_id", "=", "user", ".", "get_...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.delete
Delete membership.
invenio_groups/models.py
def delete(cls, group, user): """Delete membership.""" with db.session.begin_nested(): cls.query.filter_by(group=group, user_id=user.get_id()).delete()
def delete(cls, group, user): """Delete membership.""" with db.session.begin_nested(): cls.query.filter_by(group=group, user_id=user.get_id()).delete()
[ "Delete", "membership", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L680-L683
[ "def", "delete", "(", "cls", ",", "group", ",", "user", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "cls", ".", "query", ".", "filter_by", "(", "group", "=", "group", ",", "user_id", "=", "user", ".", "get_id", "(", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Membership.accept
Activate membership.
invenio_groups/models.py
def accept(self): """Activate membership.""" with db.session.begin_nested(): self.state = MembershipState.ACTIVE db.session.merge(self)
def accept(self): """Activate membership.""" with db.session.begin_nested(): self.state = MembershipState.ACTIVE db.session.merge(self)
[ "Activate", "membership", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L685-L689
[ "def", "accept", "(", "self", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "self", ".", "state", "=", "MembershipState", ".", "ACTIVE", "db", ".", "session", ".", "merge", "(", "self", ")" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
GroupAdmin.create
Create a new group admin. :param group: Group object. :param admin: Admin object. :returns: Newly created GroupAdmin object. :raises: IntegrityError
invenio_groups/models.py
def create(cls, group, admin): """Create a new group admin. :param group: Group object. :param admin: Admin object. :returns: Newly created GroupAdmin object. :raises: IntegrityError """ with db.session.begin_nested(): obj = cls( group...
def create(cls, group, admin): """Create a new group admin. :param group: Group object. :param admin: Admin object. :returns: Newly created GroupAdmin object. :raises: IntegrityError """ with db.session.begin_nested(): obj = cls( group...
[ "Create", "a", "new", "group", "admin", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L738-L752
[ "def", "create", "(", "cls", ",", "group", ",", "admin", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "obj", "=", "cls", "(", "group", "=", "group", ",", "admin", "=", "admin", ",", ")", "db", ".", "session", ".", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
GroupAdmin.get
Get specific GroupAdmin object.
invenio_groups/models.py
def get(cls, group, admin): """Get specific GroupAdmin object.""" try: ga = cls.query.filter_by( group=group, admin_id=admin.get_id(), admin_type=resolve_admin_type(admin)).one() return ga except Exception: return None
def get(cls, group, admin): """Get specific GroupAdmin object.""" try: ga = cls.query.filter_by( group=group, admin_id=admin.get_id(), admin_type=resolve_admin_type(admin)).one() return ga except Exception: return None
[ "Get", "specific", "GroupAdmin", "object", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L755-L763
[ "def", "get", "(", "cls", ",", "group", ",", "admin", ")", ":", "try", ":", "ga", "=", "cls", ".", "query", ".", "filter_by", "(", "group", "=", "group", ",", "admin_id", "=", "admin", ".", "get_id", "(", ")", ",", "admin_type", "=", "resolve_admin...
109481d6b02701db00b72223dd4a65e167c589a6
valid
GroupAdmin.delete
Delete admin from group. :param group: Group object. :param admin: Admin object.
invenio_groups/models.py
def delete(cls, group, admin): """Delete admin from group. :param group: Group object. :param admin: Admin object. """ with db.session.begin_nested(): obj = cls.query.filter( cls.admin == admin, cls.group == group).one() db.session.delete(...
def delete(cls, group, admin): """Delete admin from group. :param group: Group object. :param admin: Admin object. """ with db.session.begin_nested(): obj = cls.query.filter( cls.admin == admin, cls.group == group).one() db.session.delete(...
[ "Delete", "admin", "from", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L766-L775
[ "def", "delete", "(", "cls", ",", "group", ",", "admin", ")", ":", "with", "db", ".", "session", ".", "begin_nested", "(", ")", ":", "obj", "=", "cls", ".", "query", ".", "filter", "(", "cls", ".", "admin", "==", "admin", ",", "cls", ".", "group"...
109481d6b02701db00b72223dd4a65e167c589a6
valid
GroupAdmin.query_by_admin
Get all groups for for a specific admin.
invenio_groups/models.py
def query_by_admin(cls, admin): """Get all groups for for a specific admin.""" return cls.query.filter_by( admin_type=resolve_admin_type(admin), admin_id=admin.get_id())
def query_by_admin(cls, admin): """Get all groups for for a specific admin.""" return cls.query.filter_by( admin_type=resolve_admin_type(admin), admin_id=admin.get_id())
[ "Get", "all", "groups", "for", "for", "a", "specific", "admin", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L783-L786
[ "def", "query_by_admin", "(", "cls", ",", "admin", ")", ":", "return", "cls", ".", "query", ".", "filter_by", "(", "admin_type", "=", "resolve_admin_type", "(", "admin", ")", ",", "admin_id", "=", "admin", ".", "get_id", "(", ")", ")" ]
109481d6b02701db00b72223dd4a65e167c589a6
valid
GroupAdmin.query_admins_by_group_ids
Get count of admins per group.
invenio_groups/models.py
def query_admins_by_group_ids(cls, groups_ids=None): """Get count of admins per group.""" assert groups_ids is None or isinstance(groups_ids, list) query = db.session.query( Group.id, func.count(GroupAdmin.id) ).join( GroupAdmin ).group_by( Gr...
def query_admins_by_group_ids(cls, groups_ids=None): """Get count of admins per group.""" assert groups_ids is None or isinstance(groups_ids, list) query = db.session.query( Group.id, func.count(GroupAdmin.id) ).join( GroupAdmin ).group_by( Gr...
[ "Get", "count", "of", "admins", "per", "group", "." ]
inveniosoftware-contrib/invenio-groups
python
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L789-L804
[ "def", "query_admins_by_group_ids", "(", "cls", ",", "groups_ids", "=", "None", ")", ":", "assert", "groups_ids", "is", "None", "or", "isinstance", "(", "groups_ids", ",", "list", ")", "query", "=", "db", ".", "session", ".", "query", "(", "Group", ".", ...
109481d6b02701db00b72223dd4a65e167c589a6
valid
Profiles.all
Get all social newtworks profiles
buffpy/managers/profiles.py
def all(self): ''' Get all social newtworks profiles ''' response = self.api.get(url=PATHS['GET_PROFILES']) for raw_profile in response: self.append(Profile(self.api, raw_profile)) return self
def all(self): ''' Get all social newtworks profiles ''' response = self.api.get(url=PATHS['GET_PROFILES']) for raw_profile in response: self.append(Profile(self.api, raw_profile)) return self
[ "Get", "all", "social", "newtworks", "profiles" ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/profiles.py#L15-L25
[ "def", "all", "(", "self", ")", ":", "response", "=", "self", ".", "api", ".", "get", "(", "url", "=", "PATHS", "[", "'GET_PROFILES'", "]", ")", "for", "raw_profile", "in", "response", ":", "self", ".", "append", "(", "Profile", "(", "self", ".", "...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Profiles.filter
Based on some criteria, filter the profiles and return a new Profiles Manager containing only the chosen items If the manager doen't have any items, get all the profiles from Buffer
buffpy/managers/profiles.py
def filter(self, **kwargs): ''' Based on some criteria, filter the profiles and return a new Profiles Manager containing only the chosen items If the manager doen't have any items, get all the profiles from Buffer ''' if not len(self): self.all() new_list = filter(lambda item:...
def filter(self, **kwargs): ''' Based on some criteria, filter the profiles and return a new Profiles Manager containing only the chosen items If the manager doen't have any items, get all the profiles from Buffer ''' if not len(self): self.all() new_list = filter(lambda item:...
[ "Based", "on", "some", "criteria", "filter", "the", "profiles", "and", "return", "a", "new", "Profiles", "Manager", "containing", "only", "the", "chosen", "items" ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/profiles.py#L27-L40
[ "def", "filter", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "len", "(", "self", ")", ":", "self", ".", "all", "(", ")", "new_list", "=", "filter", "(", "lambda", "item", ":", "[", "True", "for", "arg", "in", "kwargs", "if", "i...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
dorun
we want to display the errors introduced by pixelation so we plot: * zero noise, cg image, fit * SNR 20, cg image, fit * CRB for both a = dorun(noise_samples=30, sweeps=24, burn=12, SNR=20)
scripts/does_matter/pixel-integration.py
def dorun(SNR=20, sweeps=20, burn=8, noise_samples=10): """ we want to display the errors introduced by pixelation so we plot: * zero noise, cg image, fit * SNR 20, cg image, fit * CRB for both a = dorun(noise_samples=30, sweeps=24, burn=12, SNR=20) """ radii = np.linspace(2...
def dorun(SNR=20, sweeps=20, burn=8, noise_samples=10): """ we want to display the errors introduced by pixelation so we plot: * zero noise, cg image, fit * SNR 20, cg image, fit * CRB for both a = dorun(noise_samples=30, sweeps=24, burn=12, SNR=20) """ radii = np.linspace(2...
[ "we", "want", "to", "display", "the", "errors", "introduced", "by", "pixelation", "so", "we", "plot", ":", "*", "zero", "noise", "cg", "image", "fit", "*", "SNR", "20", "cg", "image", "fit", "*", "CRB", "for", "both" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/pixel-integration.py#L52-L76
[ "def", "dorun", "(", "SNR", "=", "20", ",", "sweeps", "=", "20", ",", "burn", "=", "8", ",", "noise_samples", "=", "10", ")", ":", "radii", "=", "np", ".", "linspace", "(", "2", ",", "10", ",", "8", ",", "endpoint", "=", "False", ")", "crbs", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
GaussianMomentExpansion._skew
returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z
peri/comp/psfs.py
def _skew(self, x, z, d=0): """ returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z """ # get the top bound determined by the kurtosis kval = (np.tanh(self._poly(z, self._kurtosis_coeffs(d)))+1)/12. bdpoly = np.array([ -1.142468e+04, 3.0939485e+03, -2.028356...
def _skew(self, x, z, d=0): """ returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z """ # get the top bound determined by the kurtosis kval = (np.tanh(self._poly(z, self._kurtosis_coeffs(d)))+1)/12. bdpoly = np.array([ -1.142468e+04, 3.0939485e+03, -2.028356...
[ "returns", "the", "kurtosis", "parameter", "for", "direction", "d", "d", "=", "0", "is", "rho", "d", "=", "1", "is", "z" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/psfs.py#L461-L475
[ "def", "_skew", "(", "self", ",", "x", ",", "z", ",", "d", "=", "0", ")", ":", "# get the top bound determined by the kurtosis", "kval", "=", "(", "np", ".", "tanh", "(", "self", ".", "_poly", "(", "z", ",", "self", ".", "_kurtosis_coeffs", "(", "d", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
GaussianMomentExpansion._kurtosis
returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z
peri/comp/psfs.py
def _kurtosis(self, x, z, d=0): """ returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z """ val = self._poly(z, self._kurtosis_coeffs(d)) return (np.tanh(val)+1)/12.*(3 - 6*x**2 + x**4)
def _kurtosis(self, x, z, d=0): """ returns the kurtosis parameter for direction d, d=0 is rho, d=1 is z """ val = self._poly(z, self._kurtosis_coeffs(d)) return (np.tanh(val)+1)/12.*(3 - 6*x**2 + x**4)
[ "returns", "the", "kurtosis", "parameter", "for", "direction", "d", "d", "=", "0", "is", "rho", "d", "=", "1", "is", "z" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/peri/comp/psfs.py#L478-L481
[ "def", "_kurtosis", "(", "self", ",", "x", ",", "z", ",", "d", "=", "0", ")", ":", "val", "=", "self", ".", "_poly", "(", "z", ",", "self", ".", "_kurtosis_coeffs", "(", "d", ")", ")", "return", "(", "np", ".", "tanh", "(", "val", ")", "+", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
fit_edge
axis is 'z' or 'xy' seps = np.linspace(0,2,20) 'z' seps = np.linspace(-2,2,20) 'xy'
scripts/crb/edge-particles.py
def fit_edge(separation, radius=5.0, samples=100, imsize=64, sigma=0.05, axis='z'): """ axis is 'z' or 'xy' seps = np.linspace(0,2,20) 'z' seps = np.linspace(-2,2,20) 'xy' """ terrors = [] berrors = [] crbs = [] for sep in separation: print '='*79 print 'sep =', sep,...
def fit_edge(separation, radius=5.0, samples=100, imsize=64, sigma=0.05, axis='z'): """ axis is 'z' or 'xy' seps = np.linspace(0,2,20) 'z' seps = np.linspace(-2,2,20) 'xy' """ terrors = [] berrors = [] crbs = [] for sep in separation: print '='*79 print 'sep =', sep,...
[ "axis", "is", "z", "or", "xy", "seps", "=", "np", ".", "linspace", "(", "0", "2", "20", ")", "z", "seps", "=", "np", ".", "linspace", "(", "-", "2", "2", "20", ")", "xy" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/crb/edge-particles.py#L11-L72
[ "def", "fit_edge", "(", "separation", ",", "radius", "=", "5.0", ",", "samples", "=", "100", ",", "imsize", "=", "64", ",", "sigma", "=", "0.05", ",", "axis", "=", "'z'", ")", ":", "terrors", "=", "[", "]", "berrors", "=", "[", "]", "crbs", "=", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
zjitter
scan jitter is in terms of the fractional pixel difference when moving the laser in the z-direction
scripts/does_matter/z-jitter.py
def zjitter(jitter=0.0, radius=5): """ scan jitter is in terms of the fractional pixel difference when moving the laser in the z-direction """ psfsize = np.array([2.0, 1.0, 3.0]) # create a base image of one particle s0 = init.create_single_particle_state(imsize=4*radius, radiu...
def zjitter(jitter=0.0, radius=5): """ scan jitter is in terms of the fractional pixel difference when moving the laser in the z-direction """ psfsize = np.array([2.0, 1.0, 3.0]) # create a base image of one particle s0 = init.create_single_particle_state(imsize=4*radius, radiu...
[ "scan", "jitter", "is", "in", "terms", "of", "the", "fractional", "pixel", "difference", "when", "moving", "the", "laser", "in", "the", "z", "-", "direction" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/z-jitter.py#L9-L41
[ "def", "zjitter", "(", "jitter", "=", "0.0", ",", "radius", "=", "5", ")", ":", "psfsize", "=", "np", ".", "array", "(", "[", "2.0", ",", "1.0", ",", "3.0", "]", ")", "# create a base image of one particle", "s0", "=", "init", ".", "create_single_particl...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
dorun
we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8)
scripts/does_matter/z-jitter.py
def dorun(SNR=20, njitters=20, samples=10, noise_samples=10, sweeps=20, burn=10): """ we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8) """ jitters = np.logspace(-6, np...
def dorun(SNR=20, njitters=20, samples=10, noise_samples=10, sweeps=20, burn=10): """ we want to display the errors introduced by pixelation so we plot: * CRB, sampled error vs exposure time a = dorun(ntimes=10, samples=5, noise_samples=5, sweeps=20, burn=8) """ jitters = np.logspace(-6, np...
[ "we", "want", "to", "display", "the", "errors", "introduced", "by", "pixelation", "so", "we", "plot", ":", "*", "CRB", "sampled", "error", "vs", "exposure", "time" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/does_matter/z-jitter.py#L43-L78
[ "def", "dorun", "(", "SNR", "=", "20", ",", "njitters", "=", "20", ",", "samples", "=", "10", ",", "noise_samples", "=", "10", ",", "sweeps", "=", "20", ",", "burn", "=", "10", ")", ":", "jitters", "=", "np", ".", "logspace", "(", "-", "6", ","...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
Update.interactions
Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes.
buffpy/models/update.py
def interactions(self): ''' Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes. ''' interactions = [] url = PATHS['GET_INTERACTIONS'] % self.id response = self.api.get(url=url) for interaction in response['...
def interactions(self): ''' Returns the detailed information on individual interactions with the social media update such as favorites, retweets and likes. ''' interactions = [] url = PATHS['GET_INTERACTIONS'] % self.id response = self.api.get(url=url) for interaction in response['...
[ "Returns", "the", "detailed", "information", "on", "individual", "interactions", "with", "the", "social", "media", "update", "such", "as", "favorites", "retweets", "and", "likes", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/update.py#L28-L43
[ "def", "interactions", "(", "self", ")", ":", "interactions", "=", "[", "]", "url", "=", "PATHS", "[", "'GET_INTERACTIONS'", "]", "%", "self", ".", "id", "response", "=", "self", ".", "api", ".", "get", "(", "url", "=", "url", ")", "for", "interactio...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Update.edit
Edit an existing, individual status update.
buffpy/models/update.py
def edit(self, text, media=None, utc=None, now=None): ''' Edit an existing, individual status update. ''' url = PATHS['EDIT'] % self.id post_data = "text=%s&" % text if now: post_data += "now=%s&" % now if utc: post_data += "utc=%s&" % utc if media: media_format ...
def edit(self, text, media=None, utc=None, now=None): ''' Edit an existing, individual status update. ''' url = PATHS['EDIT'] % self.id post_data = "text=%s&" % text if now: post_data += "now=%s&" % now if utc: post_data += "utc=%s&" % utc if media: media_format ...
[ "Edit", "an", "existing", "individual", "status", "update", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/update.py#L45-L68
[ "def", "edit", "(", "self", ",", "text", ",", "media", "=", "None", ",", "utc", "=", "None", ",", "now", "=", "None", ")", ":", "url", "=", "PATHS", "[", "'EDIT'", "]", "%", "self", ".", "id", "post_data", "=", "\"text=%s&\"", "%", "text", "if", ...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Update.publish
Immediately shares a single pending update and recalculates times for updates remaining in the queue.
buffpy/models/update.py
def publish(self): ''' Immediately shares a single pending update and recalculates times for updates remaining in the queue. ''' url = PATHS['PUBLISH'] % self.id return self.api.post(url=url)
def publish(self): ''' Immediately shares a single pending update and recalculates times for updates remaining in the queue. ''' url = PATHS['PUBLISH'] % self.id return self.api.post(url=url)
[ "Immediately", "shares", "a", "single", "pending", "update", "and", "recalculates", "times", "for", "updates", "remaining", "in", "the", "queue", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/update.py#L70-L77
[ "def", "publish", "(", "self", ")", ":", "url", "=", "PATHS", "[", "'PUBLISH'", "]", "%", "self", ".", "id", "return", "self", ".", "api", ".", "post", "(", "url", "=", "url", ")" ]
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Update.delete
Permanently delete an existing status update.
buffpy/models/update.py
def delete(self): ''' Permanently delete an existing status update. ''' url = PATHS['DELETE'] % self.id return self.api.post(url=url)
def delete(self): ''' Permanently delete an existing status update. ''' url = PATHS['DELETE'] % self.id return self.api.post(url=url)
[ "Permanently", "delete", "an", "existing", "status", "update", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/update.py#L79-L85
[ "def", "delete", "(", "self", ")", ":", "url", "=", "PATHS", "[", "'DELETE'", "]", "%", "self", ".", "id", "return", "self", ".", "api", ".", "post", "(", "url", "=", "url", ")" ]
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Update.move_to_top
Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time.
buffpy/models/update.py
def move_to_top(self): ''' Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time. ''' url = PATHS['MOVE_TO_TOP'] % self.id response = self.api.post(url=url) return Update(api=self.ap...
def move_to_top(self): ''' Move an existing status update to the top of the queue and recalculate times for all updates in the queue. Returns the update with its new posting time. ''' url = PATHS['MOVE_TO_TOP'] % self.id response = self.api.post(url=url) return Update(api=self.ap...
[ "Move", "an", "existing", "status", "update", "to", "the", "top", "of", "the", "queue", "and", "recalculate", "times", "for", "all", "updates", "in", "the", "queue", ".", "Returns", "the", "update", "with", "its", "new", "posting", "time", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/models/update.py#L87-L97
[ "def", "move_to_top", "(", "self", ")", ":", "url", "=", "PATHS", "[", "'MOVE_TO_TOP'", "]", "%", "self", ".", "id", "response", "=", "self", ".", "api", ".", "post", "(", "url", "=", "url", ")", "return", "Update", "(", "api", "=", "self", ".", ...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
pole_removal
Remove the noise poles from a 2d noise distribution to show that affects the real-space noise picture. noise -- fftshifted 2d array of q values poles -- N,2 list of pole locations. the last index is in the order y,x as determined by mpl interactive plots for example: poles = np.array([[190,...
scripts/figures/ilm-residuals.py
def pole_removal(noise, poles=None, sig=3): """ Remove the noise poles from a 2d noise distribution to show that affects the real-space noise picture. noise -- fftshifted 2d array of q values poles -- N,2 list of pole locations. the last index is in the order y,x as determined by mpl int...
def pole_removal(noise, poles=None, sig=3): """ Remove the noise poles from a 2d noise distribution to show that affects the real-space noise picture. noise -- fftshifted 2d array of q values poles -- N,2 list of pole locations. the last index is in the order y,x as determined by mpl int...
[ "Remove", "the", "noise", "poles", "from", "a", "2d", "noise", "distribution", "to", "show", "that", "affects", "the", "real", "-", "space", "noise", "picture", ".", "noise", "--", "fftshifted", "2d", "array", "of", "q", "values" ]
peri-source/peri
python
https://github.com/peri-source/peri/blob/61beed5deaaf978ab31ed716e8470d86ba639867/scripts/figures/ilm-residuals.py#L52-L79
[ "def", "pole_removal", "(", "noise", ",", "poles", "=", "None", ",", "sig", "=", "3", ")", ":", "center", "=", "np", ".", "array", "(", "noise", ".", "shape", ")", "/", "2", "v", "=", "np", ".", "rollaxis", "(", "np", ".", "array", "(", "np", ...
61beed5deaaf978ab31ed716e8470d86ba639867
valid
Updates.pending
Returns an array of updates that are currently in the buffer for an individual social media profile.
buffpy/managers/updates.py
def pending(self): ''' Returns an array of updates that are currently in the buffer for an individual social media profile. ''' pending_updates = [] url = PATHS['GET_PENDING'] % self.profile_id response = self.api.get(url=url) for update in response['updates']: pending_update...
def pending(self): ''' Returns an array of updates that are currently in the buffer for an individual social media profile. ''' pending_updates = [] url = PATHS['GET_PENDING'] % self.profile_id response = self.api.get(url=url) for update in response['updates']: pending_update...
[ "Returns", "an", "array", "of", "updates", "that", "are", "currently", "in", "the", "buffer", "for", "an", "individual", "social", "media", "profile", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/updates.py#L28-L43
[ "def", "pending", "(", "self", ")", ":", "pending_updates", "=", "[", "]", "url", "=", "PATHS", "[", "'GET_PENDING'", "]", "%", "self", ".", "profile_id", "response", "=", "self", ".", "api", ".", "get", "(", "url", "=", "url", ")", "for", "update", ...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Updates.sent
Returns an array of updates that have been sent from the buffer for an individual social media profile.
buffpy/managers/updates.py
def sent(self): ''' Returns an array of updates that have been sent from the buffer for an individual social media profile. ''' sent_updates = [] url = PATHS['GET_SENT'] % self.profile_id response = self.api.get(url=url) for update in response['updates']: sent_updates.append(...
def sent(self): ''' Returns an array of updates that have been sent from the buffer for an individual social media profile. ''' sent_updates = [] url = PATHS['GET_SENT'] % self.profile_id response = self.api.get(url=url) for update in response['updates']: sent_updates.append(...
[ "Returns", "an", "array", "of", "updates", "that", "have", "been", "sent", "from", "the", "buffer", "for", "an", "individual", "social", "media", "profile", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/updates.py#L46-L61
[ "def", "sent", "(", "self", ")", ":", "sent_updates", "=", "[", "]", "url", "=", "PATHS", "[", "'GET_SENT'", "]", "%", "self", ".", "profile_id", "response", "=", "self", ".", "api", ".", "get", "(", "url", "=", "url", ")", "for", "update", "in", ...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075
valid
Updates.shuffle
Randomize the order at which statuses for the specified social media profile will be sent out of the buffer.
buffpy/managers/updates.py
def shuffle(self, count=None, utc=None): ''' Randomize the order at which statuses for the specified social media profile will be sent out of the buffer. ''' url = PATHS['SHUFFLE'] % self.profile_id post_data = '' if count: post_data += 'count=%s&' % count if utc: post_...
def shuffle(self, count=None, utc=None): ''' Randomize the order at which statuses for the specified social media profile will be sent out of the buffer. ''' url = PATHS['SHUFFLE'] % self.profile_id post_data = '' if count: post_data += 'count=%s&' % count if utc: post_...
[ "Randomize", "the", "order", "at", "which", "statuses", "for", "the", "specified", "social", "media", "profile", "will", "be", "sent", "out", "of", "the", "buffer", "." ]
vtemian/buffpy
python
https://github.com/vtemian/buffpy/blob/6c9236fd3b6a8f9e2d70dbf1bc01529242b73075/buffpy/managers/updates.py#L63-L77
[ "def", "shuffle", "(", "self", ",", "count", "=", "None", ",", "utc", "=", "None", ")", ":", "url", "=", "PATHS", "[", "'SHUFFLE'", "]", "%", "self", ".", "profile_id", "post_data", "=", "''", "if", "count", ":", "post_data", "+=", "'count=%s&'", "%"...
6c9236fd3b6a8f9e2d70dbf1bc01529242b73075