Skip to content

Commit

Permalink
Refs #49 Untested loading of DAVE data
Browse files Browse the repository at this point in the history
  • Loading branch information
jmborr committed Apr 18, 2018
1 parent 89b563b commit d413c8b
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions notebooks/strexp_fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,23 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 24,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/tmp/qef_data/data/notebooks/strexp\n"
]
}
],
"source": [
"qef_data_dir = '/tmp/qef_data'\n",
"data_dir = os.path.join(qef_data_dir, 'data', 'notebooks', 'strexp')\n",
"if not os.path.isdir(data_dir):\n",
" raise RuntimeError('data dir', data_dir, 'does not exists')"
" raise IOError('data dir ' + data_dir + 'does not exists')\n",
"print(data_dir)"
]
},
{
Expand All @@ -165,13 +174,41 @@
"(<a href='#Table of Contents'>Top</a>)<a id='load_data'></a><h3>Load data and visualize data</h3>"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"filenames = dict(dat='data.grp', bkg='background.grp', res='resolution.grp')\n",
"# Check files exists\n",
"for filename in filenames.values():\n",
" full_filename = pjn(data_dir, filename)\n",
" if not os.path.exists(full_filename):\n",
" raise IOError('File ' + filename + ' not found in ' + data_dir)\n",
" \n",
"res = load_dave(pjn(data_dir, 'resolution.grp'))\n",
"dat = load_dave(pjn(data_dir, 'data.grp'))\n",
"bkg = load_dave(pjn(data_dir, 'resolution.grp'))\n",
"\n",
"f, (ax1, ax2, ax3) = plt.subplots(1, 3)\n",
"[ax1.semilogy(res['x'], spectrum) for spectrum in res['y']]; ax1.set_title('resolution')\n",
"[ax2.semilogy(dat['x'], spectrum) for spectrum in dat['y']]; ax2.set_title('sample')\n",
"[ax3.semilogy(bkg['x'], spectrum) for spectrum in bkg['y']]; ax3.set_title('empty can')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"files = dict(dat='data.grp', bkg='background.grp', 'res'=resolution.grp)\n",
"filenames = dict(dat='data.grp', bkg='background.grp', 'res'=resolution.grp)\n",
"# Check files exists\n",
"for filename in filenames.values():\n",
" if not os.path.isdir(os.path.join(data_dir, filename)):\n",
" raise IOError('File', filename, 'not found in', data_dir)\n",
" \n",
"res = load_nexus(pjn(data_dir,'irs26173_graphite_res.nxs'))\n",
"emin, emax = np.min(res['x']), np.max(res['x'])\n",
"dat = load_nexus(pjn(data_dir,'irs26176_graphite002_red.nxs')) # data has 10 histograms\n",
Expand Down

0 comments on commit d413c8b

Please sign in to comment.