Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahhh committed Apr 8, 2016
0 parents commit 70de0ef
Show file tree
Hide file tree
Showing 18 changed files with 7,142 additions and 0 deletions.
1,469 changes: 1,469 additions & 0 deletions Image processing.ipynb

Large diffs are not rendered by default.

139 changes: 139 additions & 0 deletions Untitled.ipynb
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
}
44 changes: 44 additions & 0 deletions Untitled1.ipynb
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
}
Loading

0 comments on commit 70de0ef

Please sign in to comment.