From f90e728ac01b912076d833db875557b627615462 Mon Sep 17 00:00:00 2001 From: dennisbrookner Date: Thu, 26 Oct 2023 11:22:36 -0400 Subject: [PATCH 1/3] add new CLI and instructions for dev install --- README.rst | 8 +++++++- docs/cli/find_spots.rst | 24 ++++++++++++++++++++++++ docs/cli/functions.md | 4 +++- docs/cli/index.rst | 24 ++++++++++++++++++++++++ docs/cli/plot_wavelengths.rst | 24 ++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 docs/cli/find_spots.rst create mode 100644 docs/cli/index.rst create mode 100644 docs/cli/plot_wavelengths.rst diff --git a/README.rst b/README.rst index b610104..f7865e6 100644 --- a/README.rst +++ b/README.rst @@ -37,12 +37,18 @@ To install ``laue-dials``, the DIALS code must first be installed using conda install -c conda-forge dials -Then, using the DIALS python environment, run the following: +Then, using the same python environment, run the following to install ``laue-dials`` from ``pip``: .. code:: python pip install laue-dials +or alternatively, install the development version of ``laue-dials`` from GitHub: + +.. code:: python + + pip install git+https://github.com/rs-station/laue-dials.git + ``laue-dials`` consists of several command-line scripts for the processing of Laue diffraction data, which are .. code:: python diff --git a/docs/cli/find_spots.rst b/docs/cli/find_spots.rst new file mode 100644 index 0000000..7478435 --- /dev/null +++ b/docs/cli/find_spots.rst @@ -0,0 +1,24 @@ +.. _find_spots: + +laue_dials.find_spots +===================== + +Introduction +------------ + +.. python_string:: laue_dials.command_line.find_spots.help_message + +Basic parameters +---------------- + +.. phil:: laue_dials.command_line.find_spots.working_phil + :expert-level: 0 + :attributes-level: 0 + + +Full parameter definitions +-------------------------- + +.. phil:: laue_dials.command_line.find_spots.working_phil + :expert-level: 2 + :attributes-level: 2 diff --git a/docs/cli/functions.md b/docs/cli/functions.md index 439cf8b..5e38954 100644 --- a/docs/cli/functions.md +++ b/docs/cli/functions.md @@ -6,11 +6,13 @@ .. toctree:: :maxdepth: 1 - initial_solution + find_spots + index sequence_to_stills optimize_indexing refine predict integrate + plot_wavelengths ``` diff --git a/docs/cli/index.rst b/docs/cli/index.rst new file mode 100644 index 0000000..fd71dad --- /dev/null +++ b/docs/cli/index.rst @@ -0,0 +1,24 @@ +.. _index: + +laue_dials.index +================ + +Introduction +------------ + +.. python_string:: laue_dials.command_line.index.help_message + +Basic parameters +---------------- + +.. phil:: laue_dials.command_line.index.working_phil + :expert-level: 0 + :attributes-level: 0 + + +Full parameter definitions +-------------------------- + +.. phil:: laue_dials.command_line.index.working_phil + :expert-level: 2 + :attributes-level: 2 diff --git a/docs/cli/plot_wavelengths.rst b/docs/cli/plot_wavelengths.rst new file mode 100644 index 0000000..467fc42 --- /dev/null +++ b/docs/cli/plot_wavelengths.rst @@ -0,0 +1,24 @@ +.. _plot_wavelengths: + +laue_dials.plot_wavelengths +=========================== + +Introduction +------------ + +.. python_string:: laue_dials.command_line.plot_wavelengths.help_message + +Basic parameters +---------------- + +.. phil:: laue_dials.command_line.plot_wavelengths.working_phil + :expert-level: 0 + :attributes-level: 0 + + +Full parameter definitions +-------------------------- + +.. phil:: laue_dials.command_line.plot_wavelengths.working_phil + :expert-level: 2 + :attributes-level: 2 From ee87b8e599738de7fb800b4bc7c88e9f7af7dcef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:25:27 +0000 Subject: [PATCH 2/3] [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/find_spots.py | 4 ++-- src/laue_dials/command_line/index.py | 14 ++++++-------- 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 +-- 10 files changed, 23 insertions(+), 28 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 491eccf..7b989d1 100644 --- a/src/laue_dials/algorithms/laue.py +++ b/src/laue_dials/algorithms/laue.py @@ -100,8 +100,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/find_spots.py b/src/laue_dials/command_line/find_spots.py index 5071c8b..5ff2c0c 100644 --- a/src/laue_dials/command_line/find_spots.py +++ b/src/laue_dials/command_line/find_spots.py @@ -18,8 +18,8 @@ This program takes a DIALS imported experiment list (generated with dials.import) and generates a reflection table of strong spots -for the remainder of the pipeline. The output is a strong.refl file -that contains all the found strong spots for the experiment. +for the remainder of the pipeline. The output is a strong.refl file +that contains all the found strong spots for the experiment. Examples: diff --git a/src/laue_dials/command_line/index.py b/src/laue_dials/command_line/index.py index 968e357..e36f80a 100644 --- a/src/laue_dials/command_line/index.py +++ b/src/laue_dials/command_line/index.py @@ -8,22 +8,20 @@ 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 logger = logging.getLogger("laue-dials.command_line.index") help_message = """ This program takes a DIALS imported experiment list (generated with -dials.import) and a strong reflection table and generates an initial -monochromatic indexing solution to feed into the remainder of the pipeline. -The outputs are a pair of files (monochromatic.expt, monochromatic.refl) +dials.import) and a strong reflection table and generates an initial +monochromatic indexing solution to feed into the remainder of the pipeline. +The outputs are a pair of files (monochromatic.expt, monochromatic.refl) that constitute a monochromatic estimate of a geometric solution for the -experiment. +experiment. Examples: diff --git a/src/laue_dials/command_line/integrate.py b/src/laue_dials/command_line/integrate.py index 0ef9e6c..3886dd3 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 diff --git a/src/laue_dials/command_line/optimize_indexing.py b/src/laue_dials/command_line/optimize_indexing.py index 6e2fc96..bf7cdf9 100644 --- a/src/laue_dials/command_line/optimize_indexing.py +++ b/src/laue_dials/command_line/optimize_indexing.py @@ -13,8 +13,7 @@ import numpy as np 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 logger = logging.getLogger("laue-dials.command_line.optimize_indexing") diff --git a/src/laue_dials/command_line/plot_wavelengths.py b/src/laue_dials/command_line/plot_wavelengths.py index fa3be19..49fac8a 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 logger = logging.getLogger("laue-dials.command_line.plot_wavelengths") diff --git a/src/laue_dials/command_line/predict.py b/src/laue_dials/command_line/predict.py index a8e132f..e65c511 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 d1a5f5f..cae01bf 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, +) logger = logging.getLogger("laue-dials.command_line.refine") diff --git a/src/laue_dials/command_line/sequence_to_stills.py b/src/laue_dials/command_line/sequence_to_stills.py index cbce992..34c090a 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 From e48c022d7e5c586499e17fe516c428e89843bcda Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" Date: Thu, 26 Oct 2023 15:25:54 +0000 Subject: [PATCH 3/3] Commit formatting and linting fixes --- src/laue_dials/__init__.py | 6 ++++-- src/laue_dials/algorithms/laue.py | 5 ++--- 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 ++- 9 files changed, 22 insertions(+), 17 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 7b989d1..491eccf 100644 --- a/src/laue_dials/algorithms/laue.py +++ b/src/laue_dials/algorithms/laue.py @@ -100,9 +100,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/index.py b/src/laue_dials/command_line/index.py index e36f80a..70741df 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) logger = logging.getLogger("laue-dials.command_line.index") diff --git a/src/laue_dials/command_line/integrate.py b/src/laue_dials/command_line/integrate.py index 3886dd3..0ef9e6c 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 diff --git a/src/laue_dials/command_line/optimize_indexing.py b/src/laue_dials/command_line/optimize_indexing.py index bf7cdf9..6e2fc96 100644 --- a/src/laue_dials/command_line/optimize_indexing.py +++ b/src/laue_dials/command_line/optimize_indexing.py @@ -13,7 +13,8 @@ import numpy as np 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 logger = logging.getLogger("laue-dials.command_line.optimize_indexing") diff --git a/src/laue_dials/command_line/plot_wavelengths.py b/src/laue_dials/command_line/plot_wavelengths.py index 49fac8a..fa3be19 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 logger = logging.getLogger("laue-dials.command_line.plot_wavelengths") diff --git a/src/laue_dials/command_line/predict.py b/src/laue_dials/command_line/predict.py index e65c511..a8e132f 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 cae01bf..d1a5f5f 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) logger = logging.getLogger("laue-dials.command_line.refine") diff --git a/src/laue_dials/command_line/sequence_to_stills.py b/src/laue_dials/command_line/sequence_to_stills.py index 34c090a..cbce992 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