{"cells": [{"cell_type": "markdown", "id": "782e9eb1-2d14-462f-82c3-5e4d39def6a7", "metadata": {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}, "source": ["# Jupyter notebook based on ImageD11 to process scanning 3DXRD data\n", "# Written by Haixing Fang, Jon Wright and James Ball\n", "## Date: 23/07/2024"]}, {"cell_type": "markdown", "metadata": {}, "source": "Source: [ImageD11/nbGui/S3DXRD/import_test_data.ipynb](https://github.com/FABLE-3DXRD/ImageD11/blob/master/ImageD11/nbGui/S3DXRD/import_test_data.ipynb). Shown as saved in git; the documentation build does not run it."}, {"cell_type": "markdown", "id": "01e88b7a-cca7-427e-a7ca-86b46bc613bf", "metadata": {}, "source": ["\n", "# NOTE: These notebooks are under active development\n", "\n", "They require the latest version of ImageD11 from Git to run.\n", "\n", "If you don't have this set up yet, you can run the below cell.\n", "\n", "It will automatically download and install ImageD11 to your home directory\n"]}, {"cell_type": "code", "execution_count": null, "id": "7630a0b8-d900-47ca-bb87-6f54df591887", "metadata": {"editable": true, "slideshow": {"slide_type": ""}, "tags": ["parameters"]}, "outputs": [], "source": ["# this cell is tagged with 'parameters'\n", "# to view the tag, select the cell, then find the settings gear icon (right or left sidebar) and look for Cell Tags\n", "download_dir = 'si_cube_test'\n", "# python environment stuff\n", "IMAGED11_PATH = None # means do not use git, otherwise \"ImageD11\" or \"ImageD11_version_xx\", etc\n", "CHECKOUT_PATH = None # None means guess, or you can specify a folder for the checkout"]}, {"cell_type": "code", "execution_count": null, "id": "6f943f39-15ab-4bda-b0d9-38ed46f06b5a", "metadata": {}, "outputs": [], "source": ["if IMAGED11_PATH is not None:\n", " exec(open('/data/id11/nanoscope/install_ImageD11_from_git.py').read())\n", " PYTHONPATH=setup_ImageD11_from_git(CHECKOUT_PATH, IMAGED11_PATH)\n", "else:\n", " import site\n", " PYTHONPATH = site.getsitepackages()[0]\n", " print(PYTHONPATH)"]}, {"cell_type": "code", "execution_count": null, "id": "e86486f2-af6f-4922-8d46-39a2363b6989", "metadata": {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}, "outputs": [], "source": ["import os\n", "\n", "import ImageD11.sinograms.dataset\n", "import ImageD11.sinograms.properties\n", "\n", "from ImageD11.fetch_data import si_cube_s3dxrd_dataset"]}, {"cell_type": "code", "execution_count": null, "id": "b6bff1ff-55bb-4f4c-a1d3-44bfaa09c816", "metadata": {"tags": []}, "outputs": [], "source": ["# Check that we're importing ImageD11 from the home directory rather than from the Jupyter kernel\n", "\n", "?ImageD11.sinograms.dataset"]}, {"cell_type": "code", "execution_count": null, "id": "916141bb-d815-4450-887b-b1a9b25d37c7", "metadata": {"tags": []}, "outputs": [], "source": ["# USER: change this as you like!\n", "\n", "if not os.path.exists(download_dir):\n", " os.mkdir(download_dir)"]}, {"cell_type": "code", "execution_count": null, "id": "ec14dfa1-532e-4dce-8fea-da93527daf42", "metadata": {"tags": []}, "outputs": [], "source": ["# we will download a test dataset from Zenodo\n", "\n", "ds = si_cube_s3dxrd_dataset(download_dir, allow_download=True)"]}, {"cell_type": "code", "execution_count": null, "id": "43c501e6-821c-4051-b09b-16267d7d98fd", "metadata": {"tags": []}, "outputs": [], "source": ["# Now label the sparse peaks to create a 2D peaks table \n", "\n", "ImageD11.sinograms.properties.main(ds.dsfile, options={'algorithm': 'lmlabel', 'wtmax': 70000, 'save_overlaps': False})"]}, {"cell_type": "code", "execution_count": null, "id": "170d38bc-01b5-475a-9d36-e598eb81f078", "metadata": {"tags": []}, "outputs": [], "source": ["# Save dataset to disk\n", "\n", "ds.save()\n", "print('Dataset saved to ' + ds.dsfile) "]}, {"cell_type": "markdown", "id": "d2369d30-ba3d-4e8e-a5a0-62fbef4a78b7", "metadata": {}, "source": ["# DONE!\n", "No need to segment, go straight to notebook 1"]}], "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.12.9"}, "toc-showcode": false, "widgets": {"application/vnd.jupyter.widget-state+json": {"state": {}, "version_major": 2, "version_minor": 0}}}, "nbformat": 4, "nbformat_minor": 5}