Skip to content

Commit fa8cd48

Browse files
committed
Linted
1 parent ea82894 commit fa8cd48

15 files changed

Lines changed: 478 additions & 212 deletions

‎example_threecolour_notebooks/Step0_RenameChannels_Optional.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"folder = os.path.abspath(\n",
1313
" \"/scratch/sycamore-asap/ASAP_Imaging_Data/Louise/20260716_testPDUK\"\n",
1414
") # folder to recursively rename channel files in, replace as you wish.\n",
15-
" # Always input as the absolute path of a raw string\n",
15+
"# Always input as the absolute path of a raw string\n",
1616
"\n",
1717
"# Declare your channel-string renames here. Keys are the current substrings in\n",
1818
"# your filenames (e.g. \"C0\"), values are what you want them renamed to (e.g.\n",

‎example_threecolour_notebooks/Step1_RadialityCalibration.ipynb‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,20 @@
5555
" accepted_percentage (float): Percentage of accepted data points\n",
5656
"\n",
5757
"\"\"\"\n",
58-
"protein_string = 'C0'\n",
58+
"\n",
59+
"protein_string = \"C0\"\n",
5960
"\n",
6061
"radiality_folder = os.path.abspath(\n",
6162
" r\"../negative_control\"\n",
6263
") # example folder, replace as you wish. Always input as the absolute path of a raw string\n",
6364
"\n",
6465
"RASP.calibrate_radiality(\n",
65-
" radiality_folder, imtype=\".tif\", gsigma=1.4, rwave=2.0, accepted_percentage=1, protein_string=protein_string,\n",
66+
" radiality_folder,\n",
67+
" imtype=\".tif\",\n",
68+
" gsigma=1.4,\n",
69+
" rwave=2.0,\n",
70+
" accepted_percentage=1,\n",
71+
" protein_string=protein_string,\n",
6672
")"
6773
]
6874
},

‎example_threecolour_notebooks/Step2_SingleImageAnalysis.ipynb‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,25 @@
149149
"# RASP.bulk_sigma1 = 2.0 # rarely needs changing\n",
150150
"# RASP.bulk_sigma2 = 60.0 # rarely needs changing\n",
151151
"\n",
152-
"folder = '/scratch/sycamore-asap/ASAP_Imaging_Data/Louise/20260716_testPDUK/slide7/ROI1'\n",
152+
"folder = \"/scratch/sycamore-asap/ASAP_Imaging_Data/Louise/20260716_testPDUK/slide7/ROI1\"\n",
153153
"protein_file = os.path.abspath(\n",
154-
" os.path.join(folder, \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C561.tif\")\n",
154+
" os.path.join(\n",
155+
" folder,\n",
156+
" \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C561.tif\",\n",
157+
" )\n",
155158
") # example file, replace as you wish. Always input as the absolute path of a raw string\n",
156159
"bulk_file = os.path.abspath(\n",
157-
" os.path.join(folder, \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C488.tif\")\n",
158-
") \n",
160+
" os.path.join(\n",
161+
" folder,\n",
162+
" \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C488.tif\",\n",
163+
" )\n",
164+
")\n",
159165
"cell_file = os.path.abspath(\n",
160-
" os.path.join(folder, \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C640.tif\")\n",
161-
") \n",
166+
" os.path.join(\n",
167+
" folder,\n",
168+
" \"slide7_640_50ms-561-488_100ms_3x3roi_step250nm_1 - Position 1 [9]_XY1784188645_Z00_T0_C640.tif\",\n",
169+
" )\n",
170+
")\n",
162171
"\n",
163172
"RASP.single_image_analysis(\n",
164173
" protein_file,\n",
@@ -320,7 +329,9 @@
320329
"RASP.cell_sigma1 = preset[\"cell_sigma1\"]\n",
321330
"RASP.cell_sigma2 = preset[\"cell_sigma2\"]\n",
322331
"RASP.cell_lower_size_threshold = preset[\"cell_lower_size_threshold\"]\n",
323-
"RASP.cell_upper_size_threshold = preset[\"cell_upper_size_threshold\"] # fine-tune from here if needed\n",
332+
"RASP.cell_upper_size_threshold = preset[\n",
333+
" \"cell_upper_size_threshold\"\n",
334+
"] # fine-tune from here if needed\n",
324335
"\n",
325336
"RASP.single_image_analysis(\n",
326337
" protein_file,\n",

