Skip to content

Commit

Permalink
Merge pull request #356 from jadball/master
Browse files Browse the repository at this point in the history
Consolidated powder and SX calibration notebooks
  • Loading branch information
jadball authored Nov 28, 2024
2 parents bd380f4 + 09f4c70 commit 1de0e7f
Show file tree
Hide file tree
Showing 9 changed files with 753 additions and 824 deletions.
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

0 comments on commit 1de0e7f

Please sign in to comment.