From ddac3a914b446ea882d9c3d30c22e5b5114c7cb3 Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 12:37:26 -0400 Subject: [PATCH 01/13] Added notebooks to online docs --- CONTRIBUTING.rst | 5 + docs/conf.py | 4 + docs/index.rst | 1 + ...EWL_anom_laue_dials_processing_final.ipynb | 512 +++++++++++++++ docs/notebooks/hewl/hewl.rst | 8 + docs/notebooks/pdz2/pdz2.rst | 8 + .../pdz2/tutorial_combine_passes.ipynb | 608 ++++++++++++++++++ docs/notebooks/tutorials.rst | 9 + docs/requirements.txt | 1 + setup.cfg | 1 + 10 files changed, 1157 insertions(+) create mode 100644 docs/notebooks/hewl/HEWL_anom_laue_dials_processing_final.ipynb create mode 100644 docs/notebooks/hewl/hewl.rst create mode 100644 docs/notebooks/pdz2/pdz2.rst create mode 100644 docs/notebooks/pdz2/tutorial_combine_passes.ipynb create mode 100644 docs/notebooks/tutorials.rst diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 487f5d6..f00bea6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -44,6 +44,11 @@ and use Python's built-in web server for a preview in your web browser python3 -m http.server --directory 'docs/_build/html' +If you wish to ``make html`` directly, be sure to install ``pandoc`` via + + ``conda install pandoc`` + +first. Code Contributions ================== diff --git a/docs/conf.py b/docs/conf.py index b02eb38..8c90a0d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -77,8 +77,12 @@ "sphinx_rtd_theme", "libtbx.sphinx.phil", "libtbx.sphinx.python_string", + "nbsphinx", ] +# Set nbsphinx parameters +nbsphinx_execute = "never" + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/index.rst b/docs/index.rst index 267dc5c..4fbc2c9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -13,6 +13,7 @@ Contents Changelog Command-Line Reference Full API Reference + Jupyter Tutorials Indices and tables diff --git a/docs/notebooks/hewl/HEWL_anom_laue_dials_processing_final.ipynb b/docs/notebooks/hewl/HEWL_anom_laue_dials_processing_final.ipynb new file mode 100644 index 0000000..dfda4ed --- /dev/null +++ b/docs/notebooks/hewl/HEWL_anom_laue_dials_processing_final.ipynb @@ -0,0 +1,512 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "7f3f2491-8be2-4e3f-b17a-fb66c48558e7", + "metadata": {}, + "source": [ + "# Installation\n", + "\n", + "The easiest way to install `laue-dials` and its dependencies is using [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html). First we update and install the libmamba solver with\n", + "\n", + "```\n", + "conda update -n base conda\n", + "conda install -n base conda-libmamba-solver\n", + "conda config --set solver libmamba\n", + "```\n", + "\n", + "With Anaconda, we can then create and activate a custom environment for your install by running \n", + "\n", + "```\n", + "conda create --name laue-dials\n", + "conda activate laue-dials\n", + "```\n", + "\n", + "Now we are ready to install the main dependency and framework: [DIALS](https://dials.github.io). After installing that, we can install `laue-dials` using pip, as below:\n", + "\n", + "```\n", + "conda install -c conda-forge dials\n", + "pip install laue-dials\n", + "```\n", + "\n", + "All other dependencies will then be automatically installed for us, and we'll be ready to analyze your first Laue data set! Reopen this notebook with the appropriate environment activated when ready.\n", + "\n", + "Documentation for `laue-dials` can be found at [here](https://rs-station.github.io/laue-dials/index.html), and entering a command with no arguments on the command line will also print a help page!" + ] + }, + { + "cell_type": "markdown", + "id": "2b283ddc-4d0b-41f0-bcf1-276c93233db7", + "metadata": { + "tags": [] + }, + "source": [ + "# Introduction\n", + "In this notebook, we will process an anomalous HEWL dataset. The data is comprised of 3049 frames that constitute several rotations of a HEWL crystal.\n", + "\n", + "At the end of processing, we would like an integrated `.mtz` file we can then process with `careless` for merging. We must run `laue-dials` on the whole dataset for completeness, but we can use fewer images for tutorial purposes if needed. The data are spaced by one degree per frame, so 180 frames represents a single full rotation.\n", + "\n", + "Data processing will rely on images found in `./data` and scripts found in `./scripts`. \n", + "\n", + "# Importing Data\n", + "\n", + "We can use `dials.import` as a way to import the data files written at experimental facilities into a format that is friendly to both `DIALS` and `laue-dials`. We provide the peak wavelength of the beam, the detector pixel measurements (in mm), and the goniometer axes. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c347b644-87ab-4c8e-8a20-fbfc10a67902", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "# Import data\n", + "dials.import geometry.scan.oscillation=0,1 \\\n", + " geometry.goniometer.axes=-1,0,0 \\\n", + " geometry.beam.wavelength=1.05 \\\n", + " geometry.detector.panel.pixel=0.08854,0.08854 \\\n", + " input.template=$(pwd)'/data/HEWL_NaI_3_2_####.mccd' \\\n", + " output.experiments=imported_HEWL_anom_3049.expt \\\n", + " output.log=dials.import_HEWL_anom_3049.log" + ] + }, + { + "cell_type": "markdown", + "id": "0643abd5-541c-4113-a17c-04a27cda4b1e", + "metadata": { + "tags": [] + }, + "source": [ + "# Getting an Initial Estimate\n", + "\n", + "After importing our data, the first thing we need to do is get an initial estimate for the experimental geometry. Here, we'll use some monochromatic algorithms from DIALS to help! This step can be tricky -- failure can be due to several causes. In the event of failure, here are a few common causes:\n", + "\n", + "1. The spotfinding gain is either too high or too low. Try looking at the results of `dials.image_viewer imported.expt strong.refl` as below and seeing if you have too many (or too few) reflections. Lower gain gives you more spots, but also more likely to give false positives.\n", + "2. Supplying the space group or unit cell during indexing can be helpful. When supplying the unit cell, allow for some variation in the lengths of the axes, since the monochromatic algorithms may result in a slightly scaled unit cell depending on the chosen wavelength.\n", + "3. You may have intensities that need to be masked. These can come from bad panels or extraneous scatter. You can use `dials.image_viewer` (described below) to create a mask file for your data, and then provide the `spotfinder.lookup.mask=\"pixels.mask\"` command below to use that mask during spotfinding.\n", + "\n", + "First we will run spotfinding algorithms, then check using the DIALS image viewer to ensure we have the gain set to an appropriate level, and then try our hand at `laue.index` to see the quality of the indexed unit cell." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d9e016aa-236e-4048-aeb4-c5dbe69ec649", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.find_spots imported_HEWL_anom_3049.expt \\\n", + " spotfinder.mp.nproc=60 \\\n", + " spotfinder.threshold.dispersion.gain=0.15 \\\n", + " spotfinder.filter.max_separation=10 \\\n", + " output.reflections=strong_HEWL_anom_3049.refl \\\n", + " output.log=laue.find_spots_HEWL_anom_3049.log" + ] + }, + { + "cell_type": "markdown", + "id": "09d55f48-db2d-40fb-af3d-c1e568730c84", + "metadata": { + "tags": [] + }, + "source": [ + "# Viewing Images\n", + "\n", + "Sometimes it's helpful to be able to see the analysis data overlayed on the raw data. DIALS has a utility for viewing spot information on the raw images called `dials.image_viewer`. For example, the spotfinding gain parameter can be tuned to capture more spots, but lowering it too much finds nonexistent spots. To check this, we can use the image viewer to see what spots were found on images. We need to provide an `expt` file and a `refl` file -- the `imported.expt` and `strong.refl` files will do for checking spotfinding. This program also has utilities for generating masks if they are needed. The red dots from the checkbox \"Mark centers of mass\" are the spots found by `laue.find_spots` (which in turn makes a call to `dials.find_spots`). These are best used for judging whether you need to adjust the gain higher (for fewer spots) or lower (for more) during spotfinding. You can find more details on the image viewer in the [DIALS tutorial here](https://dials.github.io/documentation/tutorials/processing_in_detail_betalactamase.html)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0f4f6850-8e4f-41ec-bf61-41a2cb3ef7e2", + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "# I found it helpful to set the brightness to 30\n", + "\n", + "dials.image_viewer imported_HEWL_anom_3049.expt strong_HEWL_anom_3049.refl" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd7d0154-7cbb-4fa7-9aa6-d52cfc3d41e0", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.index imported_HEWL_anom_3049.expt strong_HEWL_anom_3049.refl \\\n", + " indexer.indexing.nproc=60 \\\n", + " indexer.indexing.known_symmetry.space_group=96 \\\n", + " indexer.indexing.refinement_protocol.mode=refine_shells \\\n", + " indexer.refinement.parameterisation.auto_reduction.action=fix \\\n", + " laue_output.index_only=False \\\n", + " laue_output.indexed.experiments=indexed_HEWL_anom_3049.expt \\\n", + " laue_output.indexed.reflections=indexed_HEWL_anom_3049.refl \\\n", + " laue_output.refined.experiments=refined_HEWL_anom_3049.expt \\\n", + " laue_output.refined.reflections=refined_HEWL_anom_3049.refl \\\n", + " laue_output.final_output.experiments=monochromatic_HEWL_anom_3049.expt \\\n", + " laue_output.final_output.reflections=monochromatic_HEWL_anom_3049.refl \\\n", + " laue_output.log=laue.index_HEWL_anom_3049.log" + ] + }, + { + "cell_type": "markdown", + "id": "ecb0b330-e569-4012-ac9d-077b585b45fe", + "metadata": {}, + "source": [ + "# Making Stills\n", + "\n", + "Here we will now split our monochromatic estimate into a series of stills to prepare it for the polychromatic pipeline. There is a useful utility called `laue.sequence_to_stills` for this.\n", + "\n", + "NOTE: Do not use `dials.sequence_to_stills`, as there are data columns which do not match between the two programs." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e16f007-5fc7-42bf-abf0-7d5584def634", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.sequence_to_stills monochromatic_HEWL_anom_3049.expt \\\n", + " monochromatic_HEWL_anom_3049.refl \\\n", + " output.experiments=stills_HEWL_anom_3049.expt \\\n", + " output.reflections=stills_HEWL_anom_3049.refl \\\n", + " output.log=laue.sequence_to_stills_HEWL_anom_3049.log" + ] + }, + { + "cell_type": "markdown", + "id": "84ecbd84-ba4a-460a-98d9-017273e3f3dd", + "metadata": {}, + "source": [ + "# Polychromatic Analysis\n", + "\n", + "Here we will use four other programs in `laue-dials` to create a polychromatic experimental geometry using our initial monochromatic estimate. Each of the programs does the following:\n", + "\n", + "`laue.optimize_indexing` assigns wavelengths to reflections and refines the crystal orientation jointly.\n", + "\n", + "`laue.refine` is a polychromatic wrapper for `dials.refine` and allows for refining the experimental geometry overall to one suitable for spot prediction and integration.\n", + "\n", + "`laue.predict` takes the refined experimental geometry and predicts the centroids of all strong and weak reflections on the detector.\n", + "\n", + "`laue.integrate` then builds spot profiles and integrates intensities on the detector." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7c7e051e-4d17-4b60-8781-5068d99a530d", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.optimize_indexing stills_HEWL_anom_3049.refl \\\n", + " stills_HEWL_anom_3049.expt \\\n", + " output.experiments=optimized_HEWL_anom_3049.expt \\\n", + " output.reflections=optimized_HEWL_anom_3049.refl \\\n", + " output.log=laue.optimize_indexing_HEWL_anom_3049.log \\\n", + " wavelengths.lam_min=0.97 \\\n", + " wavelengths.lam_max=1.25 \\\n", + " reciprocal_grid.d_min=1.4 \\\n", + " nproc=60" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "54134d6c-495e-43c9-972f-4f35fa4437ed", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.refine optimized_HEWL_anom_3049.expt \\\n", + " optimized_HEWL_anom_3049.refl \\\n", + " output.experiments=poly_refined_HEWL_anom_3049.expt \\\n", + " output.reflections=poly_refined_HEWL_anom_3049.refl \\\n", + " output.log=laue.poly_refined_HEWL_anom_3049.log \\\n", + " nproc=60" + ] + }, + { + "cell_type": "markdown", + "id": "104cd7e9-b2ca-495d-b35e-4675b6e11541", + "metadata": {}, + "source": [ + "Note: even without maxing out the available cores, jupyterlab has a tendency to crash/think that the above cell is running indefinitely. After confirming that the experiment & reflections files had been successfully written out via terminal, I had to interrupt the kernel, restart it, and then resume processing below." + ] + }, + { + "cell_type": "markdown", + "id": "c9279bac-665c-4f6d-b1bb-dbd38cfaa48c", + "metadata": {}, + "source": [ + "## Check results in image viewer" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c9efe7e7-5b2a-43cc-9276-6f89d4a3c9b7", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "dials.image_viewer monochromatic_HEWL_anom_3049.expt monochromatic_HEWL_anom_3049.refl" + ] + }, + { + "cell_type": "markdown", + "id": "87b79ab1-9442-45be-8f1d-4d1a0bd2d489", + "metadata": {}, + "source": [ + "Predictions do not look great - many shoeboxes do not have a predicted spot, and there are also some predicted spots that are off-target or fully false positives." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bed52176-3151-4089-9e00-37698bb0ffdc", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "dials.image_viewer poly_refined_HEWL_anom_3049.expt poly_refined_HEWL_anom_3049.refl" + ] + }, + { + "cell_type": "markdown", + "id": "dd609a5e-d213-4e79-a693-ba7d88cefa5b", + "metadata": {}, + "source": [ + "The polychromatic predictions look much better!" + ] + }, + { + "cell_type": "markdown", + "id": "9c4ce69d-cd27-4dcf-91e7-c407110260b5", + "metadata": {}, + "source": [ + "## Check wavelength spectrum\n", + "\n", + "There is a utility in `laue-dials` called `laue.plot_wavelengths`. This command generates a histogram of the assigned wavelength spectrum. If you know approximately the shape of your beam spectrum, this can be a useful check to ensure that nothing has gone wrong with wavelength assignment at this stage before predicting the full set of reflections." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c656a10d-05f1-4897-b5e4-e3c80a2ec6eb", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.plot_wavelengths poly_refined_HEWL_anom_3049.refl \\\n", + " refined_only=True \\\n", + " save=True \\\n", + " show=False \\\n", + " output=wavelengths_HEWL_anom_3049.png \\\n", + " log=laue.plot_wavelengths_HEWL_anom_3049.log" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9918e710-d786-4be0-8969-768d39db25ce", + "metadata": {}, + "outputs": [], + "source": [ + "from IPython.display import Image\n", + "import os\n", + "cwd = os.getcwd()\n", + "Image(filename=cwd+'/wavelengths_HEWL_anom_3049.png') " + ] + }, + { + "cell_type": "markdown", + "id": "36c1b62e-004f-453f-bc7e-0b759d874e2b", + "metadata": {}, + "source": [ + "## Spot prediction\n", + "\n", + "Since the assigned spectrum looks good, we can move on to predicting the full set of reflections. If the assigned beam spectrum ends up narrower than the wavelength limits you provided in `laue.optimize_indexing`, you can always narrow down the spectrum here for `laue.predict`. The predictor will find the locations of all feasible spots and build profiles for the weak spots based on the observed strong spots. The output reflection table can then be fed along with the refined `expt` file into `laue.integrate` to generate `mtz` files suitable for merging in a program like `careless`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e09c0be-dd7d-4a86-a90f-c6b5e83c07e8", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.predict poly_refined_HEWL_anom_3049.expt \\\n", + " poly_refined_HEWL_anom_3049.refl \\\n", + " output.reflections=predicted_HEWL_anom_3049.refl \\\n", + " output.log=laue.predict_HEWL_anom_3049.log \\\n", + " wavelengths.lam_min=0.97 \\\n", + " wavelengths.lam_max=1.25 \\\n", + " reciprocal_grid.d_min=1.4 \\\n", + " nproc=60" + ] + }, + { + "cell_type": "markdown", + "id": "75f043fa-ad0e-40fe-a163-b5ce0994bfe9", + "metadata": {}, + "source": [ + "## Integration" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "97640ef6-f3ad-4882-b45a-13b20cb0c27c", + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.integrate poly_refined_HEWL_anom_3049.expt \\\n", + " predicted_HEWL_anom_3049.refl \\\n", + " output.filename=integrated_HEWL_anom_3049.mtz \\\n", + " output.log=laue.integrate_HEWL_anom_3049.log \\\n", + " nproc=12" + ] + }, + { + "cell_type": "markdown", + "id": "de455bc5-911c-4dd8-9b99-5eb51610ef0d", + "metadata": { + "tags": [] + }, + "source": [ + "# Conclusion\n", + "\n", + "At this point, you now have integrated `mtz` files that you can pass to [careless](https://github.com/rs-station/careless) for scaling and merging. We provide an example SLURM-compatible `careless` script, found at `scripts/sbatch_careless_varied_frames.sh`. There are also several other scripts that can be used for further processing that are described by `README.txt`.\n", + "\n", + "Note that throughout this pipeline, you can use DIALS utilities like `dials.image_viewer` or `dials.report` to check progress and ensure your data is being analyzed properly. We recommend regularly checking the analysis by looking at the data on images, which can be done by\n", + "\n", + "`dials.image_viewer FILE.expt FILE.refl`.\n", + "\n", + "These files are generally written as pairs with the same base name, with the exception of combining `imported.expt` + `strong.refl`, or `poly_refined.expt` + `predicted.refl`.\n", + "\n", + "Also note that you can take any program and enter it on the command-line for further help. For example, writing\n", + "\n", + "`laue.optimize_indexing`\n", + "\n", + "will print a help page for the program. You can see all configurable parameters by using \n", + "\n", + "`laue.optimize_indexing -c`.\n", + "\n", + "This applies to all `laue-dials` command-line programs.\n", + "\n", + "For further processing of these data in programs like `careless`, the `README.txt` file includes instructions for using the programs in `/scripts/` (reproduced below). \n", + "\n", + "Congratulations! This tutorial is now over. For further questions, feel free to consult documentation or email the [authors](https://pypi.org/project/laue-dials/)." + ] + }, + { + "cell_type": "markdown", + "id": "ecdb7eef-6bf7-4ab3-994e-8997cf758057", + "metadata": {}, + "source": [ + "# Post-Laue-DIALS processing\n", + "\n", + "All HEWL anomalous data analysis and figure generation post-laue-dials was done using the 5 scripts below, in order:\n", + "\n", + "1. HEWL_anom_cut_friedelize_careless.sh\n", + " - Copies the integrated (unmerged) mtz file produced by the HEWL_anom_laue_dials_processing_final.ipynb notebook into the working directory\n", + " - Calls the cut_unmerged_mtz_by_frames.py utility to create mtzs with only a subset of the overall images\n", + " - Calls the friedelize.py utility to split the Friedel mates into two mtz files (*_plus.mtz and *_minus.mtz)\n", + " - Copies those split mtzs into the appropriate directory\n", + " - Calls the sbatch_careless_varied_frames.sh utility to scale those mtzs\n", + "\n", + "2. HEWL_anom_unfriedelize.sh\n", + " - Calls the unfriedelize.py utility to recombine the Friedel mates into a single mtz file\n", + " - Moves the resulting mtz to the refinement directory\n", + "\n", + "3. HEWL_anom_refine.sh\n", + " - Copies files with a set of custom refinement parameters for each step of refinement in Phenix into the appropriate directory. Refinement 1 is a rigid-body refinment only, while Refinement 2 also refines individual B-factors.\n", + " - Calls the utility sbatch_phenix_Refine.sh to run Phenix refinement\n", + "\n", + "4. HEWL_anom_peak_heights.sh\n", + " - Calls the anomalous_peak_heights.py utility to calculate the anomalous peak heights for each I and S atom accross all frame number sizes and store the resulting outputs in csv files\n", + " - Calls the concatenate_anomalous_peak_csv.py utility to concatenate the resulting 13 csv files into one\n", + "\n", + "5. HEWL_anom_figures.sh\n", + " - Calls the HEWL_anom_peaks.pml utility to generate the PyMOL figure showing anomalous density\n", + " - Calls the careless.ccanom and careless.cchalf function to prepare data for subsequent plotting in Jupyter notebooks\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "dev", + "language": "python", + "name": "dev" + }, + "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": 5 +} diff --git a/docs/notebooks/hewl/hewl.rst b/docs/notebooks/hewl/hewl.rst new file mode 100644 index 0000000..62c86ab --- /dev/null +++ b/docs/notebooks/hewl/hewl.rst @@ -0,0 +1,8 @@ +tutorials +========== + +.. toctree:: + :maxdepth: 0 + :caption: Contents: + + HEWL_anom_laue_dials_processing_final diff --git a/docs/notebooks/pdz2/pdz2.rst b/docs/notebooks/pdz2/pdz2.rst new file mode 100644 index 0000000..c8a4c23 --- /dev/null +++ b/docs/notebooks/pdz2/pdz2.rst @@ -0,0 +1,8 @@ +tutorials +========== + +.. toctree:: + :maxdepth: 1 + :caption: Contents: + + tutorial_combine_passes diff --git a/docs/notebooks/pdz2/tutorial_combine_passes.ipynb b/docs/notebooks/pdz2/tutorial_combine_passes.ipynb new file mode 100644 index 0000000..12ee381 --- /dev/null +++ b/docs/notebooks/pdz2/tutorial_combine_passes.ipynb @@ -0,0 +1,608 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "c566775b-2672-4bad-a9ac-2dfdac0fca41", + "metadata": {}, + "source": [ + "## Installation\n", + "\n", + "The easiest way to install `laue-dials` and its dependencies is using [Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html). First we update and install the libmamba solver with\n", + "\n", + "```\n", + "conda update -n base conda\n", + "conda install -n base conda-libmamba-solver\n", + "conda config --set solver libmamba\n", + "```\n", + "\n", + "With Anaconda, we can then create and activate a custom environment for your install by running \n", + "\n", + "```\n", + "conda create --name laue-dials\n", + "conda activate laue-dials\n", + "```\n", + "\n", + "Now we are ready to install the main dependency and framework: [DIALS](https://dials.github.io). After installing that, we can install `laue-dials` using pip, as below:\n", + "\n", + "```\n", + "conda install -c conda-forge dials\n", + "pip install laue-dials\n", + "```\n", + "\n", + "All other dependencies will then be automatically installed for us, and we'll be ready to analyze your first Laue data set! Reopen this notebook with the appropriate environment activated when ready.\n", + "\n", + "Documentation for `laue-dials` can be found at [here](https://rs-station.github.io/laue-dials/index.html), and entering a command with no arguments on the command line will also print a help page!" + ] + }, + { + "cell_type": "markdown", + "id": "50269767-09e6-448a-9e8e-8562ba87604d", + "metadata": { + "tags": [] + }, + "source": [ + "# Introduction\n", + "In this notebook, we will process a time-resolved EF-X dataset.\n", + " \n", + "The data is comprised of four passes of four timepoints each. Each of the four electric-field timepoints is taken for a given `phi` angle, then the crystal is rotated aaround the phi goniometer axis and then the four timepoints are taken again. This is done over four passes, `c,d,e,f`. The start angle and the step can be found in the below table. \n", + "\n", + "| pass | start phi angle (deg) | rotation phi step (deg) | \n", + "|------|-------------|----|\n", + "| c | 0 | 2 |\n", + "| d | 92 | 2 |\n", + "| e | 181 | 2 |\n", + "| f | 361.5 | 1 |\n", + "\n", + "At the end of processing, we would like four `.mtz` files, one for each timepoint. We must run `laue-dials` on each timepoint individually, then combine all passes for a given timepoint at the end. We start with the `off` timepoint pass `c` only. Then, we will analyze all sixteen passes in a single script, and combine the output mtzs into a single mtz file. \n", + "\n", + "Data processing will rely on images found in `./images` and scripts found in `./scripts`. \n", + "\n", + "# Importing Data\n", + "\n", + "We can use `dials.import` as a way to import the data files written at experimental facilities into a format that is friendly to both `DIALS` and `laue-dials`. Feel free to use any data set you'd like below, but a [sample time-resolved EF-X data set](https://zenodo.org/record/6407157) has been uploaded to Zenodo for your convenience, and this notebook has been tested using that dataset.\n", + "\n", + "First, we create two dictionaries, `START_ANGLES` and `OSCS`, that respectively map the pass names to the start angles and rotation steps (treated as oscillations in `dials.import)`. \n", + "```\n", + "declare -A START_ANGLES=( [\"c\"]=0 [\"d\"]=92 [\"e\"]=181 [\"f\"]=361.5)\n", + "declare -A OSCS=( [\"c\"]=2 [\"d\"]=2 [\"e\"]=2 [\"f\"]=1)\n", + "```\n", + "\n", + "Then, we import the files for the `c`,`off` images using `dials.import`. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f84f097-1d3e-4d26-ad3d-2bef23dee63f", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "#these start-angles and sweep angles are to be manually input by the user using information from their particular experimental design. \n", + "declare -A START_ANGLES=( [\"c\"]=0 [\"d\"]=92 [\"e\"]=181 [\"f\"]=361.5)\n", + "declare -A OSCS=( [\"c\"]=2 [\"d\"]=2 [\"e\"]=2 [\"f\"]=1)\n", + "\n", + "#this is the delay time. \n", + "TIME=\"off\"\n", + "# this is the pass. \n", + "pass=\"c\"\n", + "FILE_INPUT_TEMPLATE=\"data/e35${pass}_${TIME}_###.mccd\"\n", + "# Import data into DIALS files\n", + "dials.import geometry.scan.oscillation=${START_ANGLES[$pass]},${OSCS[$pass]}\\\n", + " geometry.goniometer.invert_rotation_axis=True \\\n", + " geometry.goniometer.axes=0,1,0 \\\n", + " geometry.beam.wavelength=1.04 \\\n", + " geometry.detector.panel.pixel_size=0.08854,0.08854 \\\n", + " input.template=$FILE_INPUT_TEMPLATE \\\n", + " output.experiments=imported.expt " + ] + }, + { + "cell_type": "markdown", + "id": "c7137b40-e10e-43f8-a66d-67113f712980", + "metadata": { + "tags": [] + }, + "source": [ + "# Getting an Initial Estimate\n", + "\n", + "After importing our data, the first thing we need to do is get an initial estimate for the experimental geometry. Here, we'll use some monochromatic algorithms from DIALS to help! This step can be tricky -- failure can be due to several causes. In the event of failure, here are a few common causes:\n", + "\n", + "1. The spotfinding gain is either too high or too low. Try looking at the results of `dials.image_viewer imported.expt strong.refl` and seeing if you have too many (or too few) reflections. Lower gain gives you more spots, but also more likely to give false positives.\n", + "2. Supplying the space group or unit cell during indexing can be helpful. When supplying the unit cell, allow for some variation in the lengths of the axes, since the monochromatic algorithms may result in a slightly scaled unit cell depending on the chosen wavelength.\n", + "3. You may have intensities that need to be masked. These can come from bad panels or extraneous scatter. You can use `dials.image_viewer` (described below) to create a mask file for your data, and then provide the `spotfinder.lookup.mask=\"pixels.mask\"` command below to use that mask during spotfinding." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "887213ac-3883-4492-8f92-78126129f37a", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.find_spots imported.expt \\\n", + " spotfinder.mp.nproc=8 \\\n", + " spotfinder.threshold.dispersion.gain=0.3 \\\n", + " spotfinder.filter.max_separation=10" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bbd85bba-e987-47e0-8338-85b9ae0d691c", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "CELL='\"65.3,39.45,39.01,90.000,117.45,90.000\"' #this is a unit cell of PDZ2 from PDB 5E11\n", + "\n", + "laue.index imported.expt strong.refl \\\n", + " indexer.indexing.known_symmetry.space_group=5 \\\n", + " indexer.indexing.refinement_protocol.mode=refine_shells \\\n", + " indexer.indexing.known_symmetry.unit_cell=$CELL \\\n", + " indexer.refinement.parameterisation.auto_reduction.action=fix \\\n", + " laue_output.index_only=False" + ] + }, + { + "cell_type": "markdown", + "id": "7e4678da-294d-40cc-b88b-7137ad7ef6e5", + "metadata": { + "tags": [] + }, + "source": [ + "# Viewing Images\n", + "\n", + "Sometimes it's helpful to be able to see the analysis data overlayed on the raw data. DIALS has a utility for viewing spot information on the raw images called `dials.image_viewer`. For example, the spotfinding gain parameter can be tuned to capture more spots, but lowering it too much finds nonexistent spots. To check this, we can use the image viewer to see what spots were found on images. We need to provide an `expt` file and a `refl` file -- the `imported.expt` and `strong.refl` files will do for checking spotfinding. This program also has utilities for generating masks if they are needed. The red dots from the checkbox \"Mark centers of mass\" are the spots found by `laue.find_spots` (which in turn makes a call to `dials.find_spots`). These are best used for judging whether you need to adjust the gain higher (for fewer spots) or lower (for more) during spotfinding. You can find more details on the image viewer in the [DIALS tutorial here](https://dials.github.io/documentation/tutorials/processing_in_detail_betalactamase.html)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d976c4ea-c674-42b1-b7bc-a7a36bec8861", + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "dials.image_viewer imported.expt strong.refl" + ] + }, + { + "cell_type": "markdown", + "id": "3766edd9-c6d8-4c20-acc0-22f95f9e549e", + "metadata": {}, + "source": [ + "# Making Stills\n", + "\n", + "Here we will now split our monochromatic estimate into a series of stills to prepare it for the polychromatic pipeline. There is a useful utility called `laue.sequence_to_stills` for this.\n", + "\n", + "NOTE: Do not use `dials.sequence_to_stills`, as there are data columns which do not match between the two programs." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6a5d19c3-db92-4635-aeea-006456656ca7", + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.sequence_to_stills monochromatic.*\n", + "#cctbx.python scripts/sequence_to_stills-newest_ld.py monochromatic.*" + ] + }, + { + "cell_type": "markdown", + "id": "fe8411d3-f6b3-4c54-a042-2f6110aeaef3", + "metadata": {}, + "source": [ + "# Polychromatic Analysis\n", + "\n", + "Here we will use four other programs in `laue-dials` to create a polychromatic experimental geometry using our initial monochromatic estimate. Each of the programs does the following:\n", + "\n", + "`laue.optimize_indexing` assigns wavelengths to reflections and refines the crystal orientation jointly.\n", + "\n", + "`laue.refine` is a polychromatic wrapper for `dials.refine` and allows for refining the experimental geometry overall to one suitable for spot prediction and integration.\n", + "\n", + "`laue.predict` takes the refined experimental geometry and predicts the centroids of all strong and weak reflections on the detector.\n", + "\n", + "`laue.integrate` then builds spot profiles and integrates intensities on the detector." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3011e012-9e90-4334-9647-7f8f29cf8461", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "N=8 # Max multiprocessing\n", + "laue.optimize_indexing stills.* \\\n", + " output.experiments=\"optimized.expt\" \\\n", + " output.reflections=\"optimized.refl\" \\\n", + " output.log=\"laue.optimize_indexing.log\" \\\n", + " wavelengths.lam_min=0.95 \\\n", + " wavelengths.lam_max=1.2 \\\n", + " reciprocal_grid.d_min=1.7 \\\n", + " nproc=$N" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ad8b015b-8bee-42a2-9330-d2bac5273b0e", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "N=8 # Max multiprocessing\n", + "laue.refine optimized.* \\\n", + " output.experiments=\"poly_refined.expt\" \\\n", + " output.reflections=\"poly_refined.refl\" \\\n", + " output.log=\"laue.poly_refined.log\" \\\n", + " nproc=$N >> sink.log" + ] + }, + { + "cell_type": "markdown", + "id": "6c6e89aa-f02e-4b7f-ae93-2a2649b663f9", + "metadata": {}, + "source": [ + "To check the refinement quality, we check the spotfinding root-mean-square deviations (rmsds) as a function of image." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "72aab4c0-e28b-42b9-a188-e00f3d1ffd1f", + "metadata": {}, + "outputs": [], + "source": [ + "%%bash\n", + "laue.compute_rmsds poly_refined.* refined_only=True" + ] + }, + { + "cell_type": "markdown", + "id": "ec4029e8-36e7-4b1d-8da0-ab8382823ae8", + "metadata": {}, + "source": [ + "These `rmsd`s look good. " + ] + }, + { + "cell_type": "markdown", + "id": "c70b84c0-e9be-4f86-a79c-4055b0454467", + "metadata": { + "jupyter": { + "outputs_hidden": true + }, + "tags": [] + }, + "source": [ + "## Checking the Wavelength Spectrum\n", + "\n", + "`laue.plot_wavelengths` allows us to plot the wavelengths assigned in stored in a reflection table. The histogram of these reflections should resemble the beam spectrum, so this is a good check to do at this time! " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de21c592-b2cc-4110-a6e9-c89cb3a5fe32", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "laue.plot_wavelengths poly_refined.refl refined_only=True save=True show=False" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "45ebc809-2d3c-42d6-846f-d020739c04c7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "from IPython.display import Image\n", + "Image(filename='wavelengths.png') " + ] + }, + { + "cell_type": "markdown", + "id": "c72a6b9f-8bd2-4ec7-97b9-ab93c7a523ed", + "metadata": {}, + "source": [ + "This is the expected wavelength profile, indicating successful wavelength assignment. " + ] + }, + { + "cell_type": "markdown", + "id": "d539d272-9746-457c-9c2b-a65975b5b2f0", + "metadata": { + "tags": [] + }, + "source": [ + "## DIALS Reports\n", + "\n", + "DIALS has a utility that gives useful information on various diagnostics you may be interested in while analyzing your data. The program `dials.report` generates an HTML file you can open to see information and plots regarding the status of your analyzed data. You can run it on any files generated by `DIALS` or `laue-dials`. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "835ca5c3-7562-4599-9377-108ad25085b4", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "dials.report poly_refined.expt poly_refined.refl" + ] + }, + { + "cell_type": "markdown", + "id": "36dd794c-d101-4295-8307-1e4d34bb8122", + "metadata": {}, + "source": [ + "# Integrating Spots\n", + "\n", + "Now that we have a refined experiment model, we can use `laue.predict` and `laue.integrate` to get integrated intensities from the data. We will predict the locations of all feasible spots on the detector given our refined experiment model, and at each of those locations we will integrate the intensities to get an `mtz` file that we can feed into `careless`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f777ddaa-a3bc-4784-a825-f9a4d57bd13d", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "N=8 # Max multiprocessing\n", + "laue.predict poly_refined.* \\\n", + " output.reflections=\"predicted.refl\" \\\n", + " output.log=\"laue.predict.log\" \\\n", + " wavelengths.lam_min=0.95 \\\n", + " wavelengths.lam_max=1.2 \\\n", + " reciprocal_grid.d_min=1.7 \\\n", + " nproc=$N" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "48273edc-a8f6-400c-a8d5-41f50fe936ec", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "N=8 # Max multiprocessing\n", + "laue.integrate poly_refined.expt predicted.refl \\\n", + " output.filename=\"integrated.mtz\" \\\n", + " output.log=\"laue.integrate.log\" \\\n", + " nproc=$N" + ] + }, + { + "cell_type": "markdown", + "id": "d4364f44-e2c7-4275-a133-4ce1e49ccd19", + "metadata": {}, + "source": [ + "# Processing and Combining All Passes" + ] + }, + { + "cell_type": "markdown", + "id": "572a3f17-f16b-46f9-a4fb-b09165e00e64", + "metadata": {}, + "source": [ + "We have successfully integrated one of the sixteen image series. Let's now process the rest. For the `off` timepoints, we process as above. Pass `e` has a different indexing solution (up to the C2 symmetry operation `-x,y,-z`) and so we reindex pass `e` using [dials.reindex](https://dials.github.io/documentation/programs/dials_reindex.html).\n", + "\n", + "Our strategy for the `50ns`,`100ns`,`200ns` timepoints is to transfer the `stills.expt` geometry and then refine spot positions that may have changed due to the electric field. \n", + "\n", + "Using the attached `../scripts/one-pass-from_off.sh` script which contains all of the above `bash` code, we iterate over all of the passes in the below cell. The below cell takes a while to run -- we don't recommend to run this in the jupyter notebook. Instead, we recommend to run it as a standalone parallel script, attached as `../scripts/process.sh`. Either proccedure will create a folder named `gain_0,3` containing subfolders of `dials` files for each pass. For example, `../gain_0,3-from_stills/dials_files_d_100ns` contains `dials` files for pass `d`, timepoint `100ns`. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9bb17f9c-a5c9-4ad2-a803-390321c66dfa", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "declare -A START_ANGLES=( [\"c\"]=0 [\"d\"]=92 [\"e\"]=181 [\"f\"]=361.5)\n", + "declare -A OSCS=( [\"c\"]=2 [\"d\"]=2 [\"e\"]=2 [\"f\"]=1)\n", + "declare -A DELAY=\"off\"\n", + "\n", + "gain=0.3\n", + "for pass in c d e f \n", + "do\n", + " if [ pass == e ];then \n", + " sh scripts/one_pass-from_off.sh $pass $DELAY ${START_ANGLES[$pass]} ${OSCS[$pass]} $gain -x,y,-z >> sink.log\n", + " else\n", + " sh scripts/one_pass-from_off.sh $pass $DELAY ${START_ANGLES[$pass]} ${OSCS[$pass]} $gain x,y,z >> sink.log\n", + " fi\n", + "done" + ] + }, + { + "cell_type": "markdown", + "id": "d2ea60b3-033d-4581-9586-0290c62c7511", + "metadata": {}, + "source": [ + "Once the `off` timepoint series finish, we process the remaining timepoints. " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0328297c-b7dd-4ce5-8d49-ecd12f3d1d10", + "metadata": { + "scrolled": true, + "tags": [] + }, + "outputs": [], + "source": [ + "%%time\n", + "%%bash\n", + "\n", + "declare -A START_ANGLES=( [\"c\"]=0 [\"d\"]=92 [\"e\"]=181 [\"f\"]=361.5)\n", + "declare -A OSCS=( [\"c\"]=2 [\"d\"]=2 [\"e\"]=2 [\"f\"]=1)\n", + "gain=0.3\n", + "for delay in \"50ns\" \"100ns\" \"200ns\"\n", + "do \n", + " for pass in \"c\" \"d\" \"e\" \"f\" \n", + " do\n", + " sh scripts/one_pass-from_off.sh $pass $delay ${START_ANGLES[$pass]} ${OSCS[$pass]} $gain x,y,z >> sink.log\n", + " done\n", + "done" + ] + }, + { + "cell_type": "markdown", + "id": "1eed69cb-1e38-453a-8249-2c13d327ad4b", + "metadata": {}, + "source": [ + "Finally, we combine all `.mtz` files for passes of a single timepoint using the attached `scripts/expt_concat.py` script. `.mtz` files can be found in `gain_0,3-from_stills/ld_0,3_mtzs`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "565288ad-94c6-4514-9f3c-3ef93d4fee18", + "metadata": {}, + "outputs": [], + "source": [ + "%%bash\n", + "python scripts/expt_concat.py 0.3" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ffc3a23-2f50-4755-8f75-791bdceecc5b", + "metadata": {}, + "outputs": [], + "source": [ + "import reciprocalspaceship as rs\n", + "rs.read_mtz(\"gain_0,3/ld_0,3_mtzs/cdef_e35_off.mtz\")" + ] + }, + { + "cell_type": "markdown", + "id": "8f552860-1a42-4158-b035-128bce2426dd", + "metadata": {}, + "source": [ + "We expect a mtz file with about 350,000 reflections." + ] + }, + { + "cell_type": "markdown", + "id": "321a3447-1d39-471e-ab7b-e2203edf402a", + "metadata": { + "tags": [] + }, + "source": [ + "# Conclusion\n", + "\n", + "At this point, you now have integrated `mtz` files that you can pass to [careless](https://github.com/rs-station/careless) for scaling and merging. We provide an example `careless` script, found at `../scripts/careless-cdef-ohp-mlpw.sh`. However, after all Laue-DIALS files are printed out, `../scripts/reduce.sh` can also be run for a complete analysis.\n", + "\n", + "Note that throughout this pipeline, you can use DIALS utilities like `dials.image_viewer` or `dials.report` to check progress and ensure your data is being analyzed properly. We recommend regularly checking the analysis by looking at the data on images, which can be done by\n", + "\n", + "`dials.image_viewer FILE.expt FILE.refl`.\n", + "\n", + "These files are generally written as pairs with the same base name, with the exception of combining `imported.expt` + `strong.refl`, or `poly_refined.expt` + `predicted.refl`.\n", + "\n", + "Also note that you can take any program and enter it on the command-line for further help. For example, writing\n", + "\n", + "`laue.optimize_indexing`\n", + "\n", + "will print a help page for the program. You can see all configurable parameters by using \n", + "\n", + "`laue.optimize_indexing -c`.\n", + "\n", + "This applies to all `laue-dials` command-line programs.\n", + "\n", + "Congratulations! This tutorial is now over. For further questions, feel free to consult documentation or email the [authors](https://pypi.org/project/laue-dials/)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [conda env:anaconda-manuscript]", + "language": "python", + "name": "conda-env-anaconda-manuscript-py" + }, + "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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/notebooks/tutorials.rst b/docs/notebooks/tutorials.rst new file mode 100644 index 0000000..e2c887c --- /dev/null +++ b/docs/notebooks/tutorials.rst @@ -0,0 +1,9 @@ +tutorials +========== + +.. toctree:: + :maxdepth: 0 + :caption: Contents: + + Processing Anomalous Scattering with HEWL Data + Time-Resolved EF-X Processing on PDZ2 Data diff --git a/docs/requirements.txt b/docs/requirements.txt index 62fa070..defb769 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -20,3 +20,4 @@ gemmi matplotlib scipy jupyter +pandoc diff --git a/setup.cfg b/setup.cfg index b50921c..b21819a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,6 +60,7 @@ docs = nbsphinx sphinx-design autodocsumm + pandoc # Add here test requirements (semicolon/line-separated) testing = From dd09aa5f8ab9150c3757ceb980937f7f12b85d6e Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:03:44 -0400 Subject: [PATCH 02/13] Downgraded python version for compatible with DIALS --- .github/workflows/build_docs.yml | 1 + .github/workflows/test_build_docs.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 3db44bb..025ccc4 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -23,6 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: "" + python-version: ["3.11"] - name: Source Miniconda run: | diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index f1f266a..a369e65 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -23,6 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: "" + python-version: ["3.11"] - name: Source Miniconda run: | From 3ef8e42b8acd93b3d754df9186791b2e0195fde8 Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:05:41 -0400 Subject: [PATCH 03/13] Fixed single python version syntax --- .github/workflows/build_docs.yml | 2 +- .github/workflows/test_build_docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 025ccc4..581cb03 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: "" - python-version: ["3.11"] + python-version: 3.11 - name: Source Miniconda run: | diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index a369e65..da014c0 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: "" - python-version: ["3.11"] + python-version: 3.11 - name: Source Miniconda run: | From 16c527c63c13f7eaf22e247aacb1f10ce6526b4a Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:07:29 -0400 Subject: [PATCH 04/13] Activated environment for lower python version --- .github/workflows/build_docs.yml | 2 +- .github/workflows/test_build_docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 581cb03..78055b1 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -22,7 +22,7 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - activate-environment: "" + activate-environment: true python-version: 3.11 - name: Source Miniconda diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index da014c0..523017f 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -22,7 +22,7 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - activate-environment: "" + activate-environment: true python-version: 3.11 - name: Source Miniconda From cf15a77e0886794f85eb53cab199f2aa9991fdde Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:20:08 -0400 Subject: [PATCH 05/13] Changed to default_python parameter for MiniConda --- .github/workflows/build_docs.yml | 2 +- .github/workflows/test_build_docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 78055b1..4642745 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: true - python-version: 3.11 + default_python: "3.11" - name: Source Miniconda run: | diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index 523017f..5c58b40 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: true - python-version: 3.11 + default_python: 3.11 - name: Source Miniconda run: | From ec6f3c287eaee51569721f39cdee07d34a207c2a Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:26:32 -0400 Subject: [PATCH 06/13] Changing back to python-version parameter with 3.11 for DIALS compatibility --- .github/workflows/build_docs.yml | 2 +- .github/workflows/test_build_docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 4642745..7a9f8a2 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: true - default_python: "3.11" + python-version: "3.11" - name: Source Miniconda run: | diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index 5c58b40..a522744 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -23,7 +23,7 @@ jobs: channels: conda-forge, defaults auto-activate-base: true activate-environment: true - default_python: 3.11 + python-version: "3.11" - name: Source Miniconda run: | From af3ca6bce3a9b0088aa8a80863f838702096861e Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:32:05 -0400 Subject: [PATCH 07/13] Removed extra conda env being built --- .github/workflows/build_docs.yml | 1 - .github/workflows/test_build_docs.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 7a9f8a2..ce15a4a 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -22,7 +22,6 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - activate-environment: true python-version: "3.11" - name: Source Miniconda diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index a522744..a2a2cd9 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -22,7 +22,6 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - activate-environment: true python-version: "3.11" - name: Source Miniconda From 55bfee250ef0a7171be06158e3ce635690b8dbb6 Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:34:34 -0400 Subject: [PATCH 08/13] Activating default test env --- .github/workflows/build_docs.yml | 4 ++-- .github/workflows/test_build_docs.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index ce15a4a..bf9275f 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -27,7 +27,7 @@ jobs: - name: Source Miniconda run: | source $CONDA/etc/profile.d/conda.sh - conda activate + conda activate test which python python --version echo $CONDA @@ -38,7 +38,7 @@ jobs: - name: Install DIALS environment and more run: | source $CONDA/etc/profile.d/conda.sh - conda activate + conda activate test conda install -n base -c conda-forge -y dials conda info conda list diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index a2a2cd9..136d0d8 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -27,7 +27,7 @@ jobs: - name: Source Miniconda run: | source $CONDA/etc/profile.d/conda.sh - conda activate + conda activate test which python python --version echo $CONDA @@ -38,7 +38,7 @@ jobs: - name: Install DIALS environment and more run: | source $CONDA/etc/profile.d/conda.sh - conda activate + conda activate test conda install -n base -c conda-forge -y dials conda info conda list From 6c5b408b5589b6284ffebf6fe4f4c314e33603d9 Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:37:33 -0400 Subject: [PATCH 09/13] Downgraded python version for doc building to 3.10 for compatibility --- .github/workflows/build_docs.yml | 2 +- .github/workflows/test_build_docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index bf9275f..05fffd2 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -22,7 +22,7 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - python-version: "3.11" + python-version: "3.10" - name: Source Miniconda run: | diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index 136d0d8..be0799d 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -22,7 +22,7 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - python-version: "3.11" + python-version: "3.10" - name: Source Miniconda run: | From e4ac6ee181e9f5b02737ce1127476d3c7278cc87 Mon Sep 17 00:00:00 2001 From: PrinceWalnut Date: Thu, 18 Jul 2024 13:53:16 -0400 Subject: [PATCH 10/13] Reverting changes to use latest Python and will wait for DIALS conda distro to be fixed --- .github/workflows/build_docs.yml | 6 +++--- .github/workflows/test_build_docs.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 05fffd2..3db44bb 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -22,12 +22,12 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - python-version: "3.10" + activate-environment: "" - name: Source Miniconda run: | source $CONDA/etc/profile.d/conda.sh - conda activate test + conda activate which python python --version echo $CONDA @@ -38,7 +38,7 @@ jobs: - name: Install DIALS environment and more run: | source $CONDA/etc/profile.d/conda.sh - conda activate test + conda activate conda install -n base -c conda-forge -y dials conda info conda list diff --git a/.github/workflows/test_build_docs.yml b/.github/workflows/test_build_docs.yml index be0799d..f1f266a 100644 --- a/.github/workflows/test_build_docs.yml +++ b/.github/workflows/test_build_docs.yml @@ -22,12 +22,12 @@ jobs: miniconda-version: "latest" channels: conda-forge, defaults auto-activate-base: true - python-version: "3.10" + activate-environment: "" - name: Source Miniconda run: | source $CONDA/etc/profile.d/conda.sh - conda activate test + conda activate which python python --version echo $CONDA @@ -38,7 +38,7 @@ jobs: - name: Install DIALS environment and more run: | source $CONDA/etc/profile.d/conda.sh - conda activate test + conda activate conda install -n base -c conda-forge -y dials conda info conda list From 566b0b2ec267e8be57c9d763d7c9b19282a66eb4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:14:22 +0000 Subject: [PATCH 11/13] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/psf/black: 24.1.1 → 24.8.0](https://github.com/psf/black/compare/24.1.1...24.8.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df510e0..43b1099 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-docstring-first - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.8.0 hooks: - id: black From 92c0c19583ea5e0b277fe5af1a49413c856d05e8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:14:31 +0000 Subject: [PATCH 12/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/laue_dials/__init__.py | 6 ++---- src/laue_dials/algorithms/laue.py | 5 +++-- src/laue_dials/command_line/compute_rmsds.py | 3 +-- src/laue_dials/command_line/index.py | 6 ++---- src/laue_dials/command_line/integrate.py | 3 +-- src/laue_dials/command_line/optimize_indexing.py | 3 +-- src/laue_dials/command_line/plot_wavelengths.py | 3 +-- src/laue_dials/command_line/predict.py | 3 +-- src/laue_dials/command_line/refine.py | 7 +++++-- src/laue_dials/command_line/sequence_to_stills.py | 3 +-- tests/algorithms/test_laue.py | 11 ++++++++--- 11 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/laue_dials/__init__.py b/src/laue_dials/__init__.py index 5e28345..e451f10 100644 --- a/src/laue_dials/__init__.py +++ b/src/laue_dials/__init__.py @@ -2,11 +2,9 @@ if sys.version_info[:2] >= (3, 8): # TODO: Import directly (no need for conditional) when `python_requires = >= 3.8` - from importlib.metadata import (PackageNotFoundError, # pragma: no cover - version) + from importlib.metadata import PackageNotFoundError, version # pragma: no cover else: - from importlib_metadata import (PackageNotFoundError, # pragma: no cover - version) + from importlib_metadata import PackageNotFoundError, version # pragma: no cover try: # Change here if project is renamed and does not equal the package name diff --git a/src/laue_dials/algorithms/laue.py b/src/laue_dials/algorithms/laue.py index a2207a4..7576ae1 100644 --- a/src/laue_dials/algorithms/laue.py +++ b/src/laue_dials/algorithms/laue.py @@ -86,8 +86,9 @@ def gen_beam_models(expts, refls): # Imports from copy import deepcopy - from dials.algorithms.refinement.prediction.managed_predictors import \ - ExperimentsPredictorFactory + from dials.algorithms.refinement.prediction.managed_predictors import ( + ExperimentsPredictorFactory, + ) # Instantiate new ExperimentList/reflection_table new_expts = ExperimentList() diff --git a/src/laue_dials/command_line/compute_rmsds.py b/src/laue_dials/command_line/compute_rmsds.py index a286ff5..10ac257 100644 --- a/src/laue_dials/command_line/compute_rmsds.py +++ b/src/laue_dials/command_line/compute_rmsds.py @@ -13,8 +13,7 @@ import reciprocalspaceship as rs from cctbx import sgtbx from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from matplotlib import pyplot as plt from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/index.py b/src/laue_dials/command_line/index.py index 8eeba89..12812de 100644 --- a/src/laue_dials/command_line/index.py +++ b/src/laue_dials/command_line/index.py @@ -8,11 +8,9 @@ import libtbx.phil from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files -from laue_dials.algorithms.monochromatic import (initial_index, - scan_varying_refine) +from laue_dials.algorithms.monochromatic import initial_index, scan_varying_refine from laue_dials.utils.version import laue_version # Print laue-dials + DIALS versions diff --git a/src/laue_dials/command_line/integrate.py b/src/laue_dials/command_line/integrate.py index 78b0df9..ddd4dcf 100644 --- a/src/laue_dials/command_line/integrate.py +++ b/src/laue_dials/command_line/integrate.py @@ -17,8 +17,7 @@ from cctbx import sgtbx from dials.array_family import flex from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from laue_dials.algorithms.integration import SegmentedImage from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/optimize_indexing.py b/src/laue_dials/command_line/optimize_indexing.py index 9062618..1b58f5a 100644 --- a/src/laue_dials/command_line/optimize_indexing.py +++ b/src/laue_dials/command_line/optimize_indexing.py @@ -14,8 +14,7 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from dxtbx.model import ExperimentList from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/plot_wavelengths.py b/src/laue_dials/command_line/plot_wavelengths.py index d79c33b..e19b388 100644 --- a/src/laue_dials/command_line/plot_wavelengths.py +++ b/src/laue_dials/command_line/plot_wavelengths.py @@ -8,8 +8,7 @@ import libtbx.phil from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from matplotlib import pyplot as plt from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/predict.py b/src/laue_dials/command_line/predict.py index f565bb0..43470ac 100644 --- a/src/laue_dials/command_line/predict.py +++ b/src/laue_dials/command_line/predict.py @@ -16,8 +16,7 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from dxtbx.model import ExperimentList from laue_dials.algorithms.outliers import gen_kde diff --git a/src/laue_dials/command_line/refine.py b/src/laue_dials/command_line/refine.py index 3683943..676d52c 100644 --- a/src/laue_dials/command_line/refine.py +++ b/src/laue_dials/command_line/refine.py @@ -19,8 +19,11 @@ from dxtbx.model import ExperimentList from dxtbx.model.experiment_list import ExperimentListFactory -from laue_dials.algorithms.laue import (gen_beam_models, remove_beam_models, - store_wavelengths) +from laue_dials.algorithms.laue import ( + gen_beam_models, + remove_beam_models, + store_wavelengths, +) from laue_dials.utils.version import laue_version # Print laue-dials + DIALS versions diff --git a/src/laue_dials/command_line/sequence_to_stills.py b/src/laue_dials/command_line/sequence_to_stills.py index 1b6b979..52db7b8 100644 --- a/src/laue_dials/command_line/sequence_to_stills.py +++ b/src/laue_dials/command_line/sequence_to_stills.py @@ -14,8 +14,7 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import (ArgumentParser, - reflections_and_experiments_from_files) +from dials.util.options import ArgumentParser, reflections_and_experiments_from_files from dxtbx.model import MosaicCrystalSauter2014 from dxtbx.model.experiment_list import Experiment, ExperimentList from libtbx.phil import parse diff --git a/tests/algorithms/test_laue.py b/tests/algorithms/test_laue.py index 97a0696..4034098 100644 --- a/tests/algorithms/test_laue.py +++ b/tests/algorithms/test_laue.py @@ -5,9 +5,14 @@ from dials.array_family.flex import reflection_table from dxtbx.model import ExperimentList -from laue_dials.algorithms.laue import (LaueAssigner, LaueBase, LauePredictor, - gen_beam_models, remove_beam_models, - store_wavelengths) +from laue_dials.algorithms.laue import ( + LaueAssigner, + LaueBase, + LauePredictor, + gen_beam_models, + remove_beam_models, + store_wavelengths, +) @pytest.fixture From 80190f6c659e842f9331188d52dac142ccbb8a30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" Date: Mon, 5 Aug 2024 17:15:27 +0000 Subject: [PATCH 13/13] Commit formatting and linting fixes --- src/laue_dials/__init__.py | 6 ++++-- src/laue_dials/algorithms/laue.py | 5 ++--- src/laue_dials/command_line/compute_rmsds.py | 3 ++- src/laue_dials/command_line/index.py | 6 ++++-- src/laue_dials/command_line/integrate.py | 3 ++- src/laue_dials/command_line/optimize_indexing.py | 3 ++- src/laue_dials/command_line/plot_wavelengths.py | 3 ++- src/laue_dials/command_line/predict.py | 3 ++- src/laue_dials/command_line/refine.py | 7 ++----- src/laue_dials/command_line/sequence_to_stills.py | 3 ++- tests/algorithms/test_laue.py | 11 +++-------- 11 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/laue_dials/__init__.py b/src/laue_dials/__init__.py index e451f10..5e28345 100644 --- a/src/laue_dials/__init__.py +++ b/src/laue_dials/__init__.py @@ -2,9 +2,11 @@ if sys.version_info[:2] >= (3, 8): # TODO: Import directly (no need for conditional) when `python_requires = >= 3.8` - from importlib.metadata import PackageNotFoundError, version # pragma: no cover + from importlib.metadata import (PackageNotFoundError, # pragma: no cover + version) else: - from importlib_metadata import PackageNotFoundError, version # pragma: no cover + from importlib_metadata import (PackageNotFoundError, # pragma: no cover + version) try: # Change here if project is renamed and does not equal the package name diff --git a/src/laue_dials/algorithms/laue.py b/src/laue_dials/algorithms/laue.py index 7576ae1..a2207a4 100644 --- a/src/laue_dials/algorithms/laue.py +++ b/src/laue_dials/algorithms/laue.py @@ -86,9 +86,8 @@ def gen_beam_models(expts, refls): # Imports from copy import deepcopy - from dials.algorithms.refinement.prediction.managed_predictors import ( - ExperimentsPredictorFactory, - ) + from dials.algorithms.refinement.prediction.managed_predictors import \ + ExperimentsPredictorFactory # Instantiate new ExperimentList/reflection_table new_expts = ExperimentList() diff --git a/src/laue_dials/command_line/compute_rmsds.py b/src/laue_dials/command_line/compute_rmsds.py index 10ac257..a286ff5 100644 --- a/src/laue_dials/command_line/compute_rmsds.py +++ b/src/laue_dials/command_line/compute_rmsds.py @@ -13,7 +13,8 @@ import reciprocalspaceship as rs from cctbx import sgtbx from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from matplotlib import pyplot as plt from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/index.py b/src/laue_dials/command_line/index.py index 12812de..8eeba89 100644 --- a/src/laue_dials/command_line/index.py +++ b/src/laue_dials/command_line/index.py @@ -8,9 +8,11 @@ import libtbx.phil from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) -from laue_dials.algorithms.monochromatic import initial_index, scan_varying_refine +from laue_dials.algorithms.monochromatic import (initial_index, + scan_varying_refine) from laue_dials.utils.version import laue_version # Print laue-dials + DIALS versions diff --git a/src/laue_dials/command_line/integrate.py b/src/laue_dials/command_line/integrate.py index ddd4dcf..78b0df9 100644 --- a/src/laue_dials/command_line/integrate.py +++ b/src/laue_dials/command_line/integrate.py @@ -17,7 +17,8 @@ from cctbx import sgtbx from dials.array_family import flex from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from laue_dials.algorithms.integration import SegmentedImage from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/optimize_indexing.py b/src/laue_dials/command_line/optimize_indexing.py index 1b58f5a..9062618 100644 --- a/src/laue_dials/command_line/optimize_indexing.py +++ b/src/laue_dials/command_line/optimize_indexing.py @@ -14,7 +14,8 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from dxtbx.model import ExperimentList from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/plot_wavelengths.py b/src/laue_dials/command_line/plot_wavelengths.py index e19b388..d79c33b 100644 --- a/src/laue_dials/command_line/plot_wavelengths.py +++ b/src/laue_dials/command_line/plot_wavelengths.py @@ -8,7 +8,8 @@ import libtbx.phil from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from matplotlib import pyplot as plt from laue_dials.utils.version import laue_version diff --git a/src/laue_dials/command_line/predict.py b/src/laue_dials/command_line/predict.py index 43470ac..f565bb0 100644 --- a/src/laue_dials/command_line/predict.py +++ b/src/laue_dials/command_line/predict.py @@ -16,7 +16,8 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from dxtbx.model import ExperimentList from laue_dials.algorithms.outliers import gen_kde diff --git a/src/laue_dials/command_line/refine.py b/src/laue_dials/command_line/refine.py index 676d52c..3683943 100644 --- a/src/laue_dials/command_line/refine.py +++ b/src/laue_dials/command_line/refine.py @@ -19,11 +19,8 @@ from dxtbx.model import ExperimentList from dxtbx.model.experiment_list import ExperimentListFactory -from laue_dials.algorithms.laue import ( - gen_beam_models, - remove_beam_models, - store_wavelengths, -) +from laue_dials.algorithms.laue import (gen_beam_models, remove_beam_models, + store_wavelengths) from laue_dials.utils.version import laue_version # Print laue-dials + DIALS versions diff --git a/src/laue_dials/command_line/sequence_to_stills.py b/src/laue_dials/command_line/sequence_to_stills.py index 52db7b8..1b6b979 100644 --- a/src/laue_dials/command_line/sequence_to_stills.py +++ b/src/laue_dials/command_line/sequence_to_stills.py @@ -14,7 +14,8 @@ from dials.array_family import flex from dials.array_family.flex import reflection_table from dials.util import show_mail_handle_errors -from dials.util.options import ArgumentParser, reflections_and_experiments_from_files +from dials.util.options import (ArgumentParser, + reflections_and_experiments_from_files) from dxtbx.model import MosaicCrystalSauter2014 from dxtbx.model.experiment_list import Experiment, ExperimentList from libtbx.phil import parse diff --git a/tests/algorithms/test_laue.py b/tests/algorithms/test_laue.py index 4034098..97a0696 100644 --- a/tests/algorithms/test_laue.py +++ b/tests/algorithms/test_laue.py @@ -5,14 +5,9 @@ from dials.array_family.flex import reflection_table from dxtbx.model import ExperimentList -from laue_dials.algorithms.laue import ( - LaueAssigner, - LaueBase, - LauePredictor, - gen_beam_models, - remove_beam_models, - store_wavelengths, -) +from laue_dials.algorithms.laue import (LaueAssigner, LaueBase, LauePredictor, + gen_beam_models, remove_beam_models, + store_wavelengths) @pytest.fixture