‎example_threecolour_notebooks/Step3_ImageFolderAnalysis.ipynb‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"metadata": {},
2222
"outputs": [],
2323
"source": [
24-
"RASP.flatness = 1.\n",
25-
"RASP.integratedGrad = 10.\n",
26-
"RASP.areathres = 42.\n",
24+
"RASP.flatness = 1.0\n",
25+
"RASP.integratedGrad = 10.0\n",
26+
"RASP.areathres = 42.0\n",
2727
"\n",
2828
"# Cell and bulk-stain detection parameters tuned in Step2_SingleImageAnalysis.ipynb\n",
2929
"# persist as attributes on RASP -- set them here if you're running this notebook\n",

‎example_threecolour_notebooks/Step4_CountPunctaInCells.ipynb‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@
7272
"cell_string = \"C0\"\n",
7373
"\n",
7474
"threshold_lower = 0.0 # photon threshold; puncta with sum_intensity_in_photons\n",
75-
" # above this are counted\n",
76-
"lower_cell_size_threshold = 2000.0 # voxels; tune against Optional_CellMask_SizeThresholding.ipynb\n",
75+
"# above this are counted\n",
76+
"lower_cell_size_threshold = (\n",
77+
" 2000.0 # voxels; tune against Optional_CellMask_SizeThresholding.ipynb\n",
78+
")\n",
7779
"upper_cell_size_threshold = np.inf"
7880
]
7981
},
@@ -94,8 +96,10 @@
9496
" )\n",
9597
" analysis_data = analysis_data.filter(pl.col(\"overlap_with_bulk_stain\"))\n",
9698
"\n",
97-
"print(f\"{len(analysis_data)} puncta going into cell assignment \"\n",
98-
" f\"(restrict_to_bulk_stain={restrict_to_bulk_stain})\")"
99+
"print(\n",
100+
" f\"{len(analysis_data)} puncta going into cell assignment \"\n",
101+
" f\"(restrict_to_bulk_stain={restrict_to_bulk_stain})\"\n",
102+
")"
99103
]
100104
},
101105
{

‎example_twocolour_notebooks/00_START_HERE.ipynb‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@
2323
"execution_count": null,
2424
"metadata": {},
2525
"outputs": [],
26-
"source": "# Run this cell to verify pyRASP is importable before proceeding\nimport sys\nsys.path.append('..')\n\nfrom src import RASPRoutines, AnalysisFunctions, IOFunctions, PlottingFunctions\nprint(\"pyRASP imported successfully.\")"
26+
"source": [
27+
"# Run this cell to verify pyRASP is importable before proceeding\n",
28+
"import sys\n",
29+
"\n",
30+
"sys.path.append(\"..\")\n",
31+
"\n",
32+
"from src import RASPRoutines, AnalysisFunctions, IOFunctions, PlottingFunctions\n",
33+
"\n",
34+
"print(\"pyRASP imported successfully.\")"
35+
]
2736
},
2837
{
2938
"cell_type": "markdown",

‎example_twocolour_notebooks/Step0_RenameChannels_Optional.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"folder = os.path.abspath(\n",
1212
" r\"../example_images\"\n",
1313
") # folder to recursively rename channel files in, replace as you wish.\n",
14-
" # Always input as the absolute path of a raw string\n",
14+
"# Always input as the absolute path of a raw string\n",
1515
"\n",
1616
"# Declare your channel-string renames here. Keys are the current substrings in\n",
1717
"# your filenames (e.g. \"C0\"), values are what you want them renamed to (e.g.\n",

‎example_twocolour_notebooks/Step1_RadialityCalibration.ipynb‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,20 @@
5555
" accepted_percentage (float): Percentage of accepted data points\n",
5656
"\n",
5757
"\"\"\"\n",
58-
"protein_string = 'C0'\n",
58+
"\n",
59+
"protein_string = \"C0\"\n",
5960
"\n",
6061
"radiality_folder = os.path.abspath(\n",
6162
" r\"../negative_control\"\n",
6263
") # example folder, replace as you wish. Always input as the absolute path of a raw string\n",
6364
"\n",
6465
"RASP.calibrate_radiality(\n",
65-
" radiality_folder, imtype=\".tif\", gsigma=1.4, rwave=2.0, accepted_percentage=1, protein_string=protein_string,\n",
66+
" radiality_folder,\n",
67+
" imtype=\".tif\",\n",
68+
" gsigma=1.4,\n",
69+
" rwave=2.0,\n",
70+
" accepted_percentage=1,\n",
71+
" protein_string=protein_string,\n",
6672
")"
6773
]
6874
},

