Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated notebooks to import functions from qd_rdf #16

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions analyze-106.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions analyze-107.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"metadata": {},
"outputs": [],
"source": [
"L=5\n",
"dots=get_dots2(\"107/5a.tif\",compare=True,microns=L, size=2,spacing=2)\n",
"L=2\n",
"dots=get_dots(\"107/5a.tif\",compare=True,microns=L, size=5,spacing=6)\n",
"b=1/np.sqrt(len(dots)/(L*1000*1000*L))\n",
"print(b)\n",
"R.append(b)"
Expand Down Expand Up @@ -76,8 +76,8 @@
}
],
"source": [
"L=2\n",
"dots=get_dots2(\"107/2a.tif\",compare=True, microns =L, size=4,spacing=7)\n",
"\n",
"dots=get_dots2(\"107/2a.tif\",compare=True,microns=L, size=5,spacing=6)\n",
"b=1/np.sqrt(len(dots)/(L*1000*1000*L))\n",
"print(b)\n",
"R.append(b)"
Expand Down
84 changes: 20 additions & 64 deletions analyze-132.ipynb

Large diffs are not rendered by default.

80 changes: 21 additions & 59 deletions analyze-156.ipynb

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions analyze-157.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
<<<<<<< HEAD
"from qd_rdf import get_dots2, data_path, plot_rdf\n",
=======
"from qd_rdf import get_dots, data_path, plot_rdf\n",
>>>>>>> b66ca2b718b19712795a004fa36d4974dd01e60f
"import numpy as np"
]
},
{
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
Expand Down
74 changes: 25 additions & 49 deletions analyze-32.ipynb

Large diffs are not rendered by default.

96 changes: 38 additions & 58 deletions analyze-404.ipynb

Large diffs are not rendered by default.

96 changes: 38 additions & 58 deletions analyze-405.ipynb

Large diffs are not rendered by default.

46 changes: 5 additions & 41 deletions analyze-406.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,15 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from skimage.exposure import rescale_intensity\n",
"from skimage import io, filters, color, measure\n",
"from skimage.feature import peak_local_max\n",
"from scipy import ndimage \n",
"import numpy as np\n",
"import xlrd\n",
"import freud.box\n",
"from freud import box, density\n",
"from scipy import stats\n",
"import os\n",
"%matplotlib inline\n",
" \n",
"def get_dots2(file,microns=2,compare=False,size=2,spacing=5):\n",
" image = color.rgb2gray(io.imread(file))\n",
" i1 = filters.gaussian(image,sigma=.7)\n",
" i1 = ndimage.maximum_filter(i1,size=size,mode='constant')\n",
" coordinates = peak_local_max(i1, min_distance=spacing,indices=False)\n",
" if compare:\n",
" io.imshow(image -coordinates)\n",
" label_img = measure.label(coordinates)\n",
" centroids = []\n",
" for region in measure.regionprops(label_img):\n",
" centroids.append(region.centroid)\n",
" scaled = microns*np.asarray(centroids)/image.shape - [microns/2,microns/2]\n",
" return np.append(scaled,np.zeros((len(scaled),1)),axis=1)\n",
"\n",
"def plot_rdf(dots,L,plot=True):\n",
" box = freud.box.Box(L,L,is2D=True)\n",
" box.periodic=[True,True,False]\n",
" rdf = freud.density.RDF(25,.200,normalize=True) #new nums for nanometers\n",
" rdf.compute(system=(box,dots),reset=True)\n",
" if plot:\n",
" plt.scatter(rdf.bin_centers*1000, rdf.rdf)\n",
" plt.xlabel(\"r (nm)\")\n",
" plt.ylabel(\"<g(r)>\")\n",
" plt.show()\n",
" return rdf.bin_centers, rdf.rdf"
"from qd_rdf import get_dots2, data_path, plot_rdf\n",
"import numpy as np"
]
},
{
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
Expand Down
169 changes: 16 additions & 153 deletions analyze-86.ipynb

Large diffs are not rendered by default.

46 changes: 5 additions & 41 deletions analyze-87.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,15 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from skimage.exposure import rescale_intensity\n",
"from skimage import io, filters, color, measure\n",
"from skimage.feature import peak_local_max\n",
"from scipy import ndimage \n",
"import numpy as np\n",
"import xlrd\n",
"import freud.box\n",
"from freud import box, density\n",
"from scipy import stats\n",
"import os\n",
"%matplotlib inline\n",
"\n",
"def get_dots2(file,microns=2,compare=False,size=2,spacing=5):\n",
" image = color.rgb2gray(io.imread(file))\n",
" i1 = filters.gaussian(image,sigma=.7)\n",
" i1 = ndimage.maximum_filter(i1,size=size,mode='constant')\n",
" coordinates = peak_local_max(i1, min_distance=spacing,indices=False)\n",
" if compare:\n",
" io.imshow(image -coordinates)\n",
" label_img = measure.label(coordinates)\n",
" centroids = []\n",
" for region in measure.regionprops(label_img):\n",
" centroids.append(region.centroid)\n",
" scaled = microns*np.asarray(centroids)/image.shape - [microns/2,microns/2]\n",
" return np.append(scaled,np.zeros((len(scaled),1)),axis=1)\n",
"\n",
"def plot_rdf(dots,L,plot=True):\n",
" box = freud.box.Box(L,L,is2D=True)\n",
" box.periodic=[True,True,False]\n",
" rdf = freud.density.RDF(20,.49,normalize=True)\n",
" rdf.compute(system=(box,dots),reset=True)\n",
" if plot:\n",
" plt.scatter(rdf.bin_centers, rdf.rdf)\n",
" plt.xlabel(\"r (μm)\")\n",
" plt.ylabel(\"<g(r)>\")\n",
" plt.show()\n",
" return rdf.bin_centers, rdf.rdf"
"from qd_rdf import get_dots2, data_path, plot_rdf\n",
"import numpy as np"
]
},
{
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
Expand Down
7 changes: 7 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
from skimage import io
import numpy
from qd_rdf import data_path, plot_rdf, get_dots
<<<<<<< HEAD
import plot_data

test_filename = "raw_samples/106/5a.tif"
test_array = io.imread(test_filename)
=======

test_filename = "106/5a.tif"
test_array = io.imread(data_path+test_filename)
>>>>>>> b66ca2b718b19712795a004fa36d4974dd01e60f
print(type(test_array))
assert(type(test_array)==type(numpy.zeros(1)))

Expand Down
1 change: 1 addition & 0 deletions update-notebooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
for f in analyze*; do G=87.ipynb; head -n 11 analyze-106.ipynb >87.ipynb; echo -e },n{>>87.ipynb;tail -n +50 analyze-87.ipynb >>87.ipynb; done