Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidated powder and SX calibration notebooks #356

Merged
merged 6 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ImageD11/nbGui/S3DXRD/run_astra_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def main(h5name, dsfile, group_name):
print('Reconstructing grain sinograms')
for inc, gs in enumerate(grainsinos):
gs.recon(method="astra", astra_method="EM_CUDA")
print('Reconstructed ' + inc+1 + '/' + len(grainsinos))
print('Reconstructed ' + str(inc+1) + '/' + str(len(grainsinos)))

# mask recon after running
print('Masking reconstructions')
Expand Down
39 changes: 25 additions & 14 deletions ImageD11/nbGui/S3DXRD/select_for_index_unknown.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,28 @@
},
"outputs": [],
"source": [
"ds.parfile = aroot + \"/LMGO_pseudo_cubic.par\"\n",
"# ds.parfile = aroot + \"/LMGO_pseudo_cubic.par\"\n",
"cf_4d = ds.get_cf_4d()\n",
"ds.update_colfile_pars( cf_4d )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"metadata": {},
"outputs": [],
"source": [
"\" \".join(cf_4d.titles)"
"ds.phases = ds.get_phases_from_disk()\n",
"ds.phases.unitcells"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"major_phase_str = 'Al'"
]
},
{
Expand All @@ -129,9 +137,8 @@
},
"outputs": [],
"source": [
"# fixme - removing the main phase - could skip this part if there is no main phase\n",
"a = 3.90725\n",
"ucell = ImageD11.unitcell.unitcell( [2*a, 2*a, 2*a, 90, 90, 90], \"P\")\n",
"ucell = ds.phases.unitcells[major_phase_str]\n",
"\n",
"ucell.makerings( dsbinedges[-1] )\n",
"ucell.lattice_parameters"
]
Expand Down Expand Up @@ -269,7 +276,8 @@
" return pair\n",
"\n",
"om = np.linspace( cring.omega.min(), cring.omega.max(), 90 )\n",
"fitline, = ax[1].plot( om, np.zeros_like(om), '-')\n",
"fitlinel, = ax[0].plot( om, np.zeros_like(om), '-')\n",
"fitliner, = ax[1].plot( om, np.zeros_like(om), '-')\n",
"\n",
"### GLOBALS, also y0\n",
"p1 = None # index of first peak in cring\n",
Expand Down Expand Up @@ -305,7 +313,8 @@
" [ -sj, -cj] ] )\n",
" xy = x, y = np.linalg.inv(R).dot( [ yi, yj ] )\n",
" ycalc = ImageD11.sinograms.geometry.x_y_y0_omega_to_dty(om, x, y, y0)\n",
" fitline.set_ydata( ycalc )\n",
" fitlinel.set_ydata( ycalc )\n",
" fitliner.set_ydata( ycalc )\n",
" peak_ycalc = ImageD11.sinograms.geometry.x_y_y0_omega_to_dty(cring.omega, x, y, y0)\n",
" \n",
"def onpick( evt ):\n",
Expand Down Expand Up @@ -523,8 +532,8 @@
"sino, obinedge, ybinedge = np.histogram2d( cring.omega, cring.dty, weights = np.log(cring.sum_intensity),\n",
" bins = (np.linspace(ds.obinedges.min(), ds.obinedges.max(), nbins_angle), ds.ybinedges) )\n",
"obincen = 0.5*(obinedge[:-1] + obinedge[1:])\n",
"recon = ImageD11.sinograms.roi_iradon.iradon( sino.T, obincen, filter_name='shepp-logan', \n",
" workers=ImageD11.cImageD11.cores_available())"
"recon = ImageD11.sinograms.roi_iradon.run_iradon(sino.T, obincen, filter_name='shepp-logan', \n",
" workers=ImageD11.cImageD11.cores_available(), shift=-y0/ds.ystep, pad=0)"
]
},
{
Expand Down Expand Up @@ -557,10 +566,10 @@
" if evt.inaxes == ax[1]:\n",
" y = evt.xdata\n",
" x = evt.ydata\n",
" ycalc = ImageD11.sinograms.geometry.dtycalc( om, x, y, 0 )\n",
" ycalc = ImageD11.sinograms.geometry.dtycalc( om, x, y, y0 )\n",
" global ycalcall, pos\n",
" pos = y,x\n",
" ycalcall = ImageD11.sinograms.geometry.dtycalc( cring.omega, x, y, 0 )\n",
" ycalcall = ImageD11.sinograms.geometry.dtycalc( cring.omega, x, y, y0 )\n",
" fitline1.set_ydata( ycalc + 1 )\n",
" fitline2.set_ydata( ycalc - 1 )\n",
" location.set_xdata( [y,] )\n",
Expand Down Expand Up @@ -664,6 +673,8 @@
"for c in cells:\n",
" plt.plot( c.ringds, np.full( len(c.ringds), o) ,\"|\", ms=10, lw =.1, label=(\"%.4f \"*6)%tuple(c.lattice_parameters) )\n",
" o *= 2\n",
"o *= 2\n",
"plt.plot( ucell.ringds, np.full( len(ucell.ringds), o) ,\"|\", ms=10, lw =.1, label=(\"%.4f \"*6)%tuple(ucell.lattice_parameters) )\n",
"plt.semilogy()\n",
"plt.xlim(0.1,0.6)\n",
"plt.legend(loc='upper left');"
Expand Down
173 changes: 0 additions & 173 deletions ImageD11/nbGui/build_par_file.ipynb

This file was deleted.

Loading
Loading