This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import pythonapi, c_void_p | |
from numba import autojit | |
savethread = pythonapi.PyEval_SaveThread | |
savethread.argtypes = [] | |
savethread.restype = c_void_p | |
restorethread = pythonapi.PyEval_RestoreThread | |
restorethread.argtypes = [c_void_p] | |
restorethread.restype = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line 91, in from_ctypes_type | |
return from_ctypes_type(ctypes_type._type_).pointer() | |
File "c:\soft\Python27-32b\Lib\site-packages\numba\support\ctypes_support.py", | |
line 97, in from_ctypes_type | |
for name, field_type in ctypes_type._fields_] | |
File "c:\soft\Python27-32b\Lib\site-packages\numba\support\ctypes_support.py", | |
line 91, in from_ctypes_type | |
return from_ctypes_type(ctypes_type._type_).pointer() | |
File "c:\soft\Python27-32b\Lib\site-packages\numba\support\ctypes_support.py", | |
line 88, in from_ctypes_type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from numba import jit, double, autojit, void | |
def func(result, a): | |
for i in range(len(result)): | |
result[i] = a[i] | |
func_nb = jit(void[:](double[:], double[:]))(func) | |
#func_nb = autojit(func) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
from timeit import repeat | |
import threading | |
from ctypes import pythonapi, c_void_p | |
import math | |
import numpy as np | |
try: | |
import numexpr as ne | |
nthreads = ne.ncores |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P liam2 | |
Index: src/alignment.py | |
=================================================================== | |
--- src/alignment.py (revision 960) | |
+++ src/alignment.py (working copy) | |
@@ -2,6 +2,7 @@ | |
from itertools import izip | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src_liam/data.py b/src_liam/data.py | |
index 31fe79b..44f11b6 100644 | |
--- a/src_liam/data.py | |
+++ b/src_liam/data.py | |
@@ -35,7 +35,7 @@ def append_carray_to_table(array, table, numlines=None, buffersize=10 * MB): | |
class ColumnArray(object): | |
- def __init__(self, array=None): | |
+ def __init__(self, array=None, default_values=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entities: | |
person: | |
fields: | |
- age: int | |
- gender: bool | |
- test: {type: float, initialdata: false} | |
processes: | |
test: cont_regr(age, mult=0.5, filter=gender) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> l = [4873.40374783, | |
5821.07686377, | |
5781.99852348, | |
5555.53769711, | |
0.0, | |
0.0, | |
0.0, | |
0.0] | |
>>> a = np.array(l) | |
>>> b = np.empty((8, 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) like others pointed out, you should use a defaultdict in this case | |
# 2) otherwise use setdefault | |
output = {} | |
for element in elements: | |
output.setdefault(element["owner"], []).append(element["pet"]) | |
# 3) if, for some reason, this does not work in your case, use a dict comprehension (if available for your version of Python, 2.7+ I think) | |
output = {e["owner"]: [] for e in elements} | |
for element in elements: |
OlderNewer