Skip to content

Commit

Permalink
Merge pull request #217 from jonwright/master
Browse files Browse the repository at this point in the history
Point by point scanner for sinograms
  • Loading branch information
jonwright authored Feb 12, 2024
2 parents a8f80bb + f937175 commit 54d6461
Show file tree
Hide file tree
Showing 2 changed files with 623 additions and 0 deletions.
192 changes: 192 additions & 0 deletions ImageD11/nbGui/run_pbp.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import sys, os\n",
"os.environ['OMP_NUM_THREADS']='1'\n",
"sys.path.insert(0, f'{os.environ[\"HOME\"]}/git/ImageD11')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import ImageD11.sinograms.point_by_point\n",
"import ImageD11.sinograms.dataset\n",
"import ImageD11.sinograms.properties\n",
"from ImageD11.blobcorrector import eiger_spatial\n",
"import ImageD11.columnfile\n",
"import pylab as pl, numpy as np"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"!pwd"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"parname = '/data/visitor/ihma423/id11/20231205/PROCESSED_DATA/S7_deformed/Al_fcc_2.par'\n",
"SparsePixelFolder = '/data/visitor/ihma423/id11/20231205/PROCESSED_DATA/SparsePixels_NewMask/'\n",
"sample = 'S9_355C_10min_3rd'\n",
"dset_prefix = 'sliceZ_-360um'\n",
"cf_postfix = '4rha'\n",
"\n",
"z = 5\n",
"if 1:\n",
" \n",
" dsname = os.path.join(SparsePixelFolder, 'ds_' + sample + '_' + dset_prefix + '_' + str(z) + '.h5')\n",
" pksname = os.path.join(SparsePixelFolder, 'pks_' + sample + '_' + dset_prefix + '_' + str(z) + '.h5')\n",
" outname = os.path.join(SparsePixelFolder, sample + '_' + dset_prefix + '_' + str(z) + '_sparse.h5') \n",
" cf_h5 = os.path.join(os.getcwd(), sample + '_' + dset_prefix + '_' + str(z) + '_' + cf_postfix + '.h5') \n",
" pbp_out = os.path.join(os.getcwd(), sample + '_' + dset_prefix + '_' + str(z) + '_' + cf_postfix + '.pbp')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"pk = ImageD11.sinograms.properties.pks_table.load(pksname)\n",
"dset = ImageD11.sinograms.dataset.load(dsname)\n",
"es = eiger_spatial(dxfile='/data/id11/nanoscope/Eiger/e2dx_E-08-0173_20231127.edf',\n",
" dyfile='/data/id11/nanoscope/Eiger/e2dy_E-08-0173_20231127.edf' )\n",
"cf = ImageD11.columnfile.colfile_from_dict( es(pk.pk2d(dset.omega, dset.dty)) )\n",
"cf.filter(cf.Number_of_pixels > 5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"p= ImageD11.sinograms.point_by_point.PBP(\n",
" parname,\n",
" dset,\n",
" hkl_tol=0.01,\n",
" fpks=0.7,\n",
" ds_tol=0.01,\n",
" etacut=0.1,\n",
" ifrac=1./300,\n",
" cosine_tol=np.cos(np.radians(90 - 0.1)),\n",
" y0=0,\n",
" symmetry=\"cubic\",\n",
" foridx=[0, 1, 2, 4, 5],\n",
" forgen=[5, 1],\n",
" uniqcut=0.75)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"p.setpeaks(cf)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"f, ax = p.iplot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"p.point_by_point('grainsout2.pbp', nprocs=1, debugpoints=[(10,10),], loglevel=0)\n",
"!tail grainsout2.pbp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"p.point_by_point('grainsout_all.pbp', loglevel=3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (main)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 54d6461

Please sign in to comment.