body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def gsr(epi_data, mask, direction='y', ref_file=None, out_file=None): '\n Computes the :abbr:`GSR (ghost to signal ratio)` [Giannelli2010]_. The\n procedure is as follows:\n\n #. Create a Nyquist ghost mask by circle-shifting the original mask by :math:`N/2`.\n\n #. Rotate by :math:`N/2`\n\n #....
1,144,839,233,202,535,200
Computes the :abbr:`GSR (ghost to signal ratio)` [Giannelli2010]_. The procedure is as follows: #. Create a Nyquist ghost mask by circle-shifting the original mask by :math:`N/2`. #. Rotate by :math:`N/2` #. Remove the intersection with the original mask #. Generate a non-ghost background #. Calculate th...
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py
gsr
amakropoulos/structural-pipeline-measures
python
def gsr(epi_data, mask, direction='y', ref_file=None, out_file=None): '\n Computes the :abbr:`GSR (ghost to signal ratio)` [Giannelli2010]_. The\n procedure is as follows:\n\n #. Create a Nyquist ghost mask by circle-shifting the original mask by :math:`N/2`.\n\n #. Rotate by :math:`N/2`\n\n #....
def dvars(func, mask, output_all=False, out_file=None): '\n Compute the mean :abbr:`DVARS (D referring to temporal\n derivative of timecourses, VARS referring to RMS variance over voxels)`\n [Power2012]_.\n\n Particularly, the *standardized* :abbr:`DVARS (D referring to temporal\n derivative of timec...
8,815,339,491,648,703,000
Compute the mean :abbr:`DVARS (D referring to temporal derivative of timecourses, VARS referring to RMS variance over voxels)` [Power2012]_. Particularly, the *standardized* :abbr:`DVARS (D referring to temporal derivative of timecourses, VARS referring to RMS variance over voxels)` [Nichols2013]_ are computed. .. no...
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py
dvars
amakropoulos/structural-pipeline-measures
python
def dvars(func, mask, output_all=False, out_file=None): '\n Compute the mean :abbr:`DVARS (D referring to temporal\n derivative of timecourses, VARS referring to RMS variance over voxels)`\n [Power2012]_.\n\n Particularly, the *standardized* :abbr:`DVARS (D referring to temporal\n derivative of timec...
def fd_jenkinson(in_file, rmax=80.0, out_file=None): '\n Compute the :abbr:`FD (framewise displacement)` [Jenkinson2002]_\n on a 4D dataset, after ``3dvolreg`` has been executed\n (generally a file named ``*.affmat12.1D``).\n\n :param str in_file: path to epi file\n :param float rmax: the default rad...
7,429,434,850,716,944,000
Compute the :abbr:`FD (framewise displacement)` [Jenkinson2002]_ on a 4D dataset, after ``3dvolreg`` has been executed (generally a file named ``*.affmat12.1D``). :param str in_file: path to epi file :param float rmax: the default radius (as in FSL) of a sphere represents the brain in which the angular displacements...
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py
fd_jenkinson
amakropoulos/structural-pipeline-measures
python
def fd_jenkinson(in_file, rmax=80.0, out_file=None): '\n Compute the :abbr:`FD (framewise displacement)` [Jenkinson2002]_\n on a 4D dataset, after ``3dvolreg`` has been executed\n (generally a file named ``*.affmat12.1D``).\n\n :param str in_file: path to epi file\n :param float rmax: the default rad...
def gcor(func, mask): '\n Compute the :abbr:`GCOR (global correlation)`.\n\n :param numpy.ndarray func: input fMRI dataset, after motion correction\n :param numpy.ndarray mask: 3D brain mask\n :return: the computed GCOR value\n\n ' tv_mask = zero_variance(func, mask) idx = np.where((tv_mask >...
1,447,277,806,473,772,000
Compute the :abbr:`GCOR (global correlation)`. :param numpy.ndarray func: input fMRI dataset, after motion correction :param numpy.ndarray mask: 3D brain mask :return: the computed GCOR value
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py
gcor
amakropoulos/structural-pipeline-measures
python
def gcor(func, mask): '\n Compute the :abbr:`GCOR (global correlation)`.\n\n :param numpy.ndarray func: input fMRI dataset, after motion correction\n :param numpy.ndarray mask: 3D brain mask\n :return: the computed GCOR value\n\n ' tv_mask = zero_variance(func, mask) idx = np.where((tv_mask >...
def zero_variance(func, mask): '\n Mask out voxels with zero variance across t-axis\n\n :param numpy.ndarray func: input fMRI dataset, after motion correction\n :param numpy.ndarray mask: 3D brain mask\n :return: the 3D mask of voxels with nonzero variance across :math:`t`.\n :rtype: numpy.ndarray\n\...
7,738,469,890,951,027,000
Mask out voxels with zero variance across t-axis :param numpy.ndarray func: input fMRI dataset, after motion correction :param numpy.ndarray mask: 3D brain mask :return: the 3D mask of voxels with nonzero variance across :math:`t`. :rtype: numpy.ndarray
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py
zero_variance
amakropoulos/structural-pipeline-measures
python
def zero_variance(func, mask): '\n Mask out voxels with zero variance across t-axis\n\n :param numpy.ndarray func: input fMRI dataset, after motion correction\n :param numpy.ndarray mask: 3D brain mask\n :return: the 3D mask of voxels with nonzero variance across :math:`t`.\n :rtype: numpy.ndarray\n\...
def main(): 'Run administrative tasks.' os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tutotrial.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError("Couldn't import Django. Are you sure it's installed and available ...
6,364,296,494,956,147,000
Run administrative tasks.
tutorial/manage.py
main
aiueocode/djangorest
python
def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tutotrial.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError("Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environm...
def forget(self): 'Forget about (and possibly remove the result of) this task.' self._cache = None self.backend.forget(self.id)
8,274,503,778,675,953,000
Forget about (and possibly remove the result of) this task.
venv/lib/python2.7/site-packages/celery/result.py
forget
CharleyFarley/ovvio
python
def forget(self): self._cache = None self.backend.forget(self.id)
def revoke(self, connection=None, terminate=False, signal=None, wait=False, timeout=None): 'Send revoke signal to all workers.\n\n Any worker receiving the task, or having reserved the\n task, *must* ignore it.\n\n :keyword terminate: Also terminate the process currently working\n on...
257,758,433,628,583,740
Send revoke signal to all workers. Any worker receiving the task, or having reserved the task, *must* ignore it. :keyword terminate: Also terminate the process currently working on the task (if any). :keyword signal: Name of signal to send to process if terminate. Default is TERM. :keyword wait: Wait for repl...
venv/lib/python2.7/site-packages/celery/result.py
revoke
CharleyFarley/ovvio
python
def revoke(self, connection=None, terminate=False, signal=None, wait=False, timeout=None): 'Send revoke signal to all workers.\n\n Any worker receiving the task, or having reserved the\n task, *must* ignore it.\n\n :keyword terminate: Also terminate the process currently working\n on...
def get(self, timeout=None, propagate=True, interval=0.5, no_ack=True, follow_parents=True, EXCEPTION_STATES=states.EXCEPTION_STATES, PROPAGATE_STATES=states.PROPAGATE_STATES): 'Wait until task is ready, and return its result.\n\n .. warning::\n\n Waiting for tasks within a task may lead to deadloc...
7,289,805,622,543,313,000
Wait until task is ready, and return its result. .. warning:: Waiting for tasks within a task may lead to deadlocks. Please read :ref:`task-synchronous-subtasks`. :keyword timeout: How long to wait, in seconds, before the operation times out. :keyword propagate: Re-raise exception if the task...
venv/lib/python2.7/site-packages/celery/result.py
get
CharleyFarley/ovvio
python
def get(self, timeout=None, propagate=True, interval=0.5, no_ack=True, follow_parents=True, EXCEPTION_STATES=states.EXCEPTION_STATES, PROPAGATE_STATES=states.PROPAGATE_STATES): 'Wait until task is ready, and return its result.\n\n .. warning::\n\n Waiting for tasks within a task may lead to deadloc...
def collect(self, intermediate=False, **kwargs): 'Iterator, like :meth:`get` will wait for the task to complete,\n but will also follow :class:`AsyncResult` and :class:`ResultSet`\n returned by the task, yielding ``(result, value)`` tuples for each\n result in the tree.\n\n An example wo...
2,989,732,586,260,419,600
Iterator, like :meth:`get` will wait for the task to complete, but will also follow :class:`AsyncResult` and :class:`ResultSet` returned by the task, yielding ``(result, value)`` tuples for each result in the tree. An example would be having the following tasks: .. code-block:: python from celery import group ...
venv/lib/python2.7/site-packages/celery/result.py
collect
CharleyFarley/ovvio
python
def collect(self, intermediate=False, **kwargs): 'Iterator, like :meth:`get` will wait for the task to complete,\n but will also follow :class:`AsyncResult` and :class:`ResultSet`\n returned by the task, yielding ``(result, value)`` tuples for each\n result in the tree.\n\n An example wo...
def ready(self): 'Returns :const:`True` if the task has been executed.\n\n If the task is still running, pending, or is waiting\n for retry then :const:`False` is returned.\n\n ' return (self.state in self.backend.READY_STATES)
7,264,632,802,835,550,000
Returns :const:`True` if the task has been executed. If the task is still running, pending, or is waiting for retry then :const:`False` is returned.
venv/lib/python2.7/site-packages/celery/result.py
ready
CharleyFarley/ovvio
python
def ready(self): 'Returns :const:`True` if the task has been executed.\n\n If the task is still running, pending, or is waiting\n for retry then :const:`False` is returned.\n\n ' return (self.state in self.backend.READY_STATES)
def successful(self): 'Returns :const:`True` if the task executed successfully.' return (self.state == states.SUCCESS)
4,838,101,157,056,682,000
Returns :const:`True` if the task executed successfully.
venv/lib/python2.7/site-packages/celery/result.py
successful
CharleyFarley/ovvio
python
def successful(self): return (self.state == states.SUCCESS)
def failed(self): 'Returns :const:`True` if the task failed.' return (self.state == states.FAILURE)
3,617,739,404,020,108,000
Returns :const:`True` if the task failed.
venv/lib/python2.7/site-packages/celery/result.py
failed
CharleyFarley/ovvio
python
def failed(self): return (self.state == states.FAILURE)
def __str__(self): '`str(self) -> self.id`' return str(self.id)
4,040,552,640,130,330,600
`str(self) -> self.id`
venv/lib/python2.7/site-packages/celery/result.py
__str__
CharleyFarley/ovvio
python
def __str__(self): return str(self.id)
def __hash__(self): '`hash(self) -> hash(self.id)`' return hash(self.id)
1,800,964,682,614,371,300
`hash(self) -> hash(self.id)`
venv/lib/python2.7/site-packages/celery/result.py
__hash__
CharleyFarley/ovvio
python
def __hash__(self): return hash(self.id)
@property def result(self): 'When the task has been executed, this contains the return value.\n If the task raised an exception, this will be the exception\n instance.' return self._get_task_meta()['result']
1,858,990,990,539,996,000
When the task has been executed, this contains the return value. If the task raised an exception, this will be the exception instance.
venv/lib/python2.7/site-packages/celery/result.py
result
CharleyFarley/ovvio
python
@property def result(self): 'When the task has been executed, this contains the return value.\n If the task raised an exception, this will be the exception\n instance.' return self._get_task_meta()['result']
@property def traceback(self): 'Get the traceback of a failed task.' return self._get_task_meta().get('traceback')
3,479,075,735,694,560,000
Get the traceback of a failed task.
venv/lib/python2.7/site-packages/celery/result.py
traceback
CharleyFarley/ovvio
python
@property def traceback(self): return self._get_task_meta().get('traceback')
@property def state(self): 'The tasks current state.\n\n Possible values includes:\n\n *PENDING*\n\n The task is waiting for execution.\n\n *STARTED*\n\n The task has been started.\n\n *RETRY*\n\n The task is to be retried, possibl...
-8,797,558,300,920,828,000
The tasks current state. Possible values includes: *PENDING* The task is waiting for execution. *STARTED* The task has been started. *RETRY* The task is to be retried, possibly because of failure. *FAILURE* The task raised an exception, or has exceeded the retry ...
venv/lib/python2.7/site-packages/celery/result.py
state
CharleyFarley/ovvio
python
@property def state(self): 'The tasks current state.\n\n Possible values includes:\n\n *PENDING*\n\n The task is waiting for execution.\n\n *STARTED*\n\n The task has been started.\n\n *RETRY*\n\n The task is to be retried, possibl...
@property def task_id(self): 'compat alias to :attr:`id`' return self.id
-4,713,316,254,543,998,000
compat alias to :attr:`id`
venv/lib/python2.7/site-packages/celery/result.py
task_id
CharleyFarley/ovvio
python
@property def task_id(self): return self.id
def add(self, result): 'Add :class:`AsyncResult` as a new member of the set.\n\n Does nothing if the result is already a member.\n\n ' if (result not in self.results): self.results.append(result)
2,171,822,964,541,988,000
Add :class:`AsyncResult` as a new member of the set. Does nothing if the result is already a member.
venv/lib/python2.7/site-packages/celery/result.py
add
CharleyFarley/ovvio
python
def add(self, result): 'Add :class:`AsyncResult` as a new member of the set.\n\n Does nothing if the result is already a member.\n\n ' if (result not in self.results): self.results.append(result)
def remove(self, result): 'Remove result from the set; it must be a member.\n\n :raises KeyError: if the result is not a member.\n\n ' if isinstance(result, string_t): result = self.app.AsyncResult(result) try: self.results.remove(result) except ValueError: raise Ke...
4,068,160,251,530,570,000
Remove result from the set; it must be a member. :raises KeyError: if the result is not a member.
venv/lib/python2.7/site-packages/celery/result.py
remove
CharleyFarley/ovvio
python
def remove(self, result): 'Remove result from the set; it must be a member.\n\n :raises KeyError: if the result is not a member.\n\n ' if isinstance(result, string_t): result = self.app.AsyncResult(result) try: self.results.remove(result) except ValueError: raise Ke...
def discard(self, result): 'Remove result from the set if it is a member.\n\n If it is not a member, do nothing.\n\n ' try: self.remove(result) except KeyError: pass
1,490,687,160,468,694,800
Remove result from the set if it is a member. If it is not a member, do nothing.
venv/lib/python2.7/site-packages/celery/result.py
discard
CharleyFarley/ovvio
python
def discard(self, result): 'Remove result from the set if it is a member.\n\n If it is not a member, do nothing.\n\n ' try: self.remove(result) except KeyError: pass
def update(self, results): 'Update set with the union of itself and an iterable with\n results.' self.results.extend((r for r in results if (r not in self.results)))
1,345,366,747,161,373,200
Update set with the union of itself and an iterable with results.
venv/lib/python2.7/site-packages/celery/result.py
update
CharleyFarley/ovvio
python
def update(self, results): 'Update set with the union of itself and an iterable with\n results.' self.results.extend((r for r in results if (r not in self.results)))
def clear(self): 'Remove all results from this set.' self.results[:] = []
-7,683,751,693,161,588,000
Remove all results from this set.
venv/lib/python2.7/site-packages/celery/result.py
clear
CharleyFarley/ovvio
python
def clear(self): self.results[:] = []
def successful(self): 'Was all of the tasks successful?\n\n :returns: :const:`True` if all of the tasks finished\n successfully (i.e. did not raise an exception).\n\n ' return all((result.successful() for result in self.results))
3,133,950,208,285,973,500
Was all of the tasks successful? :returns: :const:`True` if all of the tasks finished successfully (i.e. did not raise an exception).
venv/lib/python2.7/site-packages/celery/result.py
successful
CharleyFarley/ovvio
python
def successful(self): 'Was all of the tasks successful?\n\n :returns: :const:`True` if all of the tasks finished\n successfully (i.e. did not raise an exception).\n\n ' return all((result.successful() for result in self.results))
def failed(self): 'Did any of the tasks fail?\n\n :returns: :const:`True` if one of the tasks failed.\n (i.e., raised an exception)\n\n ' return any((result.failed() for result in self.results))
-4,198,079,692,271,458,000
Did any of the tasks fail? :returns: :const:`True` if one of the tasks failed. (i.e., raised an exception)
venv/lib/python2.7/site-packages/celery/result.py
failed
CharleyFarley/ovvio
python
def failed(self): 'Did any of the tasks fail?\n\n :returns: :const:`True` if one of the tasks failed.\n (i.e., raised an exception)\n\n ' return any((result.failed() for result in self.results))
def waiting(self): 'Are any of the tasks incomplete?\n\n :returns: :const:`True` if one of the tasks are still\n waiting for execution.\n\n ' return any(((not result.ready()) for result in self.results))
-4,263,889,825,430,423,600
Are any of the tasks incomplete? :returns: :const:`True` if one of the tasks are still waiting for execution.
venv/lib/python2.7/site-packages/celery/result.py
waiting
CharleyFarley/ovvio
python
def waiting(self): 'Are any of the tasks incomplete?\n\n :returns: :const:`True` if one of the tasks are still\n waiting for execution.\n\n ' return any(((not result.ready()) for result in self.results))
def ready(self): 'Did all of the tasks complete? (either by success of failure).\n\n :returns: :const:`True` if all of the tasks has been\n executed.\n\n ' return all((result.ready() for result in self.results))
5,308,216,925,372,778,000
Did all of the tasks complete? (either by success of failure). :returns: :const:`True` if all of the tasks has been executed.
venv/lib/python2.7/site-packages/celery/result.py
ready
CharleyFarley/ovvio
python
def ready(self): 'Did all of the tasks complete? (either by success of failure).\n\n :returns: :const:`True` if all of the tasks has been\n executed.\n\n ' return all((result.ready() for result in self.results))
def completed_count(self): 'Task completion count.\n\n :returns: the number of tasks completed.\n\n ' return sum((int(result.successful()) for result in self.results))
-7,257,203,177,105,533,000
Task completion count. :returns: the number of tasks completed.
venv/lib/python2.7/site-packages/celery/result.py
completed_count
CharleyFarley/ovvio
python
def completed_count(self): 'Task completion count.\n\n :returns: the number of tasks completed.\n\n ' return sum((int(result.successful()) for result in self.results))
def forget(self): 'Forget about (and possible remove the result of) all the tasks.' for result in self.results: result.forget()
-1,757,364,964,035,442,200
Forget about (and possible remove the result of) all the tasks.
venv/lib/python2.7/site-packages/celery/result.py
forget
CharleyFarley/ovvio
python
def forget(self): for result in self.results: result.forget()
def revoke(self, connection=None, terminate=False, signal=None, wait=False, timeout=None): 'Send revoke signal to all workers for all tasks in the set.\n\n :keyword terminate: Also terminate the process currently working\n on the task (if any).\n :keyword signal: Name of signal to send to p...
7,090,524,531,389,367,000
Send revoke signal to all workers for all tasks in the set. :keyword terminate: Also terminate the process currently working on the task (if any). :keyword signal: Name of signal to send to process if terminate. Default is TERM. :keyword wait: Wait for replies from worker. Will wait for 1 second by default...
venv/lib/python2.7/site-packages/celery/result.py
revoke
CharleyFarley/ovvio
python
def revoke(self, connection=None, terminate=False, signal=None, wait=False, timeout=None): 'Send revoke signal to all workers for all tasks in the set.\n\n :keyword terminate: Also terminate the process currently working\n on the task (if any).\n :keyword signal: Name of signal to send to p...
def __getitem__(self, index): '`res[i] -> res.results[i]`' return self.results[index]
-5,759,615,132,893,857,000
`res[i] -> res.results[i]`
venv/lib/python2.7/site-packages/celery/result.py
__getitem__
CharleyFarley/ovvio
python
def __getitem__(self, index): return self.results[index]
@deprecated('3.2', '3.3') def iterate(self, timeout=None, propagate=True, interval=0.5): 'Deprecated method, use :meth:`get` with a callback argument.' elapsed = 0.0 results = OrderedDict(((result.id, copy(result)) for result in self.results)) while results: removed = set() for (task_id,...
-6,680,390,843,746,875,000
Deprecated method, use :meth:`get` with a callback argument.
venv/lib/python2.7/site-packages/celery/result.py
iterate
CharleyFarley/ovvio
python
@deprecated('3.2', '3.3') def iterate(self, timeout=None, propagate=True, interval=0.5): elapsed = 0.0 results = OrderedDict(((result.id, copy(result)) for result in self.results)) while results: removed = set() for (task_id, result) in items(results): if result.ready(): ...
def get(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'See :meth:`join`\n\n This is here for API compatibility with :class:`AsyncResult`,\n in addition it uses :meth:`join_native` if available for the\n current result backend.\n\n ' return (self.join_...
2,206,958,811,034,429,400
See :meth:`join` This is here for API compatibility with :class:`AsyncResult`, in addition it uses :meth:`join_native` if available for the current result backend.
venv/lib/python2.7/site-packages/celery/result.py
get
CharleyFarley/ovvio
python
def get(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'See :meth:`join`\n\n This is here for API compatibility with :class:`AsyncResult`,\n in addition it uses :meth:`join_native` if available for the\n current result backend.\n\n ' return (self.join_...
def join(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'Gathers the results of all tasks as a list in order.\n\n .. note::\n\n This can be an expensive operation for result store\n backends that must resort to polling (e.g. database).\n\n You ...
5,768,098,422,675,149,000
Gathers the results of all tasks as a list in order. .. note:: This can be an expensive operation for result store backends that must resort to polling (e.g. database). You should consider using :meth:`join_native` if your backend supports it. .. warning:: Waiting for tasks within a task may le...
venv/lib/python2.7/site-packages/celery/result.py
join
CharleyFarley/ovvio
python
def join(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'Gathers the results of all tasks as a list in order.\n\n .. note::\n\n This can be an expensive operation for result store\n backends that must resort to polling (e.g. database).\n\n You ...
def iter_native(self, timeout=None, interval=0.5, no_ack=True): 'Backend optimized version of :meth:`iterate`.\n\n .. versionadded:: 2.2\n\n Note that this does not support collecting the results\n for different task types using different backends.\n\n This is currently only supported by...
-1,819,789,941,179,141,000
Backend optimized version of :meth:`iterate`. .. versionadded:: 2.2 Note that this does not support collecting the results for different task types using different backends. This is currently only supported by the amqp, Redis and cache result backends.
venv/lib/python2.7/site-packages/celery/result.py
iter_native
CharleyFarley/ovvio
python
def iter_native(self, timeout=None, interval=0.5, no_ack=True): 'Backend optimized version of :meth:`iterate`.\n\n .. versionadded:: 2.2\n\n Note that this does not support collecting the results\n for different task types using different backends.\n\n This is currently only supported by...
def join_native(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'Backend optimized version of :meth:`join`.\n\n .. versionadded:: 2.2\n\n Note that this does not support collecting the results\n for different task types using different backends.\n\n This is...
9,139,139,065,209,087,000
Backend optimized version of :meth:`join`. .. versionadded:: 2.2 Note that this does not support collecting the results for different task types using different backends. This is currently only supported by the amqp, Redis and cache result backends.
venv/lib/python2.7/site-packages/celery/result.py
join_native
CharleyFarley/ovvio
python
def join_native(self, timeout=None, propagate=True, interval=0.5, callback=None, no_ack=True): 'Backend optimized version of :meth:`join`.\n\n .. versionadded:: 2.2\n\n Note that this does not support collecting the results\n for different task types using different backends.\n\n This is...
@property def subtasks(self): 'Deprecated alias to :attr:`results`.' return self.results
-297,266,856,338,344,450
Deprecated alias to :attr:`results`.
venv/lib/python2.7/site-packages/celery/result.py
subtasks
CharleyFarley/ovvio
python
@property def subtasks(self): return self.results
def save(self, backend=None): 'Save group-result for later retrieval using :meth:`restore`.\n\n Example::\n\n >>> def save_and_restore(result):\n ... result.save()\n ... result = GroupResult.restore(result.id)\n\n ' return (backend or self.app.backend).save...
2,484,700,479,012,440,600
Save group-result for later retrieval using :meth:`restore`. Example:: >>> def save_and_restore(result): ... result.save() ... result = GroupResult.restore(result.id)
venv/lib/python2.7/site-packages/celery/result.py
save
CharleyFarley/ovvio
python
def save(self, backend=None): 'Save group-result for later retrieval using :meth:`restore`.\n\n Example::\n\n >>> def save_and_restore(result):\n ... result.save()\n ... result = GroupResult.restore(result.id)\n\n ' return (backend or self.app.backend).save...
def delete(self, backend=None): 'Remove this result if it was previously saved.' (backend or self.app.backend).delete_group(self.id)
-5,962,614,933,109,574,000
Remove this result if it was previously saved.
venv/lib/python2.7/site-packages/celery/result.py
delete
CharleyFarley/ovvio
python
def delete(self, backend=None): (backend or self.app.backend).delete_group(self.id)
@classmethod def restore(self, id, backend=None): 'Restore previously saved group result.' return (backend or (self.app.backend if self.app else current_app.backend)).restore_group(id)
7,488,101,914,846,607,000
Restore previously saved group result.
venv/lib/python2.7/site-packages/celery/result.py
restore
CharleyFarley/ovvio
python
@classmethod def restore(self, id, backend=None): return (backend or (self.app.backend if self.app else current_app.backend)).restore_group(id)
def itersubtasks(self): 'Deprecated. Use ``iter(self.results)`` instead.' return iter(self.results)
4,639,782,609,641,679,000
Deprecated. Use ``iter(self.results)`` instead.
venv/lib/python2.7/site-packages/celery/result.py
itersubtasks
CharleyFarley/ovvio
python
def itersubtasks(self): return iter(self.results)
@property def total(self): 'Deprecated: Use ``len(r)``.' return len(self)
-8,613,052,794,903,339,000
Deprecated: Use ``len(r)``.
venv/lib/python2.7/site-packages/celery/result.py
total
CharleyFarley/ovvio
python
@property def total(self): return len(self)
@property def taskset_id(self): 'compat alias to :attr:`self.id`' return self.id
3,185,373,323,444,679,700
compat alias to :attr:`self.id`
venv/lib/python2.7/site-packages/celery/result.py
taskset_id
CharleyFarley/ovvio
python
@property def taskset_id(self): return self.id
@property def result(self): 'The tasks return value' return self._result
-5,183,060,910,031,868,000
The tasks return value
venv/lib/python2.7/site-packages/celery/result.py
result
CharleyFarley/ovvio
python
@property def result(self): return self._result
@property def state(self): 'The tasks state.' return self._state
7,325,794,408,771,949,000
The tasks state.
venv/lib/python2.7/site-packages/celery/result.py
state
CharleyFarley/ovvio
python
@property def state(self): return self._state
@property def traceback(self): 'The traceback if the task failed.' return self._traceback
608,441,875,333,079,700
The traceback if the task failed.
venv/lib/python2.7/site-packages/celery/result.py
traceback
CharleyFarley/ovvio
python
@property def traceback(self): return self._traceback
def get_prepared_model(stage: str, no_classes: int, input_shape: list, loss: str, optimizer: str, metrics: list) -> Model: "Function creates ANN model and compile.\n Args:\n stage ([str]): stage of experiment\n no_classes ([INT]): No of classes for classification\n input_shape ([int, int]): ...
-1,242,451,499,876,563,000
Function creates ANN model and compile. Args: stage ([str]): stage of experiment no_classes ([INT]): No of classes for classification input_shape ([int, int]): Input shape for model's input layer loss ([str]): Loss function for model optimizer ([str]): Optimizer for model metrics ([str]): Metric...
src/utils/model.py
get_prepared_model
iDataAstro/MNIST_CLASSIFICATION
python
def get_prepared_model(stage: str, no_classes: int, input_shape: list, loss: str, optimizer: str, metrics: list) -> Model: "Function creates ANN model and compile.\n Args:\n stage ([str]): stage of experiment\n no_classes ([INT]): No of classes for classification\n input_shape ([int, int]): ...
def save_model(model_dir: str, model: Model, model_suffix: str) -> None: '\n args:\n model_dir: directory to save the model\n model: model object to save\n model_suffix: Suffix to save the model\n ' create_directories([model_dir]) model_file = os.path.join(model_dir, f'{model_suff...
8,604,583,271,117,257,000
args: model_dir: directory to save the model model: model object to save model_suffix: Suffix to save the model
src/utils/model.py
save_model
iDataAstro/MNIST_CLASSIFICATION
python
def save_model(model_dir: str, model: Model, model_suffix: str) -> None: '\n args:\n model_dir: directory to save the model\n model: model object to save\n model_suffix: Suffix to save the model\n ' create_directories([model_dir]) model_file = os.path.join(model_dir, f'{model_suff...
def save_history_plot(history, plot_dir: str, stage: str) -> None: '\n Args:\n history: History object for plotting loss/accuracy curves\n plot_dir: Directory to save plot files\n stage: Stage name for training\n ' pd.DataFrame(history.history).plot(figsize=(10, 8)) plt.grid(True)...
1,670,037,681,986,658,600
Args: history: History object for plotting loss/accuracy curves plot_dir: Directory to save plot files stage: Stage name for training
src/utils/model.py
save_history_plot
iDataAstro/MNIST_CLASSIFICATION
python
def save_history_plot(history, plot_dir: str, stage: str) -> None: '\n Args:\n history: History object for plotting loss/accuracy curves\n plot_dir: Directory to save plot files\n stage: Stage name for training\n ' pd.DataFrame(history.history).plot(figsize=(10, 8)) plt.grid(True)...
def get_callbacks(checkpoint_dir: str, tensorboard_logs: str, stage: str) -> list: '\n Args:\n checkpoint_dir: Directory to save the model at checkpoint\n tensorboard_logs: Directory to save tensorboard logs\n stage: Stage name for training\n Returns:\n callback_list: List of creat...
4,078,891,736,999,478,000
Args: checkpoint_dir: Directory to save the model at checkpoint tensorboard_logs: Directory to save tensorboard logs stage: Stage name for training Returns: callback_list: List of created callbacks
src/utils/model.py
get_callbacks
iDataAstro/MNIST_CLASSIFICATION
python
def get_callbacks(checkpoint_dir: str, tensorboard_logs: str, stage: str) -> list: '\n Args:\n checkpoint_dir: Directory to save the model at checkpoint\n tensorboard_logs: Directory to save tensorboard logs\n stage: Stage name for training\n Returns:\n callback_list: List of creat...
def handle_event(context: events.ExecutionContext, event: events.ExecutionEvent) -> None: 'Short output style shows single symbols in the progress bar.\n\n Otherwise, identical to the default output style.\n ' if isinstance(event, events.Initialized): default.handle_initialized(context, event) ...
-4,836,795,211,007,890,000
Short output style shows single symbols in the progress bar. Otherwise, identical to the default output style.
src/schemathesis/cli/output/short.py
handle_event
RonnyPfannschmidt/schemathesis
python
def handle_event(context: events.ExecutionContext, event: events.ExecutionEvent) -> None: 'Short output style shows single symbols in the progress bar.\n\n Otherwise, identical to the default output style.\n ' if isinstance(event, events.Initialized): default.handle_initialized(context, event) ...
@staticmethod def serialize_test_record(test_record): 'Override method to alter how test records are serialized to file data.' return pickle.dumps(test_record, (- 1))
5,715,423,257,767,327,000
Override method to alter how test records are serialized to file data.
openhtf/output/callbacks/__init__.py
serialize_test_record
airdeng/openhtf
python
@staticmethod def serialize_test_record(test_record): return pickle.dumps(test_record, (- 1))
@staticmethod def open_file(filename): 'Override method to alter file open behavior or file types.' return Atomic(filename)
1,194,922,633,395,250,700
Override method to alter file open behavior or file types.
openhtf/output/callbacks/__init__.py
open_file
airdeng/openhtf
python
@staticmethod def open_file(filename): return Atomic(filename)
@contextlib.contextmanager def open_output_file(self, test_record): 'Open file based on pattern.' record_dict = data.convert_to_base_types(test_record, ignore_keys=('code_info', 'phases', 'log_records')) pattern = self.filename_pattern if (isinstance(pattern, six.string_types) or callable(pattern)): ...
1,003,922,441,930,395,100
Open file based on pattern.
openhtf/output/callbacks/__init__.py
open_output_file
airdeng/openhtf
python
@contextlib.contextmanager def open_output_file(self, test_record): record_dict = data.convert_to_base_types(test_record, ignore_keys=('code_info', 'phases', 'log_records')) pattern = self.filename_pattern if (isinstance(pattern, six.string_types) or callable(pattern)): output_file = self.open_...
async def place_conditional_order(self, market: str, side: str, size: float, type: str='stop', limit_price: float=None, reduce_only: bool=False, cancel: bool=True, trigger_price: float=None, trail_value: float=None) -> dict: "\n To send a Stop Market order, set type='stop' and supply a trigger_price\n ...
-751,737,147,964,922,100
To send a Stop Market order, set type='stop' and supply a trigger_price To send a Stop Limit order, also supply a limit_price To send a Take Profit Market order, set type='trailing_stop' and supply a trigger_price To send a Trailing Stop order, set type='trailing_stop' and supply a trail_value
quant/platform/ftx.py
place_conditional_order
a04512/alphahunter
python
async def place_conditional_order(self, market: str, side: str, size: float, type: str='stop', limit_price: float=None, reduce_only: bool=False, cancel: bool=True, trigger_price: float=None, trail_value: float=None) -> dict: "\n To send a Stop Market order, set type='stop' and supply a trigger_price\n ...
def __init__(self, **kwargs): 'Initialize.' self.cb = kwargs['cb'] state = None self._platform = kwargs.get('platform') self._symbols = kwargs.get('symbols') self._strategy = kwargs.get('strategy') self._account = kwargs.get('account') self._access_key = kwargs.get('access_key') self...
-8,882,331,551,842,784,000
Initialize.
quant/platform/ftx.py
__init__
a04512/alphahunter
python
def __init__(self, **kwargs): self.cb = kwargs['cb'] state = None self._platform = kwargs.get('platform') self._symbols = kwargs.get('symbols') self._strategy = kwargs.get('strategy') self._account = kwargs.get('account') self._access_key = kwargs.get('access_key') self._secret_key ...
async def create_order(self, symbol, action, price, quantity, order_type=ORDER_TYPE_LIMIT, *args, **kwargs): " Create an order.\n\n Args:\n symbol: Trade target\n action: Trade direction, `BUY` or `SELL`.\n price: Price of each contract.\n quantity: The buying or s...
8,215,648,725,332,022,000
Create an order. Args: symbol: Trade target action: Trade direction, `BUY` or `SELL`. price: Price of each contract. quantity: The buying or selling quantity. order_type: Order type, `MARKET` or `LIMIT`. Returns: order_no: Order ID if created successfully, otherwise it's None. error: Error...
quant/platform/ftx.py
create_order
a04512/alphahunter
python
async def create_order(self, symbol, action, price, quantity, order_type=ORDER_TYPE_LIMIT, *args, **kwargs): " Create an order.\n\n Args:\n symbol: Trade target\n action: Trade direction, `BUY` or `SELL`.\n price: Price of each contract.\n quantity: The buying or s...
async def revoke_order(self, symbol, *order_nos): ' Revoke (an) order(s).\n\n Args:\n symbol: Trade target\n order_nos: Order id list, you can set this param to 0 or multiple items. If you set 0 param, you can cancel all orders for \n this symbol. If you set 1 or multiple par...
725,604,617,516,433,300
Revoke (an) order(s). Args: symbol: Trade target order_nos: Order id list, you can set this param to 0 or multiple items. If you set 0 param, you can cancel all orders for this symbol. If you set 1 or multiple param, you can cancel an or multiple order. Returns: 删除全部订单情况: 成功=(True, None), 失败=(False, ...
quant/platform/ftx.py
revoke_order
a04512/alphahunter
python
async def revoke_order(self, symbol, *order_nos): ' Revoke (an) order(s).\n\n Args:\n symbol: Trade target\n order_nos: Order id list, you can set this param to 0 or multiple items. If you set 0 param, you can cancel all orders for \n this symbol. If you set 1 or multiple par...
async def get_assets(self): " 获取交易账户资产信息\n\n Args:\n None\n\n Returns:\n assets: Asset if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " (success, error) = (await self._rest_api.get_account_info()) if error: ...
-8,438,721,267,337,178,000
获取交易账户资产信息 Args: None Returns: assets: Asset if successfully, otherwise it's None. error: Error information, otherwise it's None.
quant/platform/ftx.py
get_assets
a04512/alphahunter
python
async def get_assets(self): " 获取交易账户资产信息\n\n Args:\n None\n\n Returns:\n assets: Asset if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " (success, error) = (await self._rest_api.get_account_info()) if error: ...
def _convert_order_format(self, o): '将交易所订单结构转换为本交易系统标准订单结构格式\n ' order_no = str(o['id']) state = o['status'] remain = float(o['remainingSize']) filled = float(o['filledSize']) size = float(o['size']) price = (None if (o['price'] == None) else float(o['price'])) avg_price = (None ...
-6,512,945,056,998,619,000
将交易所订单结构转换为本交易系统标准订单结构格式
quant/platform/ftx.py
_convert_order_format
a04512/alphahunter
python
def _convert_order_format(self, o): '\n ' order_no = str(o['id']) state = o['status'] remain = float(o['remainingSize']) filled = float(o['filledSize']) size = float(o['size']) price = (None if (o['price'] == None) else float(o['price'])) avg_price = (None if (o['avgFillPrice'] ==...
async def get_orders(self, symbol): " 获取当前挂单列表\n\n Args:\n symbol: Trade target\n\n Returns:\n orders: Order list if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " orders: List[Order] = [] (success, error) = (awai...
-2,887,691,378,927,101,400
获取当前挂单列表 Args: symbol: Trade target Returns: orders: Order list if successfully, otherwise it's None. error: Error information, otherwise it's None.
quant/platform/ftx.py
get_orders
a04512/alphahunter
python
async def get_orders(self, symbol): " 获取当前挂单列表\n\n Args:\n symbol: Trade target\n\n Returns:\n orders: Order list if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " orders: List[Order] = [] (success, error) = (awai...
async def get_position(self, symbol): " 获取当前持仓\n\n Args:\n symbol: Trade target\n\n Returns:\n position: Position if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " (success, error) = (await self._rest_api.get_position...
6,262,820,115,701,591,000
获取当前持仓 Args: symbol: Trade target Returns: position: Position if successfully, otherwise it's None. error: Error information, otherwise it's None.
quant/platform/ftx.py
get_position
a04512/alphahunter
python
async def get_position(self, symbol): " 获取当前持仓\n\n Args:\n symbol: Trade target\n\n Returns:\n position: Position if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " (success, error) = (await self._rest_api.get_position...
async def get_symbol_info(self, symbol): " 获取指定符号相关信息\n\n Args:\n symbol: Trade target\n\n Returns:\n symbol_info: SymbolInfo if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " '\n {\n "success": true,\n ...
2,875,572,908,821,740,500
获取指定符号相关信息 Args: symbol: Trade target Returns: symbol_info: SymbolInfo if successfully, otherwise it's None. error: Error information, otherwise it's None.
quant/platform/ftx.py
get_symbol_info
a04512/alphahunter
python
async def get_symbol_info(self, symbol): " 获取指定符号相关信息\n\n Args:\n symbol: Trade target\n\n Returns:\n symbol_info: SymbolInfo if successfully, otherwise it's None.\n error: Error information, otherwise it's None.\n " '\n {\n "success": true,\n ...
async def invalid_indicate(self, symbol, indicate_type): " update (an) callback function.\n\n Args:\n symbol: Trade target\n indicate_type: INDICATE_ORDER, INDICATE_ASSET, INDICATE_POSITION\n\n Returns:\n success: If execute successfully, return True, otherwise it's Fa...
5,374,433,212,418,980,000
update (an) callback function. Args: symbol: Trade target indicate_type: INDICATE_ORDER, INDICATE_ASSET, INDICATE_POSITION Returns: success: If execute successfully, return True, otherwise it's False. error: If execute failed, return error information, otherwise it's None.
quant/platform/ftx.py
invalid_indicate
a04512/alphahunter
python
async def invalid_indicate(self, symbol, indicate_type): " update (an) callback function.\n\n Args:\n symbol: Trade target\n indicate_type: INDICATE_ORDER, INDICATE_ASSET, INDICATE_POSITION\n\n Returns:\n success: If execute successfully, return True, otherwise it's Fa...
async def _login(self): 'FTX的websocket接口真是逗逼,验证成功的情况下居然不会返回任何消息' ts = int((time.time() * 1000)) signature = hmac.new(self._secret_key.encode(), f'{ts}websocket_login'.encode(), 'sha256').hexdigest() args = {'key': self._access_key, 'sign': signature, 'time': ts} if self._subaccount_name: arg...
3,940,037,901,716,461,600
FTX的websocket接口真是逗逼,验证成功的情况下居然不会返回任何消息
quant/platform/ftx.py
_login
a04512/alphahunter
python
async def _login(self): ts = int((time.time() * 1000)) signature = hmac.new(self._secret_key.encode(), f'{ts}websocket_login'.encode(), 'sha256').hexdigest() args = {'key': self._access_key, 'sign': signature, 'time': ts} if self._subaccount_name: args['subaccount'] = self._subaccount_name ...
async def connected_callback(self): '网络链接成功回调\n ' if (self._account != None): (await self._login()) (success, error) = (await self._rest_api.list_markets()) if error: state = State(self._platform, self._account, 'list_markets error: {}'.format(error), State.STATE_CODE_...
-7,279,199,030,973,096,000
网络链接成功回调
quant/platform/ftx.py
connected_callback
a04512/alphahunter
python
async def connected_callback(self): '\n ' if (self._account != None): (await self._login()) (success, error) = (await self._rest_api.list_markets()) if error: state = State(self._platform, self._account, 'list_markets error: {}'.format(error), State.STATE_CODE_GENERAL_...
async def process(self, msg): ' Process message that received from websocket.\n\n Args:\n msg: message received from websocket.\n\n Returns:\n None.\n ' if (not isinstance(msg, dict)): return logger.debug('msg:', json.dumps(msg), caller=self) if (msg['t...
-7,256,647,120,417,005,000
Process message that received from websocket. Args: msg: message received from websocket. Returns: None.
quant/platform/ftx.py
process
a04512/alphahunter
python
async def process(self, msg): ' Process message that received from websocket.\n\n Args:\n msg: message received from websocket.\n\n Returns:\n None.\n ' if (not isinstance(msg, dict)): return logger.debug('msg:', json.dumps(msg), caller=self) if (msg['t...
def _update_order(self, order_info): ' Order update.\n\n Args:\n order_info: Order information.\n\n Returns:\n None.\n ' o = order_info['data'] order = self._convert_order_format(o) if (order == None): return SingleTask.run(self.cb.on_order_update_c...
-7,402,522,007,243,926,000
Order update. Args: order_info: Order information. Returns: None.
quant/platform/ftx.py
_update_order
a04512/alphahunter
python
def _update_order(self, order_info): ' Order update.\n\n Args:\n order_info: Order information.\n\n Returns:\n None.\n ' o = order_info['data'] order = self._convert_order_format(o) if (order == None): return SingleTask.run(self.cb.on_order_update_c...
def _update_fill(self, fill_info): ' Fill update.\n\n Args:\n fill_info: Fill information.\n\n Returns:\n None.\n ' data = fill_info['data'] fill_no = str(data['id']) order_no = str(data['orderId']) price = float(data['price']) size = float(data['size']...
-9,178,885,241,940,646,000
Fill update. Args: fill_info: Fill information. Returns: None.
quant/platform/ftx.py
_update_fill
a04512/alphahunter
python
def _update_fill(self, fill_info): ' Fill update.\n\n Args:\n fill_info: Fill information.\n\n Returns:\n None.\n ' data = fill_info['data'] fill_no = str(data['id']) order_no = str(data['orderId']) price = float(data['price']) size = float(data['size']...
@staticmethod def mapping_layer(): ' 获取符号映射关系.\n Returns:\n layer: 符号映射关系\n ' return None
-4,603,296,640,271,726,600
获取符号映射关系. Returns: layer: 符号映射关系
quant/platform/ftx.py
mapping_layer
a04512/alphahunter
python
@staticmethod def mapping_layer(): ' 获取符号映射关系.\n Returns:\n layer: 符号映射关系\n ' return None
def __init__(self, **kwargs): 'Initialize.' self._platform = kwargs['platform'] self._symbols = kwargs['symbols'] self._host = 'https://ftx.com' self._wss = 'wss://ftx.com' url = (self._wss + '/ws') super(FTXMarket, self).__init__(url, send_hb_interval=15, **kwargs) self.heartbeat_msg = ...
-1,737,670,192,026,487,300
Initialize.
quant/platform/ftx.py
__init__
a04512/alphahunter
python
def __init__(self, **kwargs): self._platform = kwargs['platform'] self._symbols = kwargs['symbols'] self._host = 'https://ftx.com' self._wss = 'wss://ftx.com' url = (self._wss + '/ws') super(FTXMarket, self).__init__(url, send_hb_interval=15, **kwargs) self.heartbeat_msg = {'op': 'ping'...
async def connected_callback(self): '网络链接成功回调\n ' for sym in self._symbols: if (self.cb.on_trade_update_callback != None): (await self.send_json({'op': 'subscribe', 'channel': 'trades', 'market': sym})) if (self.cb.on_orderbook_update_callback != None): (await self...
8,191,372,696,025,688,000
网络链接成功回调
quant/platform/ftx.py
connected_callback
a04512/alphahunter
python
async def connected_callback(self): '\n ' for sym in self._symbols: if (self.cb.on_trade_update_callback != None): (await self.send_json({'op': 'subscribe', 'channel': 'trades', 'market': sym})) if (self.cb.on_orderbook_update_callback != None): (await self.send_js...
async def process(self, msg): ' Process message that received from websocket.\n\n Args:\n msg: message received from websocket.\n\n Returns:\n None.\n ' if (not isinstance(msg, dict)): return logger.debug('msg:', json.dumps(msg), caller=self) if (msg.ge...
-192,911,100,035,693,280
Process message that received from websocket. Args: msg: message received from websocket. Returns: None.
quant/platform/ftx.py
process
a04512/alphahunter
python
async def process(self, msg): ' Process message that received from websocket.\n\n Args:\n msg: message received from websocket.\n\n Returns:\n None.\n ' if (not isinstance(msg, dict)): return logger.debug('msg:', json.dumps(msg), caller=self) if (msg.ge...
def _update_ticker(self, ticker_info): ' ticker update.\n\n Args:\n ticker_info: ticker information.\n\n Returns:\n ' ts = int((float(ticker_info['data']['time']) * 1000)) p = {'platform': self._platform, 'symbol': ticker_info['market'], 'ask': ticker_info['data']['ask'], 'bi...
-2,724,322,725,391,350,300
ticker update. Args: ticker_info: ticker information. Returns:
quant/platform/ftx.py
_update_ticker
a04512/alphahunter
python
def _update_ticker(self, ticker_info): ' ticker update.\n\n Args:\n ticker_info: ticker information.\n\n Returns:\n ' ts = int((float(ticker_info['data']['time']) * 1000)) p = {'platform': self._platform, 'symbol': ticker_info['market'], 'ask': ticker_info['data']['ask'], 'bi...
def _update_trades(self, trades_info): ' trades update.\n\n Args:\n trades_info: trades information.\n\n Returns:\n ' for t in trades_info['data']: ts = tools.utctime_str_to_mts(t['time'], '%Y-%m-%dT%H:%M:%S.%f+00:00') p = {'platform': self._platform, 'symbol': tr...
4,211,527,120,994,042,400
trades update. Args: trades_info: trades information. Returns:
quant/platform/ftx.py
_update_trades
a04512/alphahunter
python
def _update_trades(self, trades_info): ' trades update.\n\n Args:\n trades_info: trades information.\n\n Returns:\n ' for t in trades_info['data']: ts = tools.utctime_str_to_mts(t['time'], '%Y-%m-%dT%H:%M:%S.%f+00:00') p = {'platform': self._platform, 'symbol': tr...
def _update_orderbook(self, orderbook_info): ' orderbook update.\n\n Args:\n orderbook_info: orderbook information.\n\n Returns:\n ' market = orderbook_info['market'] data = orderbook_info['data'] if (data['action'] == 'partial'): self._reset_orderbook(market) ...
-5,539,249,548,123,632,000
orderbook update. Args: orderbook_info: orderbook information. Returns:
quant/platform/ftx.py
_update_orderbook
a04512/alphahunter
python
def _update_orderbook(self, orderbook_info): ' orderbook update.\n\n Args:\n orderbook_info: orderbook information.\n\n Returns:\n ' market = orderbook_info['market'] data = orderbook_info['data'] if (data['action'] == 'partial'): self._reset_orderbook(market) ...
def _update_kline(self, kline_info, symbol): ' kline update.\n\n Args:\n kline_info: kline information.\n\n Returns:\n None.\n ' info = {'platform': self._platform, 'symbol': symbol, 'open': kline_info['open'], 'high': kline_info['high'], 'low': kline_info['low'], 'clo...
-6,886,070,000,955,551,000
kline update. Args: kline_info: kline information. Returns: None.
quant/platform/ftx.py
_update_kline
a04512/alphahunter
python
def _update_kline(self, kline_info, symbol): ' kline update.\n\n Args:\n kline_info: kline information.\n\n Returns:\n None.\n ' info = {'platform': self._platform, 'symbol': symbol, 'open': kline_info['open'], 'high': kline_info['high'], 'low': kline_info['low'], 'clo...
def main(): '\n Calls the other functions in this module to test and/or demonstrate them.\n ' drawing_speed = 10 window = rg.TurtleWindow() window.tracer(drawing_speed) draw_circles(rg.Point(100, 50)) draw_circles(rg.Point((- 200), 0)) window.update() window.close_on_mouse_click()
2,244,172,143,528,723,200
Calls the other functions in this module to test and/or demonstrate them.
src/m5_why_parameters_are_powerful.py
main
brownme1/02-ObjectsFunctionsAndMethods
python
def main(): '\n \n ' drawing_speed = 10 window = rg.TurtleWindow() window.tracer(drawing_speed) draw_circles(rg.Point(100, 50)) draw_circles(rg.Point((- 200), 0)) window.update() window.close_on_mouse_click()
def draw_circles(point): '\n Constructs a SimpleTurtle, then uses the SimpleTurtle to draw 10 circles\n such that:\n -- Each is centered at the given Point, and\n -- They have radii: 15 30 45 60 75 ..., respectively.\n ' turtle = rg.SimpleTurtle() turtle.pen_up() turtle.go_to(po...
8,336,630,033,255,436,000
Constructs a SimpleTurtle, then uses the SimpleTurtle to draw 10 circles such that: -- Each is centered at the given Point, and -- They have radii: 15 30 45 60 75 ..., respectively.
src/m5_why_parameters_are_powerful.py
draw_circles
brownme1/02-ObjectsFunctionsAndMethods
python
def draw_circles(point): '\n Constructs a SimpleTurtle, then uses the SimpleTurtle to draw 10 circles\n such that:\n -- Each is centered at the given Point, and\n -- They have radii: 15 30 45 60 75 ..., respectively.\n ' turtle = rg.SimpleTurtle() turtle.pen_up() turtle.go_to(po...
def better_draw_circles(point): '\n Starts out the same as the draw_circles function defined ABOVE.\n You Will make it an IMPROVED, MORE POWERFUL function per the above _TODO_.\n ' turtle = rg.SimpleTurtle() turtle.pen_up() turtle.go_to(point) turtle.set_heading(0) for k in range(1,...
-5,529,178,186,068,817,000
Starts out the same as the draw_circles function defined ABOVE. You Will make it an IMPROVED, MORE POWERFUL function per the above _TODO_.
src/m5_why_parameters_are_powerful.py
better_draw_circles
brownme1/02-ObjectsFunctionsAndMethods
python
def better_draw_circles(point): '\n Starts out the same as the draw_circles function defined ABOVE.\n You Will make it an IMPROVED, MORE POWERFUL function per the above _TODO_.\n ' turtle = rg.SimpleTurtle() turtle.pen_up() turtle.go_to(point) turtle.set_heading(0) for k in range(1,...
def even_better_draw_circles(point): ' An improved version of draw_circles, per the _TODO_ above. '
5,236,924,129,325,634,000
An improved version of draw_circles, per the _TODO_ above.
src/m5_why_parameters_are_powerful.py
even_better_draw_circles
brownme1/02-ObjectsFunctionsAndMethods
python
def even_better_draw_circles(point): ' '
def vol(volpath, ext='.npz', batch_size=1, expected_nb_files=(- 1), expected_files=None, data_proc_fn=None, relabel=None, nb_labels_reshape=0, keep_vol_size=False, name='single_vol', nb_restart_cycle=None, patch_size=None, patch_stride=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_feats=1, patch_rand=...
2,719,363,371,483,586,600
generator for single volume (or volume patches) from a list of files simple volume generator that loads a volume (via npy/mgz/nii/niigz), processes it, and prepares it for keras model formats if a patch size is passed, breaks the volume into patches and generates those
ext/neuron/neuron/generators.py
vol
adriaan16/brainstorm
python
def vol(volpath, ext='.npz', batch_size=1, expected_nb_files=(- 1), expected_files=None, data_proc_fn=None, relabel=None, nb_labels_reshape=0, keep_vol_size=False, name='single_vol', nb_restart_cycle=None, patch_size=None, patch_stride=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_feats=1, patch_rand=...
def patch(vol_data, patch_size, patch_stride=1, nb_labels_reshape=1, keep_vol_size=False, batch_size=1, collapse_2d=None, patch_rand=False, patch_rand_seed=None, variable_batch_size=False, infinite=False): '\n generate patches from volume for keras package\n\n Yields:\n patch: nd array of shape [batch_...
-6,907,692,403,567,869,000
generate patches from volume for keras package Yields: patch: nd array of shape [batch_size, *patch_size], unless resized via nb_labels_reshape
ext/neuron/neuron/generators.py
patch
adriaan16/brainstorm
python
def patch(vol_data, patch_size, patch_stride=1, nb_labels_reshape=1, keep_vol_size=False, batch_size=1, collapse_2d=None, patch_rand=False, patch_rand_seed=None, variable_batch_size=False, infinite=False): '\n generate patches from volume for keras package\n\n Yields:\n patch: nd array of shape [batch_...
def vol_seg(volpath, segpath, proc_vol_fn=None, proc_seg_fn=None, verbose=False, name='vol_seg', ext='.npz', nb_restart_cycle=None, nb_labels_reshape=(- 1), collapse_2d=None, force_binary=False, nb_input_feats=1, relabel=None, vol_rand_seed=None, seg_binary=False, vol_subname='norm', seg_subname='aseg', **kwargs): ...
847,370,237,624,995,200
generator with (volume, segmentation) verbose is passed down to the base generators.py primitive generator (e.g. vol, here) ** kwargs are any named arguments for vol(...), except verbose, data_proc_fn, ext, nb_labels_reshape and name (which this function will control when calling vol())
ext/neuron/neuron/generators.py
vol_seg
adriaan16/brainstorm
python
def vol_seg(volpath, segpath, proc_vol_fn=None, proc_seg_fn=None, verbose=False, name='vol_seg', ext='.npz', nb_restart_cycle=None, nb_labels_reshape=(- 1), collapse_2d=None, force_binary=False, nb_input_feats=1, relabel=None, vol_rand_seed=None, seg_binary=False, vol_subname='norm', seg_subname='aseg', **kwargs): ...
def vol_cat(volpaths, crop=None, resize_shape=None, rescale=None, verbose=False, name='vol_cat', ext='.npz', nb_labels_reshape=(- 1), vol_rand_seed=None, **kwargs): '\n generator with (volume, binary_bit) (random order)\n ONLY works with abtch size of 1 for now\n\n verbose is passed down to the base genera...
6,298,195,965,135,200,000
generator with (volume, binary_bit) (random order) ONLY works with abtch size of 1 for now verbose is passed down to the base generators.py primitive generator (e.g. vol, here)
ext/neuron/neuron/generators.py
vol_cat
adriaan16/brainstorm
python
def vol_cat(volpaths, crop=None, resize_shape=None, rescale=None, verbose=False, name='vol_cat', ext='.npz', nb_labels_reshape=(- 1), vol_rand_seed=None, **kwargs): '\n generator with (volume, binary_bit) (random order)\n ONLY works with abtch size of 1 for now\n\n verbose is passed down to the base genera...
def add_prior(gen, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, verbose=False, patch_rand=False, patch_rand_seed=None): '\n #\n # add a prior generator to...
2,237,103,450,112,340,500
# # add a prior generator to a given generator # with the number of patches in batch matching output of gen
ext/neuron/neuron/generators.py
add_prior
adriaan16/brainstorm
python
def add_prior(gen, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, verbose=False, patch_rand=False, patch_rand_seed=None): '\n #\n # add a prior generator to...
def vol_prior(*args, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_input_feats=1, verbose=False, vol_rand_seed=None, patch_rand=False, **kwargs): '\n gener...
-1,544,022,580,091,930,400
generator that appends prior to (volume, segmentation) depending on input e.g. could be ((volume, prior), segmentation)
ext/neuron/neuron/generators.py
vol_prior
adriaan16/brainstorm
python
def vol_prior(*args, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_input_feats=1, verbose=False, vol_rand_seed=None, patch_rand=False, **kwargs): '\n gener...
def vol_seg_prior(*args, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_input_feats=1, verbose=False, vol_rand_seed=None, patch_rand=None, **kwargs): '\n ge...
1,835,908,042,440,738,000
generator that appends prior to (volume, segmentation) depending on input e.g. could be ((volume, prior), segmentation)
ext/neuron/neuron/generators.py
vol_seg_prior
adriaan16/brainstorm
python
def vol_seg_prior(*args, proc_vol_fn=None, proc_seg_fn=None, prior_type='location', prior_file=None, prior_feed='input', patch_stride=1, patch_size=None, batch_size=1, collapse_2d=None, extract_slice=None, force_binary=False, nb_input_feats=1, verbose=False, vol_rand_seed=None, patch_rand=None, **kwargs): '\n ge...
def vol_seg_hack(volpath, segpath, proc_vol_fn=None, proc_seg_fn=None, verbose=False, name='vol_seg', ext='.npz', nb_restart_cycle=None, nb_labels_reshape=(- 1), collapse_2d=None, force_binary=False, nb_input_feats=1, relabel=None, vol_rand_seed=None, seg_binary=False, vol_subname='norm', seg_subname='aseg', **kwargs):...
-7,127,576,377,244,396,000
generator with (volume, segmentation) verbose is passed down to the base generators.py primitive generator (e.g. vol, here) ** kwargs are any named arguments for vol(...), except verbose, data_proc_fn, ext, nb_labels_reshape and name (which this function will control when calling vol())
ext/neuron/neuron/generators.py
vol_seg_hack
adriaan16/brainstorm
python
def vol_seg_hack(volpath, segpath, proc_vol_fn=None, proc_seg_fn=None, verbose=False, name='vol_seg', ext='.npz', nb_restart_cycle=None, nb_labels_reshape=(- 1), collapse_2d=None, force_binary=False, nb_input_feats=1, relabel=None, vol_rand_seed=None, seg_binary=False, vol_subname='norm', seg_subname='aseg', **kwargs):...
def vol_sr_slices(volpath, nb_input_slices, nb_slice_spacing, batch_size=1, ext='.npz', vol_rand_seed=None, nb_restart_cycle=None, name='vol_sr_slices', rand_slices=True, simulate_whole_sparse_vol=False, verbose=False): '\n default generator for slice-wise super resolution\n ' def indices_to_batch(vol_da...
5,147,564,931,928,816,000
default generator for slice-wise super resolution
ext/neuron/neuron/generators.py
vol_sr_slices
adriaan16/brainstorm
python
def vol_sr_slices(volpath, nb_input_slices, nb_slice_spacing, batch_size=1, ext='.npz', vol_rand_seed=None, nb_restart_cycle=None, name='vol_sr_slices', rand_slices=True, simulate_whole_sparse_vol=False, verbose=False): '\n \n ' def indices_to_batch(vol_data, start_indices, nb_slices_in_subvol, nb_slice_...
def img_seg(volpath, segpath, batch_size=1, verbose=False, nb_restart_cycle=None, name='img_seg', ext='.png', vol_rand_seed=None, **kwargs): '\n generator for (image, segmentation)\n ' def imggen(path, ext, nb_restart_cycle=None): '\n TODO: should really use the volume generators for this\...
8,615,579,906,294,732,000
generator for (image, segmentation)
ext/neuron/neuron/generators.py
img_seg
adriaan16/brainstorm
python
def img_seg(volpath, segpath, batch_size=1, verbose=False, nb_restart_cycle=None, name='img_seg', ext='.png', vol_rand_seed=None, **kwargs): '\n \n ' def imggen(path, ext, nb_restart_cycle=None): '\n TODO: should really use the volume generators for this\n ' files = _get_fil...
def _get_file_list(volpath, ext=None, vol_rand_seed=None): '\n get a list of files at the given path with the given extension\n ' files = [f for f in sorted(os.listdir(volpath)) if ((ext is None) or f.endswith(ext))] if (vol_rand_seed is not None): np.random.seed(vol_rand_seed) files =...
3,140,400,078,776,378,000
get a list of files at the given path with the given extension
ext/neuron/neuron/generators.py
_get_file_list
adriaan16/brainstorm
python
def _get_file_list(volpath, ext=None, vol_rand_seed=None): '\n \n ' files = [f for f in sorted(os.listdir(volpath)) if ((ext is None) or f.endswith(ext))] if (vol_rand_seed is not None): np.random.seed(vol_rand_seed) files = np.random.permutation(files).tolist() return files
def _load_medical_volume(filename, ext, verbose=False): '\n load a medical volume from one of a number of file types\n ' with timer.Timer('load_vol', (verbose >= 2)): if (ext == '.npz'): vol_file = np.load(filename) vol_data = vol_file['vol_data'] elif (ext == 'npy'...
1,786,754,206,587,903,200
load a medical volume from one of a number of file types
ext/neuron/neuron/generators.py
_load_medical_volume
adriaan16/brainstorm
python
def _load_medical_volume(filename, ext, verbose=False): '\n \n ' with timer.Timer('load_vol', (verbose >= 2)): if (ext == '.npz'): vol_file = np.load(filename) vol_data = vol_file['vol_data'] elif (ext == 'npy'): vol_data = np.load(filename) elif...
def _to_categorical(y, num_classes=None, reshape=True): '\n # copy of keras.utils.np_utils.to_categorical, but with a boolean matrix instead of float\n\n Converts a class vector (integers) to binary class matrix.\n\n E.g. for use with categorical_crossentropy.\n\n # Arguments\n y: class vector to...
-1,377,369,910,124,192,800
# copy of keras.utils.np_utils.to_categorical, but with a boolean matrix instead of float Converts a class vector (integers) to binary class matrix. E.g. for use with categorical_crossentropy. # Arguments y: class vector to be converted into a matrix (integers from 0 to num_classes). num_classes: tot...
ext/neuron/neuron/generators.py
_to_categorical
adriaan16/brainstorm
python
def _to_categorical(y, num_classes=None, reshape=True): '\n # copy of keras.utils.np_utils.to_categorical, but with a boolean matrix instead of float\n\n Converts a class vector (integers) to binary class matrix.\n\n E.g. for use with categorical_crossentropy.\n\n # Arguments\n y: class vector to...
def _npz_headers(npz, namelist=None): "\n taken from https://stackoverflow.com/a/43223420\n\n Takes a path to an .npz file, which is a Zip archive of .npy files.\n Generates a sequence of (name, shape, np.dtype).\n\n namelist is a list with variable names, ending in '.npy'. \n e.g. if variable 'var' ...
-6,422,049,485,589,492,000
taken from https://stackoverflow.com/a/43223420 Takes a path to an .npz file, which is a Zip archive of .npy files. Generates a sequence of (name, shape, np.dtype). namelist is a list with variable names, ending in '.npy'. e.g. if variable 'var' is in the file, namelist could be ['var.npy']
ext/neuron/neuron/generators.py
_npz_headers
adriaan16/brainstorm
python
def _npz_headers(npz, namelist=None): "\n taken from https://stackoverflow.com/a/43223420\n\n Takes a path to an .npz file, which is a Zip archive of .npy files.\n Generates a sequence of (name, shape, np.dtype).\n\n namelist is a list with variable names, ending in '.npy'. \n e.g. if variable 'var' ...
def imggen(path, ext, nb_restart_cycle=None): '\n TODO: should really use the volume generators for this\n ' files = _get_file_list(path, ext, vol_rand_seed) if (nb_restart_cycle is None): nb_restart_cycle = len(files) idx = (- 1) while 1: idx = np.mod((idx + 1), nb_res...
-1,790,853,479,394,038,300
TODO: should really use the volume generators for this
ext/neuron/neuron/generators.py
imggen
adriaan16/brainstorm
python
def imggen(path, ext, nb_restart_cycle=None): '\n \n ' files = _get_file_list(path, ext, vol_rand_seed) if (nb_restart_cycle is None): nb_restart_cycle = len(files) idx = (- 1) while 1: idx = np.mod((idx + 1), nb_restart_cycle) im = scipy.misc.imread(os.path.joi...
def main(argv): 'main method for standalone run' config_generator = FaucetConfigGenerator() filepath = '/tmp/faucet_config_dump' egress = 2 access = 3 devices = 1 topo_type = STACK argv = argv[1:] help_msg = '\n <python3> build_config.py -e <egress_switches> -a <access_switches> -...
5,454,660,802,360,472,000
main method for standalone run
testing/python_lib/build_config.py
main
henry54809/forch
python
def main(argv): config_generator = FaucetConfigGenerator() filepath = '/tmp/faucet_config_dump' egress = 2 access = 3 devices = 1 topo_type = STACK argv = argv[1:] help_msg = '\n <python3> build_config.py -e <egress_switches> -a <access_switches> -d <devices per switch>\n -p <...
def create_scale_faucet_config(self, t1_switches, t2_switches, access_ports): 'Create Faucet config with stacking topology' setup_vlan = SETUP_VLAN test_vlan = TEST_VLAN vlans = {setup_vlan: Vlan(description='Faucet IoT'), test_vlan: Vlan(description='Orchestrated Testing')} t1_dps = [('nz-kiwi-t1sw...
2,438,252,111,082,969,000
Create Faucet config with stacking topology
testing/python_lib/build_config.py
create_scale_faucet_config
henry54809/forch
python
def create_scale_faucet_config(self, t1_switches, t2_switches, access_ports): setup_vlan = SETUP_VLAN test_vlan = TEST_VLAN vlans = {setup_vlan: Vlan(description='Faucet IoT'), test_vlan: Vlan(description='Orchestrated Testing')} t1_dps = [('nz-kiwi-t1sw%s' % (dp_index + 1)) for dp_index in range(t...
def create_flat_faucet_config(self, num_switches, num_access_ports): 'Create Faucet config with flat topology' setup_vlan = SETUP_VLAN switches = [('sw%s' % (sw_num + 1)) for sw_num in range(num_switches)] dps = {} vlans = {setup_vlan: Vlan(description='Faucet IoT')} for (sw_num, sw_name) in enu...
-516,401,817,215,027,650
Create Faucet config with flat topology
testing/python_lib/build_config.py
create_flat_faucet_config
henry54809/forch
python
def create_flat_faucet_config(self, num_switches, num_access_ports): setup_vlan = SETUP_VLAN switches = [('sw%s' % (sw_num + 1)) for sw_num in range(num_switches)] dps = {} vlans = {setup_vlan: Vlan(description='Faucet IoT')} for (sw_num, sw_name) in enumerate(switches): interfaces = se...