Skip to content

Commit

Permalink
Merge pull request #339 from jadball/master
Browse files Browse the repository at this point in the history
Scanning 3DXRD Strain refinement
  • Loading branch information
jadball authored Oct 18, 2024
2 parents 4ec6bb8 + 95a6f42 commit f765cbc
Show file tree
Hide file tree
Showing 28 changed files with 5,191 additions and 1,546 deletions.
38 changes: 20 additions & 18 deletions ImageD11/fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@

# what Zenodo folder can these be found in?
dataset_base_urls = {
'Si_cube_S3DXRD_nt_moves_dty': "https://sandbox.zenodo.org/records/90518/files/",
'Si_cube_S3DXRD_nt_moves_dty': "https://sandbox.zenodo.org/records/118843/files/",
}

# What are the names of the files in the Zenodo folder?
dataset_filenames = {
'Si_cube_S3DXRD_nt_moves_dty': {
'sparsefile': 'Si_cube_S3DXRD_nt_moves_dty_sparse.h5',
'parfile': 'Si_refined.par',
'parfile': 'pars.json',
'geomfile': 'geometry.par',
'phasefile0': 'Si_refined.par',
'e2dxfile': 'e2dx_E-08-0144_20240205.edf',
'e2dyfile': 'e2dy_E-08-0144_20240205.edf'
}
Expand Down Expand Up @@ -123,25 +125,25 @@ def _get_dataset(test_dataset_name, dest_folder, allow_download):
for filetype, filename in dataset_filenames[test_dataset_name].items():
file_url = dataset_base_urls[test_dataset_name] + filename
# is it a file that could be used as an attribute?
if filetype in id11dset.DataSet.ATTRNAMES:
if hasattr(ds, filetype):
if getattr(ds, filetype) is None:
# this is an attribute, but we don't have a path for it
# put it in processed data root
filepath = os.path.join(processed_data_root_dir, filename)
download_url(file_url, filepath)
setattr(ds, filetype, filepath)
else:
# the dataset has a path for this filetype already
filepath = getattr(ds, filetype)
download_url(file_url, filepath)
else:
# probably a spatial or a parfile
# chuck it in processed_data_root_dir
# set the attribute
# if filetype in id11dset.DataSet.ATTRNAMES:
if hasattr(ds, filetype):
if getattr(ds, filetype) is None:
# this is an attribute, but we don't have a path for it
# put it in processed data root
filepath = os.path.join(processed_data_root_dir, filename)
download_url(file_url, filepath)
setattr(ds, filetype, filepath)
else:
# the dataset has a path for this filetype already
filepath = getattr(ds, filetype)
download_url(file_url, filepath)
else:
# probably a spatial or a parfile
# chuck it in processed_data_root_dir
# set the attribute
filepath = os.path.join(processed_data_root_dir, filename)
download_url(file_url, filepath)
setattr(ds, filetype, filepath)

ds.import_from_sparse(ds.sparsefile)
ds.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
"\n",
"if len(dataroot)==0:\n",
" print(\"Please fix in the dataroot and analysisroot folder names above!!\")\n",
"\n",
"analysisroot = os.path.join(analysisroot, 'James', '20241009')\n",
" \n",
"print('dataroot =',repr(dataroot))\n",
"print('analysisroot =',repr(analysisroot))"
]
Expand Down Expand Up @@ -101,7 +104,7 @@
"outputs": [],
"source": [
"# USER: Decide which sample\n",
"sample = 'WAu'"
"sample = 'FeAu_0p5_tR_nscope'"
]
},
{
Expand All @@ -127,7 +130,7 @@
"outputs": [],
"source": [
"# USER: Decide which dataset\n",
"dataset = \"siliconAttrz25\""
"dataset = \"top_100um\""
]
},
{
Expand Down Expand Up @@ -243,6 +246,20 @@
"ImageD11.sinograms.properties.main(ds.dsfile, options={'algorithm': 'lmlabel', 'wtmax': 70000, 'save_overlaps': False})"
]
},
{
"cell_type": "markdown",
"id": "3db1c3e1-e812-4098-a3ab-a7a10b7cab4c",
"metadata": {},
"source": [
"# Finished segmenting!\n",
"\n",
"You can now choose between two different indexing routes: tomographic (tomo) and point-by-point (pbp). \n",
"Tomo gives you better grain shapes, but can't handle highly deformed samples. \n",
"Point-by-point can only give you convex grain shapes (less accurate) but can handle high levels of deformation. \n",
"Both techniques will join back together during the strain refinement stage (notebook 3). \n",
"Therefore notebooks 4 and onwards should work from either the tomo or pbp route."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -269,9 +286,9 @@
" \"FeAu_0p5_tR_nscope\": [\"top_-50um\", \"top_-100um\"]\n",
"}\n",
"\n",
"dset_prefix = \"m\" # some common string in the names of the datasets (*?)\n",
"dset_prefix = \"top_\" # some common string in the names of the datasets (*?)\n",
"\n",
"sample_list = [\"Klegs\"]\n",
"sample_list = [\"FeAu_0p5_tR_nscope\"]\n",
" \n",
"samples_dict = utils.find_datasets_to_process(dataroot, skips_dict, dset_prefix, sample_list)\n",
"\n",
Expand Down
Loading

0 comments on commit f765cbc

Please sign in to comment.