Skip to content

Commit

Permalink
Merge pull request #345 from jadball/master
Browse files Browse the repository at this point in the history
Fix strain to stress conversion in TensorMap class, better TensorMap documentation
  • Loading branch information
jadball authored Nov 6, 2024
2 parents 927ca86 + f159837 commit d039e0c
Show file tree
Hide file tree
Showing 16 changed files with 624 additions and 604 deletions.
3 changes: 2 additions & 1 deletion ImageD11/nbGui/S3DXRD/4_visualise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"source": [
"# load phases from parameter file\n",
"\n",
"ds.phases = ds.get_phases_from_disk()"
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions ImageD11/nbGui/S3DXRD/5_combine_phases.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@
"source": [
"# load phases from parameter file\n",
"\n",
"phases = ds.get_phases_from_disk()\n",
"ds.phases = phases\n",
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
Expand Down
20 changes: 16 additions & 4 deletions ImageD11/nbGui/S3DXRD/6_stack_layers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@
"print(ds.shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8ea038db-b86c-4ce3-9117-83060f68351e",
"metadata": {},
"outputs": [],
"source": [
"# load phases from parameter file\n",
"\n",
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -95,12 +108,12 @@
"samples_dict = {}\n",
"\n",
"skips_dict = {\n",
" \"FeAu_0p5_tR_nscope\": [\"top_100um\", \"top_-100um\"]\n",
" ds.sample: []\n",
"}\n",
"\n",
"dset_prefix = \"top\"\n",
"\n",
"sample_list = [\"FeAu_0p5_tR_nscope\"]\n",
"sample_list = [ds.sample]\n",
"\n",
"for sample in sample_list:\n",
" all_dset_folders_for_sample = os.listdir(os.path.join(rawdata_path, sample))\n",
Expand All @@ -114,8 +127,7 @@
" samples_dict[sample] = dsets_list\n",
" \n",
"# manually override:\n",
"\n",
"samples_dict = {\"FeAu_0p5_tR_nscope\": [\"top_150um\", \"top_200um\", \"top_250um\"]}"
"# samples_dict = {\"FeAu_0p5_tR_nscope\": [\"top_150um\", \"top_200um\", \"top_250um\"]}"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion ImageD11/nbGui/S3DXRD/pbp_2_visualise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"source": [
"# load phases from parameter file\n",
"\n",
"ds.phases = ds.get_phases_from_disk()"
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion ImageD11/nbGui/S3DXRD/pbp_3_refinement.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"source": [
"# load phases from parameter file\n",
"\n",
"ds.phases = ds.get_phases_from_disk()"
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions ImageD11/nbGui/S3DXRD/tomo_1_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@
"\n",
"fig, ax = plt.subplots(figsize=(16, 9), constrained_layout=True)\n",
"\n",
"ax.plot( ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"\n",
"ax.plot(cf_4d.ds, cf_4d.sum_intensity,',', label='cf_4d')\n",
"ax.plot(cf_strong.ds, cf_strong.sum_intensity,',', label='cf_strong')\n",
"ax.plot( ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"\n",
"ax.semilogy()\n",
"\n",
"ax.set_xlabel(\"Dstar\")\n",
Expand Down
421 changes: 40 additions & 381 deletions ImageD11/nbGui/S3DXRD/tomo_1_index_minor_phase.ipynb

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions ImageD11/nbGui/TDXRD/0_3DXRD_segment_frelon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -366,27 +366,39 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ac6a298f-1405-4d90-b677-7a29c04de67e",
"id": "53e92fd0-8088-4746-b2bb-2735a7cd015e",
"metadata": {},
"outputs": [],
"source": [
"# Now that weparfile happy with our indexing parameters, we can run the below cell to do this in bulk for many samples/datasets\n",
"# Now that we are happy with our segmentation 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 in skips_dict\n",
"\n",
"skips_dict = {\n",
" \"FeAu_0p5_tR\": []\n",
"}\n",
"\n",
"# USER: Change this prefix to match the naming convention of your datasets\n",
"# e.g if your slices are formatted like [\"ff_z0\", \"ff_z1\", \"ff_z2\"] etc, then the prefix could be \"ff\" or \"ff_z\"\n",
"\n",
"dset_prefix = \"ff\"\n",
"\n",
"sample_list = [\"FeAu_0p5_tR\"]\n",
" \n",
"samples_dict = utils.find_datasets_to_process(ds.dataroot, skips_dict, dset_prefix, sample_list)\n",
" \n",
"# manual override:\n",
"# samples_dict = {\"FeAu_0p5_tR\": [\"ff1\", \"ff2\"]}\n",
"print(samples_dict)\n",
"\n",
"# manual override example:\n",
"# samples_dict = {\"FeAu_0p5_tR\": [\"ff1\", \"ff2\"]}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ac6a298f-1405-4d90-b677-7a29c04de67e",
"metadata": {},
"outputs": [],
"source": [
"for sample, datasets in samples_dict.items():\n",
" for dataset in datasets:\n",
" print(f\"Processing dataset {dataset} in sample {sample}\")\n",
Expand Down
20 changes: 15 additions & 5 deletions ImageD11/nbGui/TDXRD/1_3DXRD_refine_parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@
"outputs": [],
"source": [
"# desination of H5 files\n",
"# replace below with e.g.:\n",
"# dset_path = '/data/visitor/expt1234/20240101/PROCESSED_DATA/sample/dataset/sample_dataset.h5'\n",
"\n",
"dset_path = '/data/visitor/ihma439/id11/20231211/PROCESSED_DATA/James/20240909/FeAu_0p5_tR/FeAu_0p5_tR_ff1/FeAu_0p5_tR_ff1_dataset.h5'"
"dset_path = ''"
]
},
{
Expand All @@ -94,6 +96,16 @@
"print(ds.shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -102,9 +114,6 @@
},
"outputs": [],
"source": [
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells\n",
"\n",
"# now let's select a phase to index from our parameters json\n",
"phase_str = 'Fe'\n",
"\n",
Expand Down Expand Up @@ -203,10 +212,11 @@
"\n",
"fig, ax = plt.subplots(figsize=(16, 9), constrained_layout=True)\n",
"\n",
"ax.plot( ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"\n",
"\n",
"ax.plot(cf_3d.ds, cf_3d.sum_intensity,',', label='cf_3d')\n",
"ax.plot(cf_strong.ds, cf_strong.sum_intensity,',', label='cf_strong')\n",
"ax.plot( ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"ax.semilogy()\n",
"\n",
"ax.set_xlabel(\"Dstar\")\n",
Expand Down
48 changes: 34 additions & 14 deletions ImageD11/nbGui/TDXRD/2_3DXRD_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@
"outputs": [],
"source": [
"# desination of H5 files\n",
"# replace below with e.g.:\n",
"# dset_path = '/data/visitor/expt1234/20240101/PROCESSED_DATA/sample/dataset/sample_dataset.h5'\n",
"\n",
"dset_path = '/data/visitor/ihma439/id11/20231211/PROCESSED_DATA/James/20240909/FeAu_0p5_tR/FeAu_0p5_tR_ff1/FeAu_0p5_tR_ff1_dataset.h5'"
"dset_path = ''"
]
},
{
Expand All @@ -90,6 +92,16 @@
"print(ds.shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -98,9 +110,6 @@
},
"outputs": [],
"source": [
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells\n",
"\n",
"# now let's select a phase to index from our parameters json\n",
"phase_str = 'Fe'\n",
"\n",
Expand Down Expand Up @@ -208,10 +217,10 @@
"\n",
"fig, ax = plt.subplots(figsize=(16, 9), constrained_layout=True)\n",
"\n",
"ax.plot(ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"\n",
"ax.plot(cf_3d.ds, cf_3d.sum_intensity,',', label='cf_3d')\n",
"ax.plot(cf_strong.ds, cf_strong.sum_intensity,',', label='cf_strong')\n",
"ax.plot(ucell.ringds, [1e4,]*len(ucell.ringds), '|', ms=90, c=\"red\")\n",
"\n",
"ax.semilogy()\n",
"\n",
"ax.set_xlabel(\"Dstar\")\n",
Expand Down Expand Up @@ -639,7 +648,7 @@
" unindexed_flt_path,\n",
" map_path,\n",
" final_unindexed_flt_path,\n",
" final_new_flt_path\n",
" final_new_flt_path,\n",
"]:\n",
" if os.path.exists(path):\n",
" os.remove(path)"
Expand All @@ -662,23 +671,34 @@
"metadata": {},
"outputs": [],
"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",
"# Now that we are 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 in skips_dict\n",
"\n",
"skips_dict = {\n",
" \"FeAu_0p5_tR\": []\n",
"}\n",
"\n",
"# USER: Change this prefix to match the naming convention of your datasets\n",
"# e.g if your slices are formatted like [\"ff_z0\", \"ff_z1\", \"ff_z2\"] etc, then the prefix could be \"ff\" or \"ff_z\"\n",
"\n",
"dset_prefix = \"ff\"\n",
"\n",
"sample_list = [\"FeAu_0p5_tR\"]\n",
" \n",
"samples_dict = utils.find_datasets_to_process(ds.dataroot, skips_dict, dset_prefix, sample_list)\n",
"print(samples_dict)\n",
"\n",
"rawdata_path = ds.dataroot\n",
"processed_data_root_dir = ds.analysisroot\n",
"samples_dict = utils.find_datasets_to_process(rawdata_path, skips_dict, dset_prefix, sample_list)\n",
"\n",
"\n",
"# manual override example:\n",
"# samples_dict = {\"FeAu_0p5_tR\": [\"ff1\", \"ff2\"]}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for sample, datasets in samples_dict.items():\n",
" for dataset in datasets:\n",
" print(f\"Processing dataset {dataset} in sample {sample}\")\n",
Expand Down Expand Up @@ -783,7 +803,7 @@
" unindexed_flt_path,\n",
" map_path,\n",
" final_unindexed_flt_path,\n",
" final_new_flt_path\n",
" final_new_flt_path,\n",
" ]:\n",
" if os.path.exists(path):\n",
" os.remove(path)\n",
Expand Down
Loading

0 comments on commit d039e0c

Please sign in to comment.