sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def text(self): """Get the entire text content as str""" divisions = list(self.divisions) if len(divisions) == 0: return '' elif len(divisions) == 1: return divisions[0].text.strip() else: return super().text
Get the entire text content as str
entailment
def _calculate(self, startingPercentage, endPercentage, startDate, endDate): """This is the error calculation function that gets called by :py:meth:`BaseErrorMeasure.get_error`. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. Th...
This is the error calculation function that gets called by :py:meth:`BaseErrorMeasure.get_error`. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. It represents the value, where the err...
entailment
def frequency(self, data_frame): """ This method returns the number of #taps divided by the test duration :param data_frame: the data frame :type data_frame: pandas.DataFrame :return frequency: frequency :rtype frequency: float """ fr...
This method returns the number of #taps divided by the test duration :param data_frame: the data frame :type data_frame: pandas.DataFrame :return frequency: frequency :rtype frequency: float
entailment
def moving_frequency(self, data_frame): """ This method returns moving frequency :param data_frame: the data frame :type data_frame: pandas.DataFrame :return diff_mov_freq: frequency :rtype diff_mov_freq: float """ f = [] for ...
This method returns moving frequency :param data_frame: the data frame :type data_frame: pandas.DataFrame :return diff_mov_freq: frequency :rtype diff_mov_freq: float
entailment
def continuous_frequency(self, data_frame): """ This method returns continuous frequency :param data_frame: the data frame :type data_frame: pandas.DataFrame :return cont_freq: frequency :rtype cont_freq: float """ tap_timestamps = da...
This method returns continuous frequency :param data_frame: the data frame :type data_frame: pandas.DataFrame :return cont_freq: frequency :rtype cont_freq: float
entailment
def mean_moving_time(self, data_frame): """ This method calculates the mean time (ms) that the hand was moving from one target to the next :param data_frame: the data frame :type data_frame: pandas.DataFrame :return mmt: the mean moving time in ms :rt...
This method calculates the mean time (ms) that the hand was moving from one target to the next :param data_frame: the data frame :type data_frame: pandas.DataFrame :return mmt: the mean moving time in ms :rtype mmt: float
entailment
def incoordination_score(self, data_frame): """ This method calculates the variance of the time interval in msec between taps :param data_frame: the data frame :type data_frame: pandas.DataFrame :return is: incoordination score :rtype is: float ...
This method calculates the variance of the time interval in msec between taps :param data_frame: the data frame :type data_frame: pandas.DataFrame :return is: incoordination score :rtype is: float
entailment
def mean_alnt_target_distance(self, data_frame): """ This method calculates the distance (number of pixels) between alternate tapping :param data_frame: the data frame :type data_frame: pandas.DataFrame :return matd: the mean alternate target distance in pixels ...
This method calculates the distance (number of pixels) between alternate tapping :param data_frame: the data frame :type data_frame: pandas.DataFrame :return matd: the mean alternate target distance in pixels :rtype matd: float
entailment
def kinesia_scores(self, data_frame): """ This method calculates the number of key taps :param data_frame: the data frame :type data_frame: pandas.DataFrame :return ks: key taps :rtype ks: float :return duration: test duration (seconds) ...
This method calculates the number of key taps :param data_frame: the data frame :type data_frame: pandas.DataFrame :return ks: key taps :rtype ks: float :return duration: test duration (seconds) :rtype duration: float
entailment
def akinesia_times(self, data_frame): """ This method calculates akinesia times, mean dwell time on each key in milliseconds :param data_frame: the data frame :type data_frame: pandas.DataFrame :return at: akinesia times :rtype at: float :...
This method calculates akinesia times, mean dwell time on each key in milliseconds :param data_frame: the data frame :type data_frame: pandas.DataFrame :return at: akinesia times :rtype at: float :return duration: test duration (seconds) :rtype du...
entailment
def dysmetria_score(self, data_frame): """ This method calculates accuracy of target taps in pixels :param data_frame: the data frame :type data_frame: pandas.DataFrame :return ds: dysmetria score in pixels :rtype ds: float """ tap_da...
This method calculates accuracy of target taps in pixels :param data_frame: the data frame :type data_frame: pandas.DataFrame :return ds: dysmetria score in pixels :rtype ds: float
entailment
def extract_features(self, data_frame, pre=''): """ This method extracts all the features available to the Finger Tapping Processor class. :param data_frame: the data frame :type data_frame: pandas.DataFrame :return: 'frequency', 'moving_frequency','continuous_fr...
This method extracts all the features available to the Finger Tapping Processor class. :param data_frame: the data frame :type data_frame: pandas.DataFrame :return: 'frequency', 'moving_frequency','continuous_frequency','mean_moving_time','incoordination_score', \ ...
entailment
def __train(self, n_neighbors=3): """ Train the classifier implementing the `k-nearest neighbors vote <http://scikit-learn.org/stable/modules/\ generated/sklearn.neighbors.KNeighborsClassifier.html>`_ :param n_clusters: the number of clusters :type n_clusters: in...
Train the classifier implementing the `k-nearest neighbors vote <http://scikit-learn.org/stable/modules/\ generated/sklearn.neighbors.KNeighborsClassifier.html>`_ :param n_clusters: the number of clusters :type n_clusters: int
entailment
def __get_features_for_observation(self, data_frame=None, observation='LA-LL', skip_id=None, last_column_is_id=False): """ Extract the features for a given observation from a data frame :param data_frame: data frame to get features from ...
Extract the features for a given observation from a data frame :param data_frame: data frame to get features from :type data_frame: pandas.DataFrame :param observation: observation name :type observation: string :param skip_id: skip any test with a given id (...
entailment
def predict(self, measurement, output_format='array'): """ Method to predict the class labels for the provided data :param measurement: the point to classify :type measurement: pandas.DataFrame :param output_format: the format to return the scores ('array' or 'st...
Method to predict the class labels for the provided data :param measurement: the point to classify :type measurement: pandas.DataFrame :param output_format: the format to return the scores ('array' or 'str') :type output_format: string :return prediction: the...
entailment
def _namify_arguments(mapping): """ Ensure that a mapping of names to parameters has the parameters set to the correct name. """ result = [] for name, parameter in mapping.iteritems(): parameter.name = name result.append(parameter) return result
Ensure that a mapping of names to parameters has the parameters set to the correct name.
entailment
def _merge_associative_list(alist, path, value): """ Merge a value into an associative list at the given path, maintaining insertion order. Examples will explain it:: >>> alist = [] >>> _merge_associative_list(alist, ["foo", "bar"], "barvalue") >>> _merge_associative_list(alist, ["f...
Merge a value into an associative list at the given path, maintaining insertion order. Examples will explain it:: >>> alist = [] >>> _merge_associative_list(alist, ["foo", "bar"], "barvalue") >>> _merge_associative_list(alist, ["foo", "baz"], "bazvalue") >>> alist == [("foo", [("bar...
entailment
def coerce(self, value): """Coerce a single value according to this parameter's settings. @param value: A L{str}, or L{None}. If L{None} is passed - meaning no value is avalable at all, not even the empty string - and this parameter is optional, L{self.default} will be returned....
Coerce a single value according to this parameter's settings. @param value: A L{str}, or L{None}. If L{None} is passed - meaning no value is avalable at all, not even the empty string - and this parameter is optional, L{self.default} will be returned.
entailment
def _check_range(self, value): """Check that the given C{value} is in the expected range.""" if self.min is None and self.max is None: return measure = self.measure(value) prefix = "Value (%s) for parameter %s is invalid. %s" if self.min is not None and measure < s...
Check that the given C{value} is in the expected range.
entailment
def parse(self, value): """ Convert a dictionary of {relative index: value} to a list of parsed C{value}s. """ indices = [] if not isinstance(value, dict): # We interpret non-list inputs as a list of one element, for # compatibility with certain EC...
Convert a dictionary of {relative index: value} to a list of parsed C{value}s.
entailment
def format(self, value): """ Convert a list like:: ["a", "b", "c"] to: {"1": "a", "2": "b", "3": "c"} C{value} may also be an L{Arguments} instance, mapping indices to values. Who knows why. """ if isinstance(value, Arguments): ...
Convert a list like:: ["a", "b", "c"] to: {"1": "a", "2": "b", "3": "c"} C{value} may also be an L{Arguments} instance, mapping indices to values. Who knows why.
entailment
def parse(self, value): """ Convert a dictionary of raw values to a dictionary of processed values. """ result = {} rest = {} for k, v in value.iteritems(): if k in self.fields: if (isinstance(v, dict) and not self.field...
Convert a dictionary of raw values to a dictionary of processed values.
entailment
def format(self, value): """ Convert a dictionary of processed values to a dictionary of raw values. """ if not isinstance(value, Arguments): value = value.iteritems() return dict((k, self.fields[k].format(v)) for k, v in value)
Convert a dictionary of processed values to a dictionary of raw values.
entailment
def _wrap(self, value): """Wrap the given L{tree} with L{Arguments} as necessary. @param tree: A {dict}, containing L{dict}s and/or leaf values, nested arbitrarily deep. """ if isinstance(value, dict): if any(isinstance(name, int) for name in value.keys()): ...
Wrap the given L{tree} with L{Arguments} as necessary. @param tree: A {dict}, containing L{dict}s and/or leaf values, nested arbitrarily deep.
entailment
def extract(self, params): """Extract parameters from a raw C{dict} according to this schema. @param params: The raw parameters to parse. @return: A tuple of an L{Arguments} object holding the extracted arguments and any unparsed arguments. """ structure = Structure(...
Extract parameters from a raw C{dict} according to this schema. @param params: The raw parameters to parse. @return: A tuple of an L{Arguments} object holding the extracted arguments and any unparsed arguments.
entailment
def bundle(self, *arguments, **extra): """Bundle the given arguments in a C{dict} with EC2-style format. @param arguments: L{Arguments} instances to bundle. Keys in later objects will override those in earlier objects. @param extra: Any number of additional parameters. These will ov...
Bundle the given arguments in a C{dict} with EC2-style format. @param arguments: L{Arguments} instances to bundle. Keys in later objects will override those in earlier objects. @param extra: Any number of additional parameters. These will override similarly named arguments in L{...
entailment
def get_parameter(self, name): """ Get the parameter on this schema with the given C{name}. """ for parameter in self._parameters: if parameter.name == name: return parameter
Get the parameter on this schema with the given C{name}.
entailment
def _convert_flat_to_nest(self, params): """ Convert a structure in the form of:: {'foo.1.bar': 'value', 'foo.2.baz': 'value'} to:: {'foo': {'1': {'bar': 'value'}, '2': {'baz': 'value'}}} This is intended for use both during p...
Convert a structure in the form of:: {'foo.1.bar': 'value', 'foo.2.baz': 'value'} to:: {'foo': {'1': {'bar': 'value'}, '2': {'baz': 'value'}}} This is intended for use both during parsing of HTTP arguments like 'foo.1.bar=value' and w...
entailment
def _convert_nest_to_flat(self, params, _result=None, _prefix=None): """ Convert a data structure that looks like:: {"foo": {"bar": "baz", "shimmy": "sham"}} to:: {"foo.bar": "baz", "foo.shimmy": "sham"} This is the inverse of L{_convert_flat_to_n...
Convert a data structure that looks like:: {"foo": {"bar": "baz", "shimmy": "sham"}} to:: {"foo.bar": "baz", "foo.shimmy": "sham"} This is the inverse of L{_convert_flat_to_nest}.
entailment
def extend(self, *schema_items, **kwargs): """ Add any number of schema items to a new schema. Takes the same arguments as the constructor, and returns a new L{Schema} instance. If parameters, result, or errors is specified, they will be merged with the existing paramet...
Add any number of schema items to a new schema. Takes the same arguments as the constructor, and returns a new L{Schema} instance. If parameters, result, or errors is specified, they will be merged with the existing parameters, result, or errors.
entailment
def _convert_old_schema(self, parameters): """ Convert an ugly old schema, using dotted names, to the hot new schema, using List and Structure. The old schema assumes that every other dot implies an array. So a list of two parameters, [Integer("foo.bar.baz.quux"), I...
Convert an ugly old schema, using dotted names, to the hot new schema, using List and Structure. The old schema assumes that every other dot implies an array. So a list of two parameters, [Integer("foo.bar.baz.quux"), Integer("foo.bar.shimmy")] becomes:: [List...
entailment
def _inner_convert_old_schema(self, node, depth): """ Internal recursion helper for L{_convert_old_schema}. @param node: A node in the associative list tree as described in _convert_old_schema. A two tuple of (name, parameter). @param depth: The depth that the node is at. Th...
Internal recursion helper for L{_convert_old_schema}. @param node: A node in the associative list tree as described in _convert_old_schema. A two tuple of (name, parameter). @param depth: The depth that the node is at. This is important to know if we're currently processing a li...
entailment
def wait_for_processes(processes, size, progress_queue, watcher, item): """ Watch progress queue for errors or progress. Cleanup processes on error or success. :param processes: [Process]: processes we are waiting to finish downloading a file :param size: int: how many values we expect to be process...
Watch progress queue for errors or progress. Cleanup processes on error or success. :param processes: [Process]: processes we are waiting to finish downloading a file :param size: int: how many values we expect to be processed by processes :param progress_queue: ProgressQueue: queue which will receive t...
entailment
def verify_file_private(filename): """ Raises ValueError the file permissions allow group/other On windows this never raises due to the implementation of stat. """ if platform.system().upper() != 'WINDOWS': filename = os.path.expanduser(filename) if os.path.exists(filename): ...
Raises ValueError the file permissions allow group/other On windows this never raises due to the implementation of stat.
entailment
def transferring_item(self, item, increment_amt=1): """ Update progress that item is about to be transferred. :param item: LocalFile, LocalFolder, or LocalContent(project) that is about to be sent. :param increment_amt: int amount to increase our count(how much progress have we made) ...
Update progress that item is about to be transferred. :param item: LocalFile, LocalFolder, or LocalContent(project) that is about to be sent. :param increment_amt: int amount to increase our count(how much progress have we made)
entailment
def finished(self): """ Must be called to print final progress label. """ self.progress_bar.set_state(ProgressBar.STATE_DONE) self.progress_bar.show()
Must be called to print final progress label.
entailment
def start_waiting(self): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. """ if not self.waiting: self.waiting = True wait_msg = "Waiting for project to become ready for {}".format(self.msg_verb) ...
Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state.
entailment
def done_waiting(self): """ Show running progress bar (only has an effect if we are in waiting state). """ if self.waiting: self.waiting = False self.progress_bar.show_running()
Show running progress bar (only has an effect if we are in waiting state).
entailment
def show_waiting(self, wait_msg): """ Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. :param wait_msg: str: message describing what we are waiting for """ self.wait_msg = wait_msg self.set_state(ProgressBar.ST...
Show waiting progress bar until done_waiting is called. Only has an effect if we are in waiting state. :param wait_msg: str: message describing what we are waiting for
entailment
def _visit_content(item, parent, visitor): """ Recursively visit nodes in the project tree. :param item: LocalContent/LocalFolder/LocalFile we are traversing down from :param parent: LocalContent/LocalFolder parent or None :param visitor: object visiting the tree """ ...
Recursively visit nodes in the project tree. :param item: LocalContent/LocalFolder/LocalFile we are traversing down from :param parent: LocalContent/LocalFolder parent or None :param visitor: object visiting the tree
entailment
def s3_url_context(service_endpoint, bucket=None, object_name=None): """ Create a URL based on the given service endpoint and suitable for the given bucket or object. @param service_endpoint: The service endpoint on which to base the resulting URL. @type service_endpoint: L{AWSServiceEndpoi...
Create a URL based on the given service endpoint and suitable for the given bucket or object. @param service_endpoint: The service endpoint on which to base the resulting URL. @type service_endpoint: L{AWSServiceEndpoint} @param bucket: If given, the name of a bucket to reference. @type bu...
entailment
def list_buckets(self): """ List all buckets. Returns a list of all the buckets owned by the authenticated sender of the request. """ details = self._details( method=b"GET", url_context=self._url_context(), ) query = self._query_fa...
List all buckets. Returns a list of all the buckets owned by the authenticated sender of the request.
entailment
def _parse_list_buckets(self, (response, xml_bytes)): """ Parse XML bucket list response. """ root = XML(xml_bytes) buckets = [] for bucket_data in root.find("Buckets"): name = bucket_data.findtext("Name") date_text = bucket_data.findtext("Creation...
Parse XML bucket list response.
entailment
def create_bucket(self, bucket): """ Create a new bucket. """ details = self._details( method=b"PUT", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) return self._submit(query)
Create a new bucket.
entailment
def delete_bucket(self, bucket): """ Delete a bucket. The bucket must be empty before it can be deleted. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket), ) query = self._query_factory(details) ...
Delete a bucket. The bucket must be empty before it can be deleted.
entailment
def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None): """ Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall ...
Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall results where the results of this call should begin. The first result i...
entailment
def get_bucket_location(self, bucket): """ Get the location (region) of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's region. """ details = self._details( method=b"GET", url_context=self._...
Get the location (region) of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's region.
entailment
def get_bucket_lifecycle(self, bucket): """ Get the lifecycle configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's lifecycle configuration. """ details = self._details( method=b"GET"...
Get the lifecycle configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's lifecycle configuration.
entailment
def _parse_lifecycle_config(self, (response, xml_bytes)): """Parse a C{LifecycleConfiguration} XML document.""" root = XML(xml_bytes) rules = [] for content_data in root.findall("Rule"): id = content_data.findtext("ID") prefix = content_data.findtext("Prefix") ...
Parse a C{LifecycleConfiguration} XML document.
entailment
def get_bucket_website_config(self, bucket): """ Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration. """ details = self._details( method=b"GET...
Get the website configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the bucket's website configuration.
entailment
def _parse_website_config(self, (response, xml_bytes)): """Parse a C{WebsiteConfiguration} XML document.""" root = XML(xml_bytes) index_suffix = root.findtext("IndexDocument/Suffix") error_key = root.findtext("ErrorDocument/Key") return WebsiteConfiguration(index_suffix, error_k...
Parse a C{WebsiteConfiguration} XML document.
entailment
def get_bucket_notification_config(self, bucket): """ Get the notification configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's notification configuration. """ details = self._details( ...
Get the notification configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's notification configuration.
entailment
def _parse_notification_config(self, (response, xml_bytes)): """Parse a C{NotificationConfiguration} XML document.""" root = XML(xml_bytes) topic = root.findtext("TopicConfiguration/Topic") event = root.findtext("TopicConfiguration/Event") return NotificationConfiguration(topic,...
Parse a C{NotificationConfiguration} XML document.
entailment
def get_bucket_versioning_config(self, bucket): """ Get the versioning configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's versioning configuration. """ details = self._details( method=b"GET...
Get the versioning configuration of a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will request the bucket's versioning configuration.
entailment
def _parse_versioning_config(self, (response, xml_bytes)): """Parse a C{VersioningConfiguration} XML document.""" root = XML(xml_bytes) mfa_delete = root.findtext("MfaDelete") status = root.findtext("Status") return VersioningConfiguration(mfa_delete=mfa_delete, status=status)
Parse a C{VersioningConfiguration} XML document.
entailment
def get_bucket_acl(self, bucket): """ Get the access control policy for a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name="?acl"), ) d = self._submit(self._query_factory(details)) ...
Get the access control policy for a bucket.
entailment
def put_object(self, bucket, object_name, data=None, content_type=None, metadata={}, amz_headers={}, body_producer=None): """ Put an object in a bucket. An existing object with the same name will be replaced. @param bucket: The name of the bucket. @param obje...
Put an object in a bucket. An existing object with the same name will be replaced. @param bucket: The name of the bucket. @param object_name: The name of the object. @type object_name: L{unicode} @param data: The data to write. @param content_type: The type of data bein...
entailment
def copy_object(self, source_bucket, source_object_name, dest_bucket=None, dest_object_name=None, metadata={}, amz_headers={}): """ Copy an object stored in S3 from a source bucket to a destination bucket. @param source_bucket: The S3 bucket to copy the object from. ...
Copy an object stored in S3 from a source bucket to a destination bucket. @param source_bucket: The S3 bucket to copy the object from. @param source_object_name: The name of the object to copy. @param dest_bucket: Optionally, the S3 bucket to copy the object to. Defaults to ...
entailment
def get_object(self, bucket, object_name): """ Get an object from a bucket. """ details = self._details( method=b"GET", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
Get an object from a bucket.
entailment
def head_object(self, bucket, object_name): """ Retrieve object metadata only. """ details = self._details( method=b"HEAD", url_context=self._url_context(bucket=bucket, object_name=object_name), ) d = self._submit(self._query_factory(details)) ...
Retrieve object metadata only.
entailment
def delete_object(self, bucket, object_name): """ Delete an object from a bucket. Once deleted, there is no method to restore or undelete an object. """ details = self._details( method=b"DELETE", url_context=self._url_context(bucket=bucket, object_name=ob...
Delete an object from a bucket. Once deleted, there is no method to restore or undelete an object.
entailment
def put_object_acl(self, bucket, object_name, access_control_policy): """ Set access control policy on an object. """ data = access_control_policy.to_xml() details = self._details( method=b"PUT", url_context=self._url_context( bucket=bucket...
Set access control policy on an object.
entailment
def put_request_payment(self, bucket, payer): """ Set request payment configuration on bucket to payer. @param bucket: The name of the bucket. @param payer: The name of the payer. @return: A C{Deferred} that will fire with the result of the request. """ data = Re...
Set request payment configuration on bucket to payer. @param bucket: The name of the bucket. @param payer: The name of the payer. @return: A C{Deferred} that will fire with the result of the request.
entailment
def get_request_payment(self, bucket): """ Get the request payment configuration on a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the name of the payer. """ details = self._details( method=b"GET", url_...
Get the request payment configuration on a bucket. @param bucket: The name of the bucket. @return: A C{Deferred} that will fire with the name of the payer.
entailment
def init_multipart_upload(self, bucket, object_name, content_type=None, amz_headers={}, metadata={}): """ Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Con...
Initiate a multipart upload to a bucket. @param bucket: The name of the bucket @param object_name: The object name @param content_type: The Content-Type for the object @param metadata: C{dict} containing additional metadata @param amz_headers: A C{dict} used to build C{x-amz-*} ...
entailment
def upload_part(self, bucket, object_name, upload_id, part_number, data=None, content_type=None, metadata={}, body_producer=None): """ Upload a part of data corresponding to a multipart upload. @param bucket: The bucket name @param object_name: Th...
Upload a part of data corresponding to a multipart upload. @param bucket: The bucket name @param object_name: The object name @param upload_id: The multipart upload id @param part_number: The part number @param data: Data (optional, requires body_producer if not specified) ...
entailment
def complete_multipart_upload(self, bucket, object_name, upload_id, parts_list, content_type=None, metadata={}): """ Complete a multipart upload. N.B. This can be possibly be a slow operation. @param bucket: The bucket name @param object_name: ...
Complete a multipart upload. N.B. This can be possibly be a slow operation. @param bucket: The bucket name @param object_name: The object name @param upload_id: The multipart upload id @param parts_list: A List of all the parts (2-tuples of part sequence number and ...
entailment
def set_content_type(self): """ Set the content type based on the file extension used in the object name. """ if self.object_name and not self.content_type: # XXX nothing is currently done with the encoding... we may # need to in the future sel...
Set the content type based on the file extension used in the object name.
entailment
def get_headers(self, instant): """ Build the list of headers needed in order to perform S3 operations. """ headers = {'x-amz-date': _auth_v4.makeAMZDate(instant)} if self.body_producer is None: data = self.data if data is None: data = b"" ...
Build the list of headers needed in order to perform S3 operations.
entailment
def sign(self, headers, data, url_context, instant, method, region=REGION_US_EAST_1): """Sign this query using its built in credentials.""" headers["host"] = url_context.get_encoded_host() if data is None: request = _auth_v4._CanonicalRequest.from_request_components( ...
Sign this query using its built in credentials.
entailment
def submit(self, url_context=None, utcnow=datetime.datetime.utcnow): """Submit this query. @return: A deferred from get_page """ if not url_context: url_context = s3_url_context( self.endpoint, self.bucket, self.object_name) d = self.get_page( ...
Submit this query. @return: A deferred from get_page
entailment
def attributes(self): if 'id' in self.node.attrib: yield PlaceholderAttribute('id', self.node.attrib['id']) if 'tei-tag' in self.node.attrib: yield PlaceholderAttribute('tei-tag', self.node.attrib['tei-tag']) """Contain attributes applicable to this element""" f...
Contain attributes applicable to this element
entailment
def divisions(self): """ Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision. """ from .placeholder_division import PlaceholderDivision pl...
Recursively get all the text divisions directly part of this element. If an element contains parts or text without tag. Those will be returned in order and wrapped with a TextDivision.
entailment
def all_parts(self): """ Recursively get the parts flattened and in document order constituting the entire text e.g. if something has emphasis, a footnote or is marked as foreign. Text without a container element will be returned in order and wrapped with a TextPart. """ for item in sel...
Recursively get the parts flattened and in document order constituting the entire text e.g. if something has emphasis, a footnote or is marked as foreign. Text without a container element will be returned in order and wrapped with a TextPart.
entailment
def parts(self): """ Get the parts directly below this element. """ for item in self.__parts_and_divisions: if item.tag == 'part': yield item else: # Divisions shouldn't be beneath a part, but here's a fallback # fo...
Get the parts directly below this element.
entailment
def __parts_and_divisions(self): """ The parts and divisions directly part of this element. """ from .division import Division from .part import Part from .placeholder_part import PlaceholderPart text = self.node.text if text: stripped_text =...
The parts and divisions directly part of this element.
entailment
def tostring(self, inject): """ Convert an element to a single string and allow the passed inject method to place content before any element. """ return inject(self, '\n'.join(f'{division.tostring(inject)}' for division in self.divisions))
Convert an element to a single string and allow the passed inject method to place content before any element.
entailment
def RCL(input_shape, rec_conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (tuple): The shape of the input layer. output_nodes (int): Number of...
Summary Args: input_shape (tuple): The shape of the input layer. output_nodes (int): Number of nodes in the output layer. It depends on the loss function used. rec_conv_layers (list): RCL descriptor [ [ ...
entailment
def VOICE(input_shape, conv_layers, dense_layers, output_layer=[1, 'sigmoid'], padding='same', optimizer='adam', loss='binary_crossentropy'): """Conv1D CNN used primarily for voice data. Args: input_shape (tuple): The shape of the i...
Conv1D CNN used primarily for voice data. Args: input_shape (tuple): The shape of the input layer targets (int): Number of targets conv_layers (list): Conv layer descriptor [[(filter, kernel), (pool_size, stride), leak, drop], ... []] dense_layers (TYPE): Dense layer descriptor ...
entailment
def DNN(input_shape, dense_layers, output_layer=[1, 'sigmoid'], optimizer='adam', loss='binary_crossentropy'): """Summary Args: input_shape (list): The shape of the input layer targets (int): Number of targets dense_layers (list): Dense la...
Summary Args: input_shape (list): The shape of the input layer targets (int): Number of targets dense_layers (list): Dense layer descriptor [fully_connected] optimizer (str or object optional): Keras optimizer as string or keras optimizer Returns: TYPE: model, b...
entailment
def initialize(self, originalTimeSeries, calculatedTimeSeries): """Initializes the ErrorMeasure. During initialization, all :py:meth:`BaseErrorMeasure.local_errors` are calculated. :param TimeSeries originalTimeSeries: TimeSeries containing the original data. :param TimeSeries calcu...
Initializes the ErrorMeasure. During initialization, all :py:meth:`BaseErrorMeasure.local_errors` are calculated. :param TimeSeries originalTimeSeries: TimeSeries containing the original data. :param TimeSeries calculatedTimeSeries: TimeSeries containing calculated data. Calc...
entailment
def _get_error_values(self, startingPercentage, endPercentage, startDate, endDate): """Gets the defined subset of self._errorValues. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. ...
Gets the defined subset of self._errorValues. Both parameters will be correct at this time. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. It represents the value, where the error calculation should be started. 25.0 f...
entailment
def get_error(self, startingPercentage=0.0, endPercentage=100.0, startDate=None, endDate=None): """Calculates the error for the given interval (startingPercentage, endPercentage) between the TimeSeries given during :py:meth:`BaseErrorMeasure.initialize`. :param float startingPercentage: Defines...
Calculates the error for the given interval (startingPercentage, endPercentage) between the TimeSeries given during :py:meth:`BaseErrorMeasure.initialize`. :param float startingPercentage: Defines the start of the interval. This has to be a value in [0.0, 100.0]. It represents the value, wh...
entailment
def confidence_interval(self, confidenceLevel): """Calculates for which value confidenceLevel% of the errors are closer to 0. :param float confidenceLevel: percentage of the errors that should be smaller than the returned value for overestimations and larger than the returned va...
Calculates for which value confidenceLevel% of the errors are closer to 0. :param float confidenceLevel: percentage of the errors that should be smaller than the returned value for overestimations and larger than the returned value for underestimations. confidenceLevel has t...
entailment
def load_cloudupdrs_data(filename, convert_times=1000000000.0): """ This method loads data in the cloudupdrs format Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, x_0, y_0, z_0 timestamp_1, x_1...
This method loads data in the cloudupdrs format Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, x_0, y_0, z_0 timestamp_1, x_1, y_1, z_1 timestamp_2, x_2, y_2, z_2 . . ....
entailment
def load_segmented_data(filename): """ Helper function to load segmented gait time series data. :param filename: The full path of the file that contais our data. This should be a comma separated value (csv file). :type filename: str :return: The gait time series segmented data, wit...
Helper function to load segmented gait time series data. :param filename: The full path of the file that contais our data. This should be a comma separated value (csv file). :type filename: str :return: The gait time series segmented data, with a x, y, z, mag_acc_sum and segmented columns. ...
entailment
def load_mpower_data(filename, convert_times=1000000000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format The format is like: .. code-block:: json [ { "timestamp":...
This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format The format is like: .. code-block:: json [ { "timestamp":19298.67999479167, "x": ... , "y": ..., ...
entailment
def load_finger_tapping_cloudupdrs_data(filename, convert_times=1000.0): """ This method loads data in the cloudupdrs format for the finger tapping processor Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, . , action_ty...
This method loads data in the cloudupdrs format for the finger tapping processor Usually the data will be saved in a csv file and it should look like this: .. code-block:: json timestamp_0, . , action_type_0, x_0, y_0, . , . , x_target_0, y_target_0 timestamp_1, . , action_type_1, x...
entailment
def load_finger_tapping_mpower_data(filename, button_left_rect, button_right_rect, convert_times=1000.0): """ This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format """ raw_data = pd.read_json(filename) date_times = pd.to_datetime(raw_data.TapTi...
This method loads data in the `mpower <https://www.synapse.org/#!Synapse:syn4993293/wiki/247859>`_ format
entailment
def load_data(filename, format_file='cloudupdrs', button_left_rect=None, button_right_rect=None): """ This is a general load data method where the format of data to load can be passed as a parameter, :param filename: The path to load data from :type filename: str :param format_file:...
This is a general load data method where the format of data to load can be passed as a parameter, :param filename: The path to load data from :type filename: str :param format_file: format of the file. Default is CloudUPDRS. Set to mpower for mpower data. :type format_file: str ...
entailment
def numerical_integration(signal, sampling_frequency): """ Numerically integrate a signal with it's sampling frequency. :param signal: A 1-dimensional array or list (the signal). :type signal: array :param sampling_frequency: The sampling frequency for the signal. :type samp...
Numerically integrate a signal with it's sampling frequency. :param signal: A 1-dimensional array or list (the signal). :type signal: array :param sampling_frequency: The sampling frequency for the signal. :type sampling_frequency: float :return: The integrated signal. :...
entailment
def autocorrelation(signal): """ The `correlation <https://en.wikipedia.org/wiki/Autocorrelation#Estimation>`_ of a signal with a delayed copy of itself. :param signal: A 1-dimensional array or list (the signal). :type signal: array :return: The autocorrelated signal. :rtyp...
The `correlation <https://en.wikipedia.org/wiki/Autocorrelation#Estimation>`_ of a signal with a delayed copy of itself. :param signal: A 1-dimensional array or list (the signal). :type signal: array :return: The autocorrelated signal. :rtype: numpy.ndarray
entailment
def peakdet(signal, delta, x=None): """ Find the local maxima and minima (peaks) in a 1-dimensional signal. Converted from MATLAB script <http://billauer.co.il/peakdet.html> :param array signal: A 1-dimensional array or list (the signal). :type signal: array :param delta: Th...
Find the local maxima and minima (peaks) in a 1-dimensional signal. Converted from MATLAB script <http://billauer.co.il/peakdet.html> :param array signal: A 1-dimensional array or list (the signal). :type signal: array :param delta: The peak threashold. A point is considered a maximum p...
entailment
def compute_interpeak(data, sample_rate): """ Compute number of samples between signal peaks using the real part of FFT. :param data: 1-dimensional time series data. :type data: array :param sample_rate: Sample rate of accelerometer reading (Hz) :type sample_rate: float ...
Compute number of samples between signal peaks using the real part of FFT. :param data: 1-dimensional time series data. :type data: array :param sample_rate: Sample rate of accelerometer reading (Hz) :type sample_rate: float :return interpeak: Number of samples between peaks ...
entailment
def butter_lowpass_filter(data, sample_rate, cutoff=10, order=4, plot=False): """ `Low-pass filter <http://stackoverflow.com/questions/25191620/ creating-lowpass-filter-in-scipy-understanding-methods-and-units>`_ data by the [order]th order zero lag Butterworth filter whose cut frequency is ...
`Low-pass filter <http://stackoverflow.com/questions/25191620/ creating-lowpass-filter-in-scipy-understanding-methods-and-units>`_ data by the [order]th order zero lag Butterworth filter whose cut frequency is set to [cutoff] Hz. :param data: time-series data, :type data: numpy array of...
entailment
def crossings_nonzero_pos2neg(data): """ Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_. :param data: numpy array of floats :type data: numpy array of floats :return crossings:...
Find `indices of zero crossings from positive to negative values <http://stackoverflow.com/questions/3843017/efficiently-detect-sign-changes-in-python>`_. :param data: numpy array of floats :type data: numpy array of floats :return crossings: crossing indices to data :rtype crossings: n...
entailment
def autocorrelate(data, unbias=2, normalize=2): """ Compute the autocorrelation coefficients for time series data. Here we use scipy.signal.correlate, but the results are the same as in Yang, et al., 2012 for unbias=1: "The autocorrelation coefficient refers to the correlation of a...
Compute the autocorrelation coefficients for time series data. Here we use scipy.signal.correlate, but the results are the same as in Yang, et al., 2012 for unbias=1: "The autocorrelation coefficient refers to the correlation of a time series with its own past or future values. iGAIT u...
entailment
def get_signal_peaks_and_prominences(data): """ Get the signal peaks and peak prominences. :param data array: One-dimensional array. :return peaks array: The peaks of our signal. :return prominences array: The prominences of the peaks. """ peaks, _ = sig.find_peaks(...
Get the signal peaks and peak prominences. :param data array: One-dimensional array. :return peaks array: The peaks of our signal. :return prominences array: The prominences of the peaks.
entailment
def smoothing_window(data, window=[1, 1, 1]): """ This is a smoothing functionality so we can fix misclassifications. It will run a sliding window of form [border, smoothing, border] on the signal and if the border elements are the same it will change the smooth elements to match the border...
This is a smoothing functionality so we can fix misclassifications. It will run a sliding window of form [border, smoothing, border] on the signal and if the border elements are the same it will change the smooth elements to match the border. An example would be for a window of [2, 1, 2...
entailment
def plot_segmentation(data, peaks, segment_indexes, figsize=(10, 5)): """ Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-...
Will plot the data and segmentation based on the peaks and segment indexes. :param 1d-array data: The orginal axis of the data that was segmented into sections. :param 1d-array peaks: Peaks of the data. :param 1d-array segment_indexes: These are the different classes, corresponding to each ...
entailment