Skip to content

Commit

Permalink
Merge pull request #237 from jadball/scanbooks
Browse files Browse the repository at this point in the history
Weekend feedback for scanning notebooks
  • Loading branch information
jonwright authored Mar 4, 2024
2 parents 8283041 + 2f96a3b commit 6662056
Show file tree
Hide file tree
Showing 14 changed files with 307 additions and 248 deletions.
26 changes: 13 additions & 13 deletions ImageD11/nbGui/3DXRD/0_3DXRD_segment_frelon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
"source": [
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"# check whether we already have ImageD11 here\n",
"\n",
Expand Down Expand Up @@ -77,17 +78,16 @@
},
"outputs": [],
"source": [
"# There is a bug with the current version of ImageD11 in the site-wide Jupyter env.\n",
"# This has been fixed here: https://github.com/FABLE-3DXRD/ImageD11/commit/4af88b886b1775585e868f2339a0eb975401468f\n",
"# Until a new release has been made and added to the env, we need to get the latest version of ImageD11 from GitHub\n",
"# Put it in your home directory\n",
"# USER: Change the path below to point to your local copy of ImageD11:\n",
"\n",
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"import sys\n",
"\n",
Expand Down Expand Up @@ -391,13 +391,13 @@
{
"cell_type": "code",
"execution_count": null,
"id": "39fc939e-a6cd-425f-8fea-2b65e2551358",
"id": "88fe5554-8b0a-4c17-a2a1-02536e476c42",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"cf_2d = utils.apply_spatial(cf_2d, spline_file, nthreads)"
"cf_2d = utils.apply_spatial_lut(cf_2d, spline_file)"
]
},
{
Expand All @@ -409,7 +409,7 @@
},
"outputs": [],
"source": [
"cf_3d = utils.apply_spatial(cf_3d, spline_file, nthreads)"
"cf_3d = utils.apply_spatial_lut(cf_3d, spline_file)"
]
},
{
Expand Down Expand Up @@ -472,9 +472,9 @@
"metadata": {},
"outputs": [],
"source": [
"# Now that we're happy with our segmentation parameters, we can run the below cell to do this in bulk for many samples/datasets\n",
"# Now that we're happy with our indexing parameters, we can run the below cell to do this in bulk for many samples/datasets\n",
"# by default this will do all samples in sample_list, all datasets with a prefix of dset_prefix\n",
"# you can add samples and datasets to skip\n",
"# you can add samples and datasets to skip in skips_dict\n",
"\n",
"skips_dict = {\n",
" \"FeAu_0p5_tR\": []\n",
Expand Down
25 changes: 12 additions & 13 deletions ImageD11/nbGui/3DXRD/1_3DXRD_refine_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@
},
"outputs": [],
"source": [
"# There is a bug with the current version of ImageD11 in the site-wide Jupyter env.\n",
"# This has been fixed here: https://github.com/FABLE-3DXRD/ImageD11/commit/4af88b886b1775585e868f2339a0eb975401468f\n",
"# Until a new release has been made and added to the env, we need to get the latest version of ImageD11 from GitHub\n",
"# Put it in your home directory\n",
"# USER: Change the path below to point to your local copy of ImageD11:\n",
"\n",
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"import sys\n",
"\n",
Expand Down Expand Up @@ -128,7 +127,7 @@
"\n",
"# USER: specify the path to the parameter file\n",
"\n",
"parfile = '/home/esrf/james1997a/Data/ihma439/id11/20231211/PROCESSED_DATA/James/20240226/Fe_refined_tdxrd.par'\n",
"parfile = '/home/esrf/james1997a/Data/ihma439/id11/20231211/PROCESSED_DATA/James/20240226/Fe_tdxrd_refined.par'\n",
"spline_file = '/data/id11/inhouse1/ewoks/detectors/files/Frelon2k_C36/frelon36.spline'"
]
},
Expand Down Expand Up @@ -197,14 +196,14 @@
},
"outputs": [],
"source": [
"# here we are filtering our peaks (cf_2d) to select only the strongest ones for indexing purposes only!\n",
"# dsmax is being set to limit rings given to the indexer\n",
"# because we have so many 3d peaks, we will filter down to 3 rings\n",
"# here we are filtering our peaks (cf_3d) to select only the strongest ones for indexing purposes only!\n",
"# dsmax is being set to limit rings given to the indexer - 6-8 rings is normally good\n",
"\n",
"# USER: modify the \"frac\" parameter below and re-run the cell until we have around 10,000 peaks for indexing\n",
"# we may choose more for the full index in the next notebook, but for now we want to quickly index only our strong grains\n",
"# USER: modify the \"frac\" parameter below and re-run the cell until the orange dot sits nicely on the \"elbow\" of the blue line\n",
"# this indicates the fractional intensity cutoff we will select\n",
"# if the blue line does not look elbow-shaped in the logscale plot, try changing the \"doplot\" parameter (the y scale of the logscale plot) until it does\n",
"\n",
"cf_strong = utils.selectpeaks(cf_3d, frac=0.95, dsmax=0.92, doplot=0.05, dstol=0.01)\n",
"cf_strong = utils.selectpeaks(cf_3d, frac=0.985, dsmax=0.92, doplot=0.8, dstol=0.01)\n",
"print(f\"Got {cf_strong.nrows} strong peaks for indexing\")\n",
"cf_strong.writefile(f'{sample}_{dataset}_3d_peaks_strong.flt')"
]
Expand Down
24 changes: 12 additions & 12 deletions ImageD11/nbGui/3DXRD/2_3DXRD_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
},
"outputs": [],
"source": [
"# There is a bug with the current version of ImageD11 in the site-wide Jupyter env.\n",
"# This has been fixed here: https://github.com/FABLE-3DXRD/ImageD11/commit/4af88b886b1775585e868f2339a0eb975401468f\n",
"# Until a new release has been made and added to the env, we need to get the latest version of ImageD11 from GitHub\n",
"# Put it in your home directory\n",
"# USER: Change the path below to point to your local copy of ImageD11:\n",
"\n",
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"import sys\n",
"\n",
Expand Down Expand Up @@ -211,13 +210,14 @@
},
"outputs": [],
"source": [
"# here we are filtering our peaks (cf_2d) to select only the strongest ones for indexing purposes only!\n",
"# dsmax is being set to limit rings given to the indexer\n",
"# because we have so many 3d peaks, we will filter down to 3 rings\n",
"# here we are filtering our peaks (cf_3d) to select only the strongest ones for indexing purposes only!\n",
"# dsmax is being set to limit rings given to the indexer - 6-8 rings is normally good\n",
"\n",
"# USER: modify the \"frac\" parameter below and re-run the cell until we have around 25,000 peaks for indexing\n",
"# USER: modify the \"frac\" parameter below and re-run the cell until the orange dot sits nicely on the \"elbow\" of the blue line\n",
"# this indicates the fractional intensity cutoff we will select\n",
"# if the blue line does not look elbow-shaped in the logscale plot, try changing the \"doplot\" parameter (the y scale of the logscale plot) until it does\n",
"\n",
"cf_strong = utils.selectpeaks(cf_3d, frac=0.95, dsmax=0.92, doplot=0.05, dstol=0.01)\n",
"cf_strong = utils.selectpeaks(cf_3d, frac=0.9837, dsmax=0.92, doplot=0.8, dstol=0.01)\n",
"print(f\"Got {cf_strong.nrows} strong peaks for indexing\")\n",
"cf_strong.writefile(f'{sample}_{dataset}_3d_peaks_strong.flt')"
]
Expand Down Expand Up @@ -680,7 +680,7 @@
"source": [
"# Now that we're happy with our indexing parameters, we can run the below cell to do this in bulk for many samples/datasets\n",
"# by default this will do all samples in sample_list, all datasets with a prefix of dset_prefix\n",
"# you can add samples and datasets to skip\n",
"# you can add samples and datasets to skip in skips_dict\n",
"\n",
"skips_dict = {\n",
" \"FeAu_0p5_tR\": []\n",
Expand Down
11 changes: 5 additions & 6 deletions ImageD11/nbGui/3DXRD/3_3DXRD_look_at_peaks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
},
"outputs": [],
"source": [
"# There is a bug with the current version of ImageD11 in the site-wide Jupyter env.\n",
"# This has been fixed here: https://github.com/FABLE-3DXRD/ImageD11/commit/4af88b886b1775585e868f2339a0eb975401468f\n",
"# Until a new release has been made and added to the env, we need to get the latest version of ImageD11 from GitHub\n",
"# Put it in your home directory\n",
"# USER: Change the path below to point to your local copy of ImageD11:\n",
"\n",
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"import sys\n",
"\n",
Expand Down
11 changes: 5 additions & 6 deletions ImageD11/nbGui/3DXRD/4_3DXRD_merge_slices.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
},
"outputs": [],
"source": [
"# There is a bug with the current version of ImageD11 in the site-wide Jupyter env.\n",
"# This has been fixed here: https://github.com/FABLE-3DXRD/ImageD11/commit/4af88b886b1775585e868f2339a0eb975401468f\n",
"# Until a new release has been made and added to the env, we need to get the latest version of ImageD11 from GitHub\n",
"# Put it in your home directory\n",
"# USER: Change the path below to point to your local copy of ImageD11:\n",
"\n",
"import os\n",
"\n",
"username = os.environ.get(\"USER\")\n",
"home_dir = !echo $HOME\n",
"home_dir = str(home_dir[0])\n",
"\n",
"id11_code_path = f\"/home/esrf/{username}/Code/ImageD11\"\n",
"# USER: You can change this location if you want\n",
"\n",
"id11_code_path = os.path.join(home_dir, \"Code/ImageD11\")\n",
"\n",
"import sys\n",
"\n",
Expand Down
Loading

0 comments on commit 6662056

Please sign in to comment.