Luis Pedro Coelho (EMBL)
Numpy provides basic data types (arrays, matrices).
Packages provide intelligence.
Python Standard Library now looks very 1990's
import mahotas as mh
from matplotlib import pyplot as plt
im = mh.imread('image_stretched.jpeg')
sigma = 2.3
imf = mh.gaussian_filter(im.mean(2), sigma)
binary = (imf > imf.mean())
labeled, _ = mh.label(binary)
plt.imshow(labeled)
template<typename T>
void bbox(const numpy::aligned_array<T> array,
numpy::index_type* extrema) {
gil_release nogil;
const int N = array.size();
typename numpy::aligned_array<T>::const_iterator pos = array.begin();
for (int i = 0; i != N; ++i, ++pos) {
if (*pos) {
numpy::position where = pos.position();
for (int j = 0; j != array.ndims(); ++j) {
extrema[2*j] = std::min<numpy::index_type>(
extrema[2*j], where[j]);
extrema[2*j+1] = std::max<numpy::index_type>(
extrema[2*j+1], where[j]+1);
} } } }
d8ff e1ff 1a39 7845 6669 0000 4949 002a 0008 0000 000c 0100 0004 0001 0000 0a00 0000 0101 0004 0001 0000 0780 0000 010f 0002 0008 0000 00b2 0000 0110 0002 000a 0000 00ba 0000 0112 0003 0001 0000 0001 0000 011a 0005 0001 0000 00c4 0000 011b 0005 0001 0000 00cc 0000 0128 0003 0001 0000 0002 0000 0131 0002 000c 0000 00d4 0000 0132 0002 0014 0000 009e 0000 0213 0003 0001 0000 0002 0000 8769 0004 0001 0000 00e0 0000 02e0 0000 3032 3431 303a 3a39 3431 3120 3a31 3533 323a 0031 4153 534d 4e55 0047 5447 492d 3138 3039 0000 0048 0000 0001 0000 0048 0000 0001 0000 3849 3931 5830 4158 414e 0032 0017 829a 0005 0001 0000 01fa 0000 829d 0005 0001 0000 0202 0000 8822 0008 0001 0000 0003 0000 8827 0003 0001 0000 0032 0000 9000 0007 0004 0000 3230 3032 9003 0002 0014 0000 021e 0000 9004 0002 0014 0000 020a
I don't have a solution.
> Are you saying that pulseaudio is entering on some weird loop if the > returned value is not -EINVAL? That seems a bug at [CLIENT APPLICATION]. If a change results in user programs breaking, it's a bug in the kernel. We never EVER blame the user programs. How hard can this be to understand?
(This is work currently under review.)
import mahotas as mh
protein = mh.imread('protein.tiff')
dna = mh.imread('dna.tiff')
plt.imshow(mh.as_rgb(dna, protein, 0))
protein = mh.gaussian_filter(protein, 1.2)
markers = np.zeros_like(protein)
markers[16::32, 16::32] = 1
markers,_ = mh.label(markers)
regions = mh.cwatershed(protein.max() - protein, markers)
features = []
fractions = []
for n in range(regions.max()):
cur_region = protein * (regions == (n+1))
features.append(mh.features.haralick(cur_region, ignore_zeros=True))
fractions.append(handlabeled[regions == (n+1)].mean())
from sklearn.ensemble import RandomForestRegressor
est = RandomForestRegressor()
est.fit(features, fractions)
Well, how good are humans (the baseline method)?
from jug import TaskGenerator
@TaskGenerator
def double(x):
return x * 2
@TaskGenerator
def print_resuls(value):
with open('output.txt', 'w') as out:
out.write("Result: {}\n".format(value))
four = double(2)
final = double(four)
print_resuls(final)
for task in alltasks:
if backend.has_data(task):
print("Task is already done")
elif backend.has_data(task.dependencies()):
if backend.lock(task):
r = task.execute()
backend.write(task.hash(), r)