text stringlengths 81 112k |
|---|
Retrieve the ``value`` for the attribute ``name``. The ``name``
can be nested following the :ref:`double underscore <tutorial-underscore>`
notation, for example ``group__name``. If the attribute is not available it
raises :class:`AttributeError`.
def get_attr_value(self, name):
'''Retrieve the ``value`` for th... |
Utility method for cloning the instance as a new object.
:parameter data: additional which override field data.
:rtype: a new instance of this class.
def clone(self, **data):
'''Utility method for cloning the instance as a new object.
:parameter data: additional which override field data.
:rtype: a new insta... |
Return a dictionary of serialised scalar field for pickling.
If the *exclude_cache* flag is ``True``, fields with :attr:`Field.as_cache`
attribute set to ``True`` will be excluded.
def todict(self, exclude_cache=False):
'''Return a dictionary of serialised scalar field for pickling.
If the *exclude_cache* flag... |
Load extra fields to this :class:`StdModel`.
def load_fields(self, *fields):
'''Load extra fields to this :class:`StdModel`.'''
if self._loadedfields is not None:
if self.session is None:
raise SessionNotAvailable('No session available')
meta = self._meta
... |
Load a the :class:`ForeignKey` field ``name`` if this is part of the
fields of this model and if the related object is not already loaded.
It is used by the lazy loading mechanism of :ref:`one-to-many <one-to-many>`
relationships.
:parameter name: the :attr:`Field.name` of the :class:`ForeignKey` to load.
:parameter l... |
Load a :class:`StdModel` from possibly base64encoded data.
This method is used to load models from data obtained from the :meth:`tojson`
method.
def from_base64_data(cls, **kwargs):
'''Load a :class:`StdModel` from possibly base64encoded data.
This method is used to load models from data obtained from the :m... |
De-trend a K2 FITS file using :py:class:`everest.detrender.rPLD`.
:param str fitsfile: The full path to the FITS file
:param ndarray aperture: A 2D integer array corresponding to the \
desired photometric aperture (1 = in aperture, 0 = outside \
aperture). Default is to interactively sele... |
Returns a :py:obj:`DataContainer` instance with the
raw data for the target.
:param str fitsfile: The full raw target pixel file path
:param bool clobber: Overwrite existing files? Default :py:obj:`False`
:param float saturation_tolerance: Target is considered saturated \
if flux is within t... |
Returns the axis instance where the title will be printed
def title(self):
'''
Returns the axis instance where the title will be printed
'''
return self.title_left(on=False), self.title_center(on=False), \
self.title_right(on=False) |
Returns the axis instance where the footer will be printed
def footer(self):
'''
Returns the axis instance where the footer will be printed
'''
return self.footer_left(on=False), self.footer_center(on=False), \
self.footer_right(on=False) |
Returns the axis instance at the top right of the page,
where the postage stamp and aperture is displayed
def top_right(self):
'''
Returns the axis instance at the top right of the page,
where the postage stamp and aperture is displayed
'''
res = self.body_top_right[se... |
Returns the current axis instance on the left side of
the page where each successive light curve is displayed
def left(self):
'''
Returns the current axis instance on the left side of
the page where each successive light curve is displayed
'''
res = self.body_left[self... |
Returns the current axis instance on the right side of the
page, where cross-validation information is displayed
def right(self):
'''
Returns the current axis instance on the right side of the
page, where cross-validation information is displayed
'''
res = self.body_ri... |
Returns the axis instance where the light curves will be shown
def body(self):
'''
Returns the axis instance where the light curves will be shown
'''
res = self._body[self.bcount]()
self.bcount += 1
return res |
Calculate the Hash id of metaclass ``meta``
def hashmodel(model, library=None):
'''Calculate the Hash id of metaclass ``meta``'''
library = library or 'python-stdnet'
meta = model._meta
sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
hash = sha.hexdigest()[:8]
meta.hash = h... |
Bind a ``callback`` for a given ``sender``.
def bind(self, callback, sender=None):
'''Bind a ``callback`` for a given ``sender``.'''
key = (_make_id(callback), _make_id(sender))
self.callbacks.append((key, callback)) |
Fire callbacks from a ``sender``.
def fire(self, sender=None, **params):
'''Fire callbacks from a ``sender``.'''
keys = (_make_id(None), _make_id(sender))
results = []
for (_, key), callback in self.callbacks:
if key in keys:
results.append(callback(sel... |
Execute a command and return a parsed response
def execute_command(self, cmnd, *args, **options):
"Execute a command and return a parsed response"
args, options = self.preprocess_command(cmnd, *args, **options)
return self.client.execute_command(cmnd, *args, **options) |
Returns the 10th-90th percentile range of array :py:obj:`x`.
def _range10_90(x):
'''
Returns the 10th-90th percentile range of array :py:obj:`x`.
'''
x = np.delete(x, np.where(np.isnan(x)))
i = np.argsort(x)
a = int(0.1 * len(x))
b = int(0.9 * len(x))
return x[i][b] - x[i][a] |
Returns the campaign number(s) for a given EPIC target. If target
is not found, returns :py:obj:`None`.
:param int EPIC: The EPIC number of the target.
def Campaign(EPIC, **kwargs):
'''
Returns the campaign number(s) for a given EPIC target. If target
is not found, returns :py:obj:`None`.
:pa... |
Download and return a :py:obj:`dict` of all *K2* stars organized by
campaign. Saves each campaign to a `.stars` file in the
`everest/missions/k2/tables` directory.
:param bool clobber: If :py:obj:`True`, download and overwrite \
existing files. Default :py:obj:`False`
.. note:: The keys of ... |
Return all stars in a given *K2* campaign.
:param campaign: The *K2* campaign number. If this is an :py:class:`int`, \
returns all targets in that campaign. If a :py:class:`float` in \
the form :py:obj:`X.Y`, runs the :py:obj:`Y^th` decile of campaign \
:py:obj:`X`.
:param bool... |
Returns the channel number for a given EPIC target.
def Channel(EPIC, campaign=None):
'''
Returns the channel number for a given EPIC target.
'''
if campaign is None:
campaign = Campaign(EPIC)
if hasattr(campaign, '__len__'):
raise AttributeError(
"Please choose a camp... |
Returns the module number for a given EPIC target.
def Module(EPIC, campaign=None):
'''
Returns the module number for a given EPIC target.
'''
channel = Channel(EPIC, campaign=campaign)
nums = {2: 1, 3: 5, 4: 9, 6: 13, 7: 17, 8: 21, 9: 25,
10: 29, 11: 33, 12: 37, 13: 41, 14: 45, 15: 4... |
Returns the channels contained in the given K2 module.
def Channels(module):
'''
Returns the channels contained in the given K2 module.
'''
nums = {2: 1, 3: 5, 4: 9, 6: 13, 7: 17, 8: 21, 9: 25,
10: 29, 11: 33, 12: 37, 13: 41, 14: 45, 15: 49,
16: 53, 17: 57, 18: 61, 19: 65, 20:... |
Returns the *Kepler* magnitude for a given EPIC target.
def KepMag(EPIC, campaign=None):
'''
Returns the *Kepler* magnitude for a given EPIC target.
'''
if campaign is None:
campaign = Campaign(EPIC)
if hasattr(campaign, '__len__'):
raise AttributeError(
"Please choose... |
Returns :py:obj:`True` or :py:obj:`False`, indicating whether or not
to remove the background flux for the target. If ``campaign < 3``,
returns :py:obj:`True`, otherwise returns :py:obj:`False`.
def RemoveBackground(EPIC, campaign=None):
'''
Returns :py:obj:`True` or :py:obj:`False`, indicating whether... |
Returns all channels on the same module as :py:obj:`channel`.
def GetNeighboringChannels(channel):
'''
Returns all channels on the same module as :py:obj:`channel`.
'''
x = divmod(channel - 1, 4)[1]
return channel + np.array(range(-x, -x + 4), dtype=int) |
Detector location retrieval based upon RA and Dec.
Adapted from `PyKE <http://keplergo.arc.nasa.gov/PyKE.shtml>`_.
def MASTRADec(ra, dec, darcsec, stars_only=False):
'''
Detector location retrieval based upon RA and Dec.
Adapted from `PyKE <http://keplergo.arc.nasa.gov/PyKE.shtml>`_.
'''
# co... |
Convert sexadecimal hours to decimal degrees. Adapted from
`PyKE <http://keplergo.arc.nasa.gov/PyKE.shtml>`_.
:param float ra: The right ascension
:param float dec: The declination
:returns: The same values, but in decimal degrees
def sex2dec(ra, dec):
'''
Convert sexadecimal hours to decimal... |
Grabs the EPIC coordinates from the TPF and searches MAST
for other EPIC targets within the same aperture.
:param int ID: The 9-digit :py:obj:`EPIC` number of the target
:param float darcsec: The search radius in arcseconds. \
Default is four times the largest dimension of the aperture.
:par... |
Queries the Palomar Observatory Sky Survey II catalog to
obtain a higher resolution optical image of the star with EPIC number
:py:obj:`ID`.
def GetHiResImage(ID):
'''
Queries the Palomar Observatory Sky Survey II catalog to
obtain a higher resolution optical image of the star with EPIC number
... |
Returns the well depth for the target. If any of the target's pixels
have flux larger than this value, they are likely to be saturated and
cause charge bleeding. The well depths were obtained from Table 13
of the Kepler instrument handbook. We assume an exposure time of 6.02s.
def SaturationFlux(EPIC, camp... |
Returns the indices corresponding to a given light curve chunk.
:param int b: The index of the chunk to return
def GetChunk(time, breakpoints, b, mask=[]):
'''
Returns the indices corresponding to a given light curve chunk.
:param int b: The index of the chunk to return
'''
M = np.delete(np... |
Returns de-trended light curves for all stars on a given module in
a given campaign.
def GetStars(campaign, module, model='nPLD', **kwargs):
'''
Returns de-trended light curves for all stars on a given module in
a given campaign.
'''
# Get the channel numbers
channels = Channels(module)
... |
Applies :py:obj:`SysRem` to a given set of light curves.
:param array_like time: The time array for all of the light curves
:param array_like flux: A 2D array of the fluxes for each of the light \
curves, shape `(nfluxes, ntime)`
:param array_like err: A 2D array of the flux errors for each of t... |
Computes the CBVs for a given campaign.
:param int campaign: The campaign number
:param str model: The name of the :py:obj:`everest` model. Default `nPLD`
:param bool clobber: Overwrite existing files? Default `False`
def GetCBVs(campaign, model='nPLD', clobber=False, **kwargs):
'''
Computes the C... |
Load lua script from the stdnet/lib/lua directory
def read_lua_file(dotted_module, path=None, context=None):
'''Load lua script from the stdnet/lib/lua directory'''
path = path or DEFAULT_LUA_PATH
bits = dotted_module.split('.')
bits[-1] += '.lua'
name = os.path.join(path, *bits)
with ope... |
Parse the response of Redis's INFO command into a Python dict.
In doing so, convert byte data into unicode.
def parse_info(response):
'''Parse the response of Redis's INFO command into a Python dict.
In doing so, convert byte data into unicode.'''
info = {}
response = response.decode('utf-8')
d... |
Compute the difference of multiple sorted.
The difference of sets specified by ``keys`` into a new sorted set
in ``dest``.
def zdiffstore(self, dest, keys, withscores=False):
'''Compute the difference of multiple sorted.
The difference of sets specified by ``keys`` into a new so... |
Pop a range by rank.
def zpopbyrank(self, name, start, stop=None, withscores=False, desc=False):
'''Pop a range by rank.
'''
stop = stop if stop is not None else start
return self.execute_script('zpop', (name,), 'rank', start,
stop, int(desc), int... |
Delete an instance
def delete(self, instance):
'''Delete an instance'''
flushdb(self.client) if flushdb else self.client.flushdb() |
Return the log prior given parameter vector `x`.
def lnprior(x):
"""Return the log prior given parameter vector `x`."""
per, t0, b = x
if b < -1 or b > 1:
return -np.inf
elif per < 7 or per > 10:
return -np.inf
elif t0 < 1978 or t0 > 1979:
return -np.inf
else:
re... |
Return the log likelihood given parameter vector `x`.
def lnlike(x, star):
"""Return the log likelihood given parameter vector `x`."""
ll = lnprior(x)
if np.isinf(ll):
return ll, (np.nan, np.nan)
per, t0, b = x
model = TransitModel('b', per=per, t0=t0, b=b, rhos=10.)(star.time)
like, d,... |
username and email (if provided) must be unique.
def check_user(self, username, email):
'''username and email (if provided) must be unique.'''
users = self.router.user
avail = yield users.filter(username=username).count()
if avail:
raise FieldError('Username %s not available... |
Change the ``query`` so that only instances for which
``group`` has roles with permission on ``operations`` are returned.
def permitted_query(self, query, group, operations):
'''Change the ``query`` so that only instances for which
``group`` has roles with permission on ``operations`` are returned.'''
... |
Create a new :class:`Role` owned by this :class:`Subject`
def create_role(self, name):
'''Create a new :class:`Role` owned by this :class:`Subject`'''
models = self.session.router
return models.role.new(name=name, owner=self) |
Assign :class:`Role` ``role`` to this :class:`Subject`. If this
:class:`Subject` is the :attr:`Role.owner`, this method does nothing.
def assign(self, role):
'''Assign :class:`Role` ``role`` to this :class:`Subject`. If this
:class:`Subject` is the :attr:`Role.owner`, this method does nothing.'''
if ro... |
Check if this :class:`Subject` has permissions for ``operations``
on an ``object``. It returns the number of valid permissions.
def has_permissions(self, object, group, operations):
'''Check if this :class:`Subject` has permissions for ``operations``
on an ``object``. It returns the number of valid permissions... |
Add a new :class:`Permission` for ``resource`` to perform an
``operation``. The resource can be either an object or a model.
def add_permission(self, resource, operation):
'''Add a new :class:`Permission` for ``resource`` to perform an
``operation``. The resource can be either an object or a model.'''
... |
Initializes snow extension
Set config default and find out which client type to use
:param app: App passed from constructor or directly to init_app (factory)
:param session: requests-compatible session to pass along to init_app
:param parameters: `ParamsBuilder` object passed to `Clien... |
Snow connection instance, stores a `pysnow.Client` instance and `pysnow.Resource` instances
Creates a new :class:`pysnow.Client` object if it doesn't exist in the app slice of the context stack
:returns: :class:`pysnow.Client` object
def connection(self):
"""Snow connection instance, stores a... |
Print out a usage message
def usage():
"""Print out a usage message"""
global options
l = len(options['long'])
options['shortlist'] = [s for s in options['short'] if s is not ":"]
print("python -m behave2cucumber [-h] [-d level|--debug=level]")
for i in range(l):
print(" -{0}|--{1:... |
Main
def main(argv):
"""Main"""
global options
opts = None
try:
opts, args = getopt.getopt(argv, options['short'], options['long'])
except getopt.GetoptError:
usage()
exit(2)
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
exit... |
Return the direction vector of a cylinder defined
by the spherical coordinates theta and phi.
def direction(theta, phi):
'''Return the direction vector of a cylinder defined
by the spherical coordinates theta and phi.
'''
return np.array([np.cos(phi) * np.sin(theta), np.sin(phi) * np.sin(theta),
... |
Return the projection matrix of a direction w.
def projection_matrix(w):
'''Return the projection matrix of a direction w.'''
return np.identity(3) - np.dot(np.reshape(w, (3,1)), np.reshape(w, (1, 3))) |
Return the skew matrix of a direction w.
def skew_matrix(w):
'''Return the skew matrix of a direction w.'''
return np.array([[0, -w[2], w[1]],
[w[2], 0, -w[0]],
[-w[1], w[0], 0]]) |
Return the matrix A from a list of Y vectors.
def calc_A(Ys):
'''Return the matrix A from a list of Y vectors.'''
return sum(np.dot(np.reshape(Y, (3,1)), np.reshape(Y, (1, 3)))
for Y in Ys) |
Return the A_hat matrix of A given the skew matrix S
def calc_A_hat(A, S):
'''Return the A_hat matrix of A given the skew matrix S'''
return np.dot(S, np.dot(A, np.transpose(S))) |
Translate the center of mass (COM) of the data to the origin.
Return the prossed data and the shift of the COM
def preprocess_data(Xs_raw):
'''Translate the center of mass (COM) of the data to the origin.
Return the prossed data and the shift of the COM'''
n = len(Xs_raw)
Xs_raw_mean = sum(X for X ... |
Calculate the G function given a cylinder direction w and a
list of data points Xs to be fitted.
def G(w, Xs):
'''Calculate the G function given a cylinder direction w and a
list of data points Xs to be fitted.'''
n = len(Xs)
P = projection_matrix(w)
Ys = [np.dot(P, X) for X in Xs]
A = calc... |
Calculate the cylinder center given the cylinder direction and
a list of data points.
def C(w, Xs):
'''Calculate the cylinder center given the cylinder direction and
a list of data points.
'''
n = len(Xs)
P = projection_matrix(w)
Ys = [np.dot(P, X) for X in Xs]
A = calc_A(Ys)
A_ha... |
Calculate the radius given the cylinder direction and a list
of data points.
def r(w, Xs):
'''Calculate the radius given the cylinder direction and a list
of data points.
'''
n = len(Xs)
P = projection_matrix(w)
c = C(w, Xs)
return np.sqrt(sum(np.dot(c - X, np.dot(P, c - X)) for X in X... |
Fit a list of data points to a cylinder surface. The algorithm implemented
here is from David Eberly's paper "Fitting 3D Data with a Cylinder" from
https://www.geometrictools.com/Documentation/CylinderFitting.pdf
Arguments:
data - A list of 3D data points to be fitted.
guess_angles[0] - Gu... |
A Kafka client that publishes records to the Kafka cluster.
Keyword Arguments:
- ``bootstrap_servers``: 'host[:port]' string (or list of 'host[:port]'
strings) that the producer should contact to bootstrap initial
cluster metadata. This does not have to be the full node list.
... |
Publish a message to a topic.
- ``topic`` (str): topic where the message will be published
- ``value``: message value. Must be type bytes, or be serializable to bytes via configured value_serializer.
If value is None, key is required and message acts as a `delete`.
- ``timeout``
... |
Connect kafka consumer.
Keyword Arguments:
- ``bootstrap_servers``: 'host[:port]' string (or list of 'host[:port]'
strings) that the consumer should contact to bootstrap initial
cluster metadata. This does not have to be the full node list.
It just needs to have ... |
Assign a list of TopicPartitions to this consumer.
- ``partitions`` (list of `TopicPartition`): Assignment for this instance.
def assign_to_topic_partition(self, topic_partition=None):
"""Assign a list of TopicPartitions to this consumer.
- ``partitions`` (list of `TopicPartit... |
Subscribe to a list of topics, or a topic regex pattern.
- ``topics`` (list): List of topics for subscription.
- ``pattern`` (str): Pattern to match available topics. You must provide either topics or pattern,
but not both.
def subscribe_topic(self, topics=[], pattern=None):
... |
Return offset of the next record that will be fetched.
- ``topic_partition`` (TopicPartition): Partition to check
def get_position(self, topic_partition=None):
"""Return offset of the next record that will be fetched.
- ``topic_partition`` (TopicPartition): Partition to check
... |
Manually specify the fetch offset for a TopicPartition.
- ``offset``: Message offset in partition
- ``topic_partition`` (`TopicPartition`): Partition for seek operation
def seek(self, offset, topic_partition=None):
"""Manually specify the fetch offset for a TopicPartition.
... |
Seek to the oldest available offset for partitions.
- ``topic_partition``: Optionally provide specific TopicPartitions,
otherwise default to all assigned partitions.
def seek_to_beginning(self, topic_partition=None):
"""Seek to the oldest available offset for partitions.
... |
Seek to the most recent available offset for partitions.
- ``topic_partition``: Optionally provide specific `TopicPartitions`,
otherwise default to all assigned partitions.
def seek_to_end(self, topic_partition=None):
"""Seek to the most recent available offset for partitions.
... |
Retrun number of messages in topics.
- ``topics`` (list): list of topics.
def get_number_of_messages_in_topics(self, topics):
"""Retrun number of messages in topics.
- ``topics`` (list): list of topics.
"""
if not isinstance(topics, list):
topics =... |
Return number of messages in TopicPartition.
- ``topic_partition`` (list of TopicPartition)
def get_number_of_messages_in_topicpartition(self, topic_partition=None):
"""Return number of messages in TopicPartition.
- ``topic_partition`` (list of TopicPartition)
"""
... |
Fetch data from assigned topics / partitions.
- ``max_records`` (int): maximum number of records to poll. Default: Inherit value from max_poll_records.
- ``timeout_ms`` (int): Milliseconds spent waiting in poll if data is not available in the buffer.
If 0, returns immediately with any... |
Validate an email with the given key
def get(self, request, key):
"""Validate an email with the given key"""
try:
email_val = EmailAddressValidation.objects.get(validation_key=key)
except EmailAddressValidation.DoesNotExist:
messages.error(request, _('The email address ... |
Remove an email address, validated or not.
def delete(self, request, key):
"""Remove an email address, validated or not."""
request.DELETE = http.QueryDict(request.body)
email_addr = request.DELETE.get('email')
user_id = request.DELETE.get('user')
if not email_addr:
... |
Set an email address as primary address.
def update(self, request, key):
"""Set an email address as primary address."""
request.UPDATE = http.QueryDict(request.body)
email_addr = request.UPDATE.get('email')
user_id = request.UPDATE.get('user')
if not email_addr:
re... |
Check if a logged user is trying to access the register page.
If so, redirect him/her to his/her profile
def is_logged(self, user):
"""Check if a logged user is trying to access the register page.
If so, redirect him/her to his/her profile"""
response = None
if user.is_au... |
Get the environment setting or return exception
def get_env_setting(setting):
""" Get the environment setting or return exception """
try:
return os.environ[setting]
except KeyError:
error_msg = "Set the %s env variable" % setting
raise ImproperlyConfigured(error_msg) |
This function will use the custom JsonDecoder and the conventions.mappers to recreate your custom object
in the parse json string state just call this method with the json_string your complete object_type and with your
mappers dict.
the mappers dict must contain in the key the object_type (ex. User) and the... |
Verifies if a social account is valid.
Examples:
>>> validate_social_account('seocam', 'http://twitter.com')
True
>>> validate_social_account('seocam-fake-should-fail',
'http://twitter.com')
False
def validate_social_account(account, url):
"""Verifies if a soc... |
Calculate the RMSD of fitting.
def fitting_rmsd(w_fit, C_fit, r_fit, Xs):
'''Calculate the RMSD of fitting.'''
return np.sqrt(sum((geometry.point_line_distance(p, C_fit, w_fit) - r_fit) ** 2
for p in Xs) / len(Xs)) |
Iterator yielding unprefixed events.
Parameters:
- response: a stream response from requests
def basic_parse(response, buf_size=ijson.backend.BUFSIZE):
"""
Iterator yielding unprefixed events.
Parameters:
- response: a stream response from requests
"""
... |
Connect to kafka
- ``bootstrap_servers``: default 127.0.0.1:9092
- ``client_id``: default: Robot
def connect_to_kafka(self, bootstrap_servers='127.0.0.1:9092',
auto_offset_reset='latest',
client_id='Robot',
**kwargs
... |
Force server to close current client subscription connection to the server
@param str name: The name of the subscription
@param str database: The name of the database
def drop_connection(self, name, database=None):
"""
Force server to close current client subscription connection to the ... |
A simple method that runs a ManagementUtility.
def execute_from_command_line(argv=None):
"""
A simple method that runs a ManagementUtility.
"""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "colab.settings")
from django.conf import settings
if not hasattr(settings, 'SECRET_KEY') and 'initcon... |
Dashboard page
def dashboard(request):
"""Dashboard page"""
user = None
if request.user.is_authenticated():
user = User.objects.get(username=request.user)
latest_results, count_types = get_collaboration_data(user)
latest_results.sort(key=lambda elem: elem.modified, reverse=True)
cont... |
Normalize a vector based on its 2 norm.
def normalize(v):
'''Normalize a vector based on its 2 norm.'''
if 0 == np.linalg.norm(v):
return v
return v / np.linalg.norm(v) |
Calculate a rotation matrix from an axis and an angle.
def rotation_matrix_from_axis_and_angle(u, theta):
'''Calculate a rotation matrix from an axis and an angle.'''
x = u[0]
y = u[1]
z = u[2]
s = np.sin(theta)
c = np.cos(theta)
return np.array([[c + x**2 * (1 - c), x * y * (1 - ... |
Calculate the distance between a point and a line defined
by a point and a direction vector.
def point_line_distance(p, l_p, l_v):
'''Calculate the distance between a point and a line defined
by a point and a direction vector.
'''
l_v = normalize(l_v)
u = p - l_p
return np.linalg.norm(u - n... |
To get all the document that equal to the query
@param str query: The rql query
@param dict query_parameters: Add query parameters to the query {key : value}
def raw_query(self, query, query_parameters=None):
"""
To get all the document that equal to the query
@param str query... |
To get all the document that equal to the value in the given field_name
@param str field_name: The field name in the index you want to query.
@param value: The value will be the fields value you want to query
@param bool exact: If True getting exact match of the query
def where_equals(self, fi... |
To get all the document that equal to the value within kwargs with the specific key
@param bool exact: If True getting exact match of the query
@param kwargs: the keys of the kwargs will be the fields name in the index you want to query.
The value will be the the fields value you want to query
... |
For more complex text searching
@param str field_name: The field name in the index you want to query.
:type str
@param str search_terms: The terms you want to query
@param QueryOperator operator: OR or AND
def search(self, field_name, search_terms, operator=QueryOperator.OR):
"... |
To get all the document that ends with the value in the giving field_name
@param str field_name:The field name in the index you want to query.
@param str value: The value will be the fields value you want to query
def where_ends_with(self, field_name, value):
"""
To get all the documen... |
Check that the field has one of the specified values
@param str field_name: Name of the field
@param str values: The values we wish to query
@param bool exact: Getting the exact query (ex. case sensitive)
def where_in(self, field_name, values, exact=False):
"""
Check that the f... |
Query the facets results for this query using the specified list of facets with the given start and pageSize
@param List[Facet] facets: List of facets
@param int start: Start index for paging
@param page_size: Paging PageSize. If set, overrides Facet.max_result
def to_facets(self, facets, sta... |
Show the distribution of the G function.
def show_G_distribution(data):
'''Show the distribution of the G function.'''
Xs, t = fitting.preprocess_data(data)
Theta, Phi = np.meshgrid(np.linspace(0, np.pi, 50), np.linspace(0, 2 * np.pi, 50))
G = []
for i in range(len(Theta)):
G.append([])... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.