Search is not available for this dataset
text stringlengths 75 104k |
|---|
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 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 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 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 _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 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 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 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 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 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 _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 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 _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 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_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 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 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(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 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_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 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 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 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 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 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 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_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 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 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 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 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 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 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 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 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 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 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 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 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 _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 _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 _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 _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 _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 _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 _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 _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 _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 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 resolve_admin_type(admin):
"""Determine admin type."""
if admin is current_user or isinstance(admin, UserMixin):
return 'User'
else:
return admin.__class__.__name__ |
def validate(cls, policy):
"""Validate subscription policy value."""
return policy in [cls.OPEN, cls.APPROVAL, cls.CLOSED] |
def validate(cls, policy):
"""Validate privacy policy value."""
return policy in [cls.PUBLIC, cls.MEMBERS, cls.ADMINS] |
def validate(cls, state):
"""Validate state value."""
return state in [cls.ACTIVE, cls.PENDING_ADMIN, cls.PENDING_USER] |
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 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 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 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 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_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 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 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 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_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 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 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 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_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 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 _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 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_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_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_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 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 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 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 delete(cls, group, user):
"""Delete membership."""
with db.session.begin_nested():
cls.query.filter_by(group=group, user_id=user.get_id()).delete() |
def accept(self):
"""Activate membership."""
with db.session.begin_nested():
self.state = MembershipState.ACTIVE
db.session.merge(self) |
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 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 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 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_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 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 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 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 _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 _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 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 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 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 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 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 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 delete(self):
'''
Permanently delete an existing status update.
'''
url = PATHS['DELETE'] % self.id
return self.api.post(url=url) |
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 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 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 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 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_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.