-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 70de0ef
Showing
18 changed files
with
7,142 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy\n", | ||
"import multiprocessing\n", | ||
"import time" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"pool = multiprocessing.dummy.Pool()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Control: No powers\n", | ||
"59985997.0712 0.139564037323\n", | ||
"Single process\n", | ||
"15981208.9044 3.03516697884\n", | ||
"Several processes\n", | ||
"15981208.9044 1.16520905495\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"def test(n):\n", | ||
" x = numpy.random.rand(n)\n", | ||
" \n", | ||
" print 'Control: No powers'\n", | ||
" acc = numpy.zeros(n)\n", | ||
" now = time.time()\n", | ||
" for i in range(30):\n", | ||
" acc += x\n", | ||
" s = acc.sum()\n", | ||
" print s, time.time() - now\n", | ||
" \n", | ||
" print 'Single process'\n", | ||
" acc = numpy.zeros(n)\n", | ||
" now = time.time()\n", | ||
" for i in range(30):\n", | ||
" acc += x ** i\n", | ||
" s = acc.sum()\n", | ||
" print s, time.time() - now\n", | ||
" \n", | ||
" print 'Several processes'\n", | ||
" acc = numpy.zeros(n)\n", | ||
" now = time.time()\n", | ||
" def pow(i):\n", | ||
" return x ** i\n", | ||
" exps = pool.map(pow, range(30))\n", | ||
" for exp in exps:\n", | ||
" acc += exp\n", | ||
" s = acc.sum()\n", | ||
" print s, time.time() - now\n", | ||
"\n", | ||
"test(4000000)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def test(x):\n", | ||
" return x * x\n", | ||
"\n", | ||
"p = Process(target=test, args=(3,))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"p.start()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"p." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import stitching\n", | ||
"import spimage\n", | ||
"import cPickle as pickle\n", | ||
"\n", | ||
"job = pickle.load(open('conc_1.job', 'wb'))\n", | ||
"\n", | ||
"job.detail_transfer_stitch_pt_2(canvas_scale=2, detail_transfer_radius=33, edge_blend_radius=5)\n", | ||
"\n", | ||
"job.detail_transfer_stitch_output().save('conc.png')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.11" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Oops, something went wrong.