-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
17 changed files
with
2,355 additions
and
0 deletions.
There are no files selected for viewing
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,78 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue May 22 2020 | ||
@author: Ben | ||
# This program reads a txt file with the analyzed cell position, shape (semi-major and semi-minor axis etc.), | ||
# computes the cell strain and the fluid shear stress acting on each cell, | ||
# plots the data (strain versus stress) for each cell using a kernel density estimate for the datapoint color, | ||
# and fits a stress stiffening equation to the data | ||
# The results such as maximum flow speed, cell mechanical parameters, etc. are stored in | ||
# the file 'all_data.txt' located at the same directory as this script | ||
""" | ||
|
||
from scripts.helper_functions import load_all_data, fitStiffness | ||
from scripts.helper_functions import plotStressStrain, plotStressStrainFit | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
import pylustrator | ||
|
||
pylustrator.start() | ||
|
||
data3, config3 = load_all_data([ | ||
r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope_1\september_2020\2020_09_30_alginate2%_NIH3T3_blebbistatin\inlet\[0-9]\*_result.txt" | ||
], pressure=3) | ||
|
||
data3b, config3b = load_all_data([ | ||
r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope_1\september_2020\2020_09_30_alginate2%_NIH3T3_DMSO\inlet\[0-9]\*_result.txt", | ||
], pressure=3) | ||
|
||
fitStiffness(data3, config3) | ||
fitStiffness(data3b, config3b) | ||
|
||
plt.subplot(121) | ||
plotStressStrain(data3b, config3b) | ||
plotStressStrainFit(data3b, config3b) | ||
plt.title("DMSO") | ||
|
||
plt.text(0.5, 0.5, f"k = {config3b['fit']['p'][0]:3.0f} Pa\n$\\alpha$ = {config3b['fit']['p'][1]:2.2f}") | ||
|
||
plt.subplot(122) | ||
plotStressStrain(data3, config3) | ||
plotStressStrainFit(data3, config3) | ||
plt.title("blebbistation") | ||
|
||
plt.text(0.5, 0.5, f"k = {config3['fit']['p'][0]:3.0f} Pa\n$\\alpha$ = {config3['fit']['p'][1]:2.2f}") | ||
|
||
print("p3b", config3b["fit"]["p"]) | ||
print("p3", config3["fit"]["p"]) | ||
|
||
#% start: automatic generated code from pylustrator | ||
plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} | ||
import matplotlib as mpl | ||
plt.figure(1).set_size_inches(12.000000/2.54, 5.530000/2.54, forward=True) | ||
plt.figure(1).axes[0].set_position([0.111446, 0.213746, 0.345357, 0.672724]) | ||
plt.figure(1).axes[0].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[0].set_ylim(-0.0, 1.0) | ||
plt.figure(1).axes[0].set_yticklabels(["0.0", "0.2", "0.4", "0.6", "0.8", "1.0"], fontsize=10) | ||
plt.figure(1).axes[0].set_yticks([0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0]) | ||
plt.figure(1).axes[0].spines['right'].set_visible(False) | ||
plt.figure(1).axes[0].spines['top'].set_visible(False) | ||
plt.figure(1).axes[0].lines[3].set_markersize(2.0) | ||
plt.figure(1).axes[0].texts[0].set_position([249.328258, 0.049992]) | ||
plt.figure(1).axes[1].set_position([0.559253, 0.213746, 0.345357, 0.672724]) | ||
plt.figure(1).axes[1].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[1].set_ylim(0.0, 1.0) | ||
plt.figure(1).axes[1].set_yticklabels(["", "", "", "", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[1].set_yticks([0.0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0]) | ||
plt.figure(1).axes[1].spines['right'].set_visible(False) | ||
plt.figure(1).axes[1].spines['top'].set_visible(False) | ||
plt.figure(1).axes[1].lines[3].set_markersize(2.0) | ||
plt.figure(1).axes[1].texts[0].set_position([260.352304, 0.049992]) | ||
plt.figure(1).axes[1].get_yaxis().get_label().set_text("") | ||
#% end: automatic generated code from pylustrator | ||
plt.savefig(__file__[:-3] + ".png", dpi=300) | ||
plt.savefig(__file__[:-3] + ".pdf") | ||
plt.show() |
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,177 @@ | ||
# -*- coding: utf-8 -*- | ||
import matplotlib.pyplot as plt | ||
from scripts.helper_functions import load_all_data, plotDensityScatter, plotBinnedData | ||
import numpy as np | ||
from scipy import stats | ||
|
||
import pylustrator | ||
pylustrator.start() | ||
|
||
numbers = [] | ||
for row, name in enumerate(["inlet", "middle", "outlet"]): | ||
for index, pressure in enumerate([1, 2, 3]): | ||
ax = plt.subplot(3, 3, 3*row+index+1) | ||
|
||
#data, config = load_all_data(r"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data" + | ||
# r"\microscope4\2020_july\2020_07_21_alginate2%_dmem_NIH_time_2\[0-9]\*_result.txt", pressure=pressure) | ||
data, config = load_all_data([ | ||
rf"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_2\{name}\[0-9]\*_result.txt", | ||
rf"\\131.188.117.96\biophysDS\emirzahossein\microfluidic cell rhemeter data\microscope4\2020_july\2020_07_29_aslginate2%_NIH_diff_x_position_3\{name}\[0-9]\*_result.txt", | ||
], pressure=pressure) | ||
|
||
x, y = np.array(data.stress), np.array(np.abs(data.angle)) | ||
plotDensityScatter(x, y) | ||
plotBinnedData(x, y, np.arange(0, 300, 50)) | ||
|
||
numbers.append(len(data.rp)) | ||
|
||
print("numbers", numbers) | ||
|
||
#plt.legend() | ||
#% start: automatic generated code from pylustrator | ||
plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes} | ||
import matplotlib as mpl | ||
plt.figure(1).set_size_inches(15.360000/2.54, 9.570000/2.54, forward=True) | ||
plt.figure(1).axes[0].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[0].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[0].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[0].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[0].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[0].set_yticklabels(["0", "20", "40"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[0].set_position([0.130165, 0.699295, 0.246468, 0.249562]) | ||
plt.figure(1).axes[0].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[0].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[0].spines['right'].set_visible(False) | ||
plt.figure(1).axes[0].spines['top'].set_visible(False) | ||
plt.figure(1).axes[0].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[0].transAxes) # id=plt.figure(1).axes[0].texts[0].new | ||
plt.figure(1).axes[0].texts[0].set_ha("center") | ||
plt.figure(1).axes[0].texts[0].set_position([0.500000, 1.040243]) | ||
plt.figure(1).axes[0].texts[0].set_text("1 bar") | ||
plt.figure(1).axes[0].get_xaxis().get_label().set_text("radial position (µm)") | ||
plt.figure(1).axes[0].get_yaxis().get_label().set_text("angle (deg)") | ||
plt.figure(1).axes[1].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[1].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[1].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[1].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[1].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[1].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[1].set_position([0.416835, 0.699295, 0.246468, 0.249562]) | ||
plt.figure(1).axes[1].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[1].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[1].spines['right'].set_visible(False) | ||
plt.figure(1).axes[1].spines['top'].set_visible(False) | ||
plt.figure(1).axes[1].xaxis.labelpad = 3.716691 | ||
plt.figure(1).axes[1].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[1].transAxes) # id=plt.figure(1).axes[1].texts[0].new | ||
plt.figure(1).axes[1].texts[0].set_ha("center") | ||
plt.figure(1).axes[1].texts[0].set_position([0.500000, 1.040243]) | ||
plt.figure(1).axes[1].texts[0].set_text("2 bar") | ||
plt.figure(1).axes[1].get_xaxis().get_label().set_text("radial position (µm)") | ||
plt.figure(1).axes[2].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[2].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[2].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[2].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[2].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[2].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[2].set_position([0.705302, 0.699295, 0.246468, 0.249562]) | ||
plt.figure(1).axes[2].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[2].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[2].spines['right'].set_visible(False) | ||
plt.figure(1).axes[2].spines['top'].set_visible(False) | ||
plt.figure(1).axes[2].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[2].transAxes) # id=plt.figure(1).axes[2].texts[0].new | ||
plt.figure(1).axes[2].texts[0].set_ha("center") | ||
plt.figure(1).axes[2].texts[0].set_position([0.500000, 1.040243]) | ||
plt.figure(1).axes[2].texts[0].set_text("3 bar") | ||
plt.figure(1).axes[2].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[2].transAxes) # id=plt.figure(1).axes[2].texts[1].new | ||
plt.figure(1).axes[2].texts[1].set_ha("center") | ||
plt.figure(1).axes[2].texts[1].set_position([1.015452, 0.430286]) | ||
plt.figure(1).axes[2].texts[1].set_rotation(90.0) | ||
plt.figure(1).axes[2].texts[1].set_text("inlet") | ||
plt.figure(1).axes[2].get_xaxis().get_label().set_text("radial position (µm)") | ||
plt.figure(1).axes[3].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[3].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[3].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[3].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[3].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[3].set_yticklabels(["0", "20", "40"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[3].set_position([0.130165, 0.417189, 0.246468, 0.249562]) | ||
plt.figure(1).axes[3].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[3].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[3].spines['right'].set_visible(False) | ||
plt.figure(1).axes[3].spines['top'].set_visible(False) | ||
plt.figure(1).axes[3].get_yaxis().get_label().set_text("angle (deg)") | ||
plt.figure(1).axes[4].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[4].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[4].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[4].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[4].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[4].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[4].set_position([0.416835, 0.417189, 0.246468, 0.249562]) | ||
plt.figure(1).axes[4].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[4].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[4].spines['right'].set_visible(False) | ||
plt.figure(1).axes[4].spines['top'].set_visible(False) | ||
plt.figure(1).axes[5].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[5].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[5].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[5].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[5].set_xticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[5].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[5].set_position([0.705302, 0.417189, 0.246468, 0.249562]) | ||
plt.figure(1).axes[5].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[5].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[5].spines['right'].set_visible(False) | ||
plt.figure(1).axes[5].spines['top'].set_visible(False) | ||
plt.figure(1).axes[5].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[5].transAxes) # id=plt.figure(1).axes[5].texts[0].new | ||
plt.figure(1).axes[5].texts[0].set_ha("center") | ||
plt.figure(1).axes[5].texts[0].set_position([1.015452, 0.375669]) | ||
plt.figure(1).axes[5].texts[0].set_rotation(90.0) | ||
plt.figure(1).axes[5].texts[0].set_text("middle") | ||
plt.figure(1).axes[6].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[6].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[6].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[6].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[6].set_xticklabels(["0", "100", "200"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[6].set_yticklabels(["0", "20", "40"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[6].set_position([0.130165, 0.135083, 0.246468, 0.249562]) | ||
plt.figure(1).axes[6].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[6].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[6].spines['right'].set_visible(False) | ||
plt.figure(1).axes[6].spines['top'].set_visible(False) | ||
plt.figure(1).axes[6].get_xaxis().get_label().set_text("shear stress (Pa)") | ||
plt.figure(1).axes[6].get_yaxis().get_label().set_text("angle (deg)") | ||
plt.figure(1).axes[7].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[7].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[7].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[7].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[7].set_xticklabels(["0", "100", "200"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[7].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[7].set_position([0.416835, 0.135083, 0.246468, 0.249562]) | ||
plt.figure(1).axes[7].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[7].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[7].spines['right'].set_visible(False) | ||
plt.figure(1).axes[7].spines['top'].set_visible(False) | ||
plt.figure(1).axes[7].get_xaxis().get_label().set_text("shear stress (Pa)") | ||
plt.figure(1).axes[8].set_xlim(0.0, 300.0) | ||
plt.figure(1).axes[8].set_ylim(0.0, 40.0) | ||
plt.figure(1).axes[8].set_xticks([0.0, 100.0, 200.0]) | ||
plt.figure(1).axes[8].set_yticks([0.0, 20.0, 40.0]) | ||
plt.figure(1).axes[8].set_xticklabels(["0", "100", "200"], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="center") | ||
plt.figure(1).axes[8].set_yticklabels(["", "", ""], fontsize=10.0, fontweight="normal", color="black", fontstyle="normal", fontname="Arial", horizontalalignment="right") | ||
plt.figure(1).axes[8].set_position([0.705302, 0.135083, 0.246468, 0.249562]) | ||
plt.figure(1).axes[8].set_xticklabels(["", "", ""], minor=True) | ||
plt.figure(1).axes[8].set_xticks([50.0, 150.0, 250.0], minor=True) | ||
plt.figure(1).axes[8].spines['right'].set_visible(False) | ||
plt.figure(1).axes[8].spines['top'].set_visible(False) | ||
plt.figure(1).axes[8].text(0.5, 0.5, 'New Text', transform=plt.figure(1).axes[8].transAxes) # id=plt.figure(1).axes[8].texts[0].new | ||
plt.figure(1).axes[8].texts[0].set_ha("center") | ||
plt.figure(1).axes[8].texts[0].set_position([1.015452, 0.400091]) | ||
plt.figure(1).axes[8].texts[0].set_rotation(90.0) | ||
plt.figure(1).axes[8].texts[0].set_text("outlet") | ||
plt.figure(1).axes[8].get_xaxis().get_label().set_text("shear stress (Pa)") | ||
#% end: automatic generated code from pylustrator | ||
plt.savefig(__file__[:-3]+".png", dpi=300) | ||
plt.savefig(__file__[:-3]+".pdf") | ||
|
||
plt.show() | ||
|
||
|
Oops, something went wrong.