‎example_twocolour_notebooks/Step2_SingleImageAnalysis.ipynb‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,20 @@
219219
"- upper_lo_size_threshold (float): upper threshold of large object size\n",
220220
"\n",
221221
"\"\"\"\n",
222+
"\n",
222223
"RASP.focus_score_diff = 0.2\n",
223224
"base_folder = \"/scratch/sycamore-asap/ASAP_Imaging_Data/Jonathan/Sycamore/20250115_DVP_pretreatment_optimisation/slide4_scan2\"\n",
224225
"protein_file = os.path.abspath(\n",
225-
" os.path.join(base_folder, \"202050121_DVP_pretreatment_optimisation_S4_scan2 - Position 1 [900]_XY1737471395_Z00_T026_C1.tif\")\n",
226+
" os.path.join(\n",
227+
" base_folder,\n",
228+
" \"202050121_DVP_pretreatment_optimisation_S4_scan2 - Position 1 [900]_XY1737471395_Z00_T026_C1.tif\",\n",
229+
" )\n",
226230
") # example file, replace as you wish. Always input as the absolute path of a raw string\n",
227231
"cell_file = os.path.abspath(\n",
228-
" os.path.join(base_folder, \"202050121_DVP_pretreatment_optimisation_S4_scan2 - Position 1 [900]_XY1737471395_Z00_T026_C0.tif\")\n",
232+
" os.path.join(\n",
233+
" base_folder,\n",
234+
" \"202050121_DVP_pretreatment_optimisation_S4_scan2 - Position 1 [900]_XY1737471395_Z00_T026_C0.tif\",\n",
235+
" )\n",
229236
") # the real cell-channel companion of protein_file above (same acquisition, C0)\n",
230237
"\n",
231238
"# Cell-detection parameters: cell masks are detected with a full 3D pipeline\n",
@@ -264,7 +271,9 @@
264271
"RASP.cell_sigma1 = preset[\"cell_sigma1\"]\n",
265272
"RASP.cell_sigma2 = preset[\"cell_sigma2\"]\n",
266273
"RASP.cell_lower_size_threshold = preset[\"cell_lower_size_threshold\"]\n",
267-
"RASP.cell_upper_size_threshold = preset[\"cell_upper_size_threshold\"] # fine-tune from here if needed\n",
274+
"RASP.cell_upper_size_threshold = preset[\n",
275+
" \"cell_upper_size_threshold\"\n",
276+
"] # fine-tune from here if needed\n",
268277
"\n",
269278
"RASP.single_image_analysis(\n",
270279
" protein_file,\n",
@@ -506,13 +515,20 @@
506515
"- upper_lo_size_threshold (float): upper threshold of large object size\n",
507516
"\n",
508517
"\"\"\"\n",
518+
"\n",
509519
"RASP.focus_score_diff = 0.2\n",
510520
"base_folder = \"/scratch/sycamore-asap/ASAP_Imaging_Data/Main_Survey/20241105_oligomers_in_cells/cingulate/microglia/PD/PD10\"\n",
511521
"protein_file = os.path.abspath(\n",
512-
" os.path.join(base_folder, \"20231018_MS_R3_S50_SS1 - Position 1 [9]_XY1697644814_Z00_T0_C1.tif\")\n",
522+
" os.path.join(\n",
523+
" base_folder,\n",
524+
" \"20231018_MS_R3_S50_SS1 - Position 1 [9]_XY1697644814_Z00_T0_C1.tif\",\n",
525+
" )\n",
513526
") # example file, replace as you wish. Always input as the absolute path of a raw string\n",
514527
"cell_file = os.path.abspath(\n",
515-
" os.path.join(base_folder, \"20231018_MS_R3_S50_SS1 - Position 1 [9]_XY1697644814_Z00_T0_C0.tif\")\n",
528+
" os.path.join(\n",
529+
" base_folder,\n",
530+
" \"20231018_MS_R3_S50_SS1 - Position 1 [9]_XY1697644814_Z00_T0_C0.tif\",\n",
531+
" )\n",
516532
") # the real cell-channel companion of protein_file above (same acquisition, C0)\n",
517533
"\n",
518534
"# Cell-detection parameters: cell masks are detected with a full 3D pipeline\n",
@@ -551,7 +567,9 @@
551567
"RASP.cell_sigma1 = preset[\"cell_sigma1\"]\n",
552568
"RASP.cell_sigma2 = preset[\"cell_sigma2\"]\n",
553569
"RASP.cell_lower_size_threshold = preset[\"cell_lower_size_threshold\"]\n",
554-
"RASP.cell_upper_size_threshold = preset[\"cell_upper_size_threshold\"] # fine-tune from here if needed\n",
570+
"RASP.cell_upper_size_threshold = preset[\n",
571+
" \"cell_upper_size_threshold\"\n",
572+
"] # fine-tune from here if needed\n",
555573
"\n",
556574
"RASP.single_image_analysis(\n",
557575
" protein_file,\n",

‎example_twocolour_notebooks/Step3_ImageFolderAnalysis.ipynb‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"metadata": {},
2424
"outputs": [],
2525
"source": [
26-
"RASP.flatness = 1.\n",
27-
"RASP.integratedGrad = 10.\n",
28-
"RASP.areathres = 42."
26+
"RASP.flatness = 1.0\n",
27+
"RASP.integratedGrad = 10.0\n",
28+
"RASP.areathres = 42.0"
2929
]
3030
},
3131
{
@@ -71,7 +71,14 @@
7171
" r\"C:\\Users\\jsb92\\Cambridge University Dropbox\\Joseph Beckwith\\Chemistry\\Lee\\Code\\Python\\pyRASP\\example_images\"\n",
7272
") # example file, replace as you wish. Always input as the absolute path of a raw string\n",
7373
"\n",
74-
"RASP.analyse_images(folder, protein_string=\"C0\", focus_images=\"C0\", thres=0.025, large_thres=1000.0, cell_analysis=False)"
74+
"RASP.analyse_images(\n",
75+
" folder,\n",
76+
" protein_string=\"C0\",\n",
77+
" focus_images=\"C0\",\n",
78+
" thres=0.025,\n",
79+
" large_thres=1000.0,\n",
80+
" cell_analysis=False,\n",
81+
")"
7582
]
7683
}
7784
],

0 commit comments

Comments
 (0)