diff --git a/README.md b/README.md index e5cda95..77e5c7c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,25 @@ The application also relies on several other packages. - [scikit-image](https://scikit-image.org/) - [PyVista](https://pyvista.org/) -Please see [arXiv](https://arxiv.org/abs/2606.25414) for additional information and citation. +### Citation + +If you use NeuXtalViz in your work, please cite: + +Z. Morgan, Z. Xiao, S. Pawledzio, I. Ye, K. Loughlin, S. Jin, V. Lynch, T. Proffen, C. Hoffmann, and X. Wang, "*NeuXtalViz*: interactive three-dimensional visualization and analysis for single-crystal neutron diffraction," *J. Appl. Cryst.* **59**(6) (2026). [https://doi.org/10.1107/S1600576726009106](https://doi.org/10.1107/S1600576726009106) + +```bibtex +@article{morgan2026neuxtalviz, + author = {Morgan, Zachary and Xiao, Zhongcan and Pawledzio, Sylwia and Ye, Iris and Loughlin, Kathleen and Jin, Shiyun and Lynch, Vickie and Proffen, Thomas and Hoffmann, Christina and Wang, Xiaoping}, + title = {{NeuXtalViz}: interactive three-dimensional visualization and analysis for single-crystal neutron diffraction}, + journal = {Journal of Applied Crystallography}, + volume = {59}, + number = {6}, + year = {2026}, + doi = {10.1107/S1600576726009106} +} +``` + +The preprint is on [arXiv](https://arxiv.org/abs/2606.25414). ### Documentation and tutorials diff --git a/docs/index.rst b/docs/index.rst index f3964b4..8a973e1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -24,6 +24,29 @@ Core libraries and technologies: NeuXtalViz is designed for extensibility, reproducibility, and ease of use for both novice and expert crystallographers. +Citation +-------- + +If you use NeuXtalViz in your work, please cite: + +Z. Morgan, Z. Xiao, S. Pawledzio, I. Ye, K. Loughlin, S. Jin, V. Lynch, +T. Proffen, C. Hoffmann, and X. Wang, "*NeuXtalViz*: interactive +three-dimensional visualization and analysis for single-crystal neutron +diffraction," *J. Appl. Cryst.* **59**\ (6) (2026). +https://doi.org/10.1107/S1600576726009106 + +.. code-block:: bibtex + + @article{morgan2026neuxtalviz, + author = {Morgan, Zachary and Xiao, Zhongcan and Pawledzio, Sylwia and Ye, Iris and Loughlin, Kathleen and Jin, Shiyun and Lynch, Vickie and Proffen, Thomas and Hoffmann, Christina and Wang, Xiaoping}, + title = {{NeuXtalViz}: interactive three-dimensional visualization and analysis for single-crystal neutron diffraction}, + journal = {Journal of Applied Crystallography}, + volume = {59}, + number = {6}, + year = {2026}, + doi = {10.1107/S1600576726009106} + } + .. toctree:: :maxdepth: 2 diff --git a/src/NeuXtalViz/application.py b/src/NeuXtalViz/application.py index 105cb4a..11a8e5a 100644 --- a/src/NeuXtalViz/application.py +++ b/src/NeuXtalViz/application.py @@ -242,6 +242,11 @@ def show_about_dialog(self): "Modern toolkit for single-crystal neutron diffraction analysis and visualization.
" "
Project webpage: " 'https://neutrons.github.io/NeuXtalViz-tools/index.html' + "

If you use NeuXtalViz, please cite:
" + "Z. Morgan, Z. Xiao, S. Pawledzio, I. Ye, K. Loughlin, " + "S. Jin, V. Lynch, T. Proffen, C. Hoffmann, and X. Wang, " + "J. Appl. Cryst. 59(6) (2026).
" + 'https://doi.org/10.1107/S1600576726009106' ), ) diff --git a/src/NeuXtalViz/views/base_view.py b/src/NeuXtalViz/views/base_view.py index f1db505..4e34fa4 100644 --- a/src/NeuXtalViz/views/base_view.py +++ b/src/NeuXtalViz/views/base_view.py @@ -7,6 +7,7 @@ from qtpy.QtWidgets import ( QWidget, QFrame, + QGroupBox, QGridLayout, QHBoxLayout, QVBoxLayout, @@ -57,6 +58,37 @@ } +def group_box(title, layout, parent=None, margins=(6, 4, 6, 4)): + """ + Titled frame around a section of a tool's controls. + + QDarkStyle draws the title bold on a thin frame, in light and dark. + + Parameters + ---------- + title : str + Section title. + layout : QLayout + Layout holding the section's widgets. + parent : QWidget, optional + Parent widget. + margins : tuple of int, optional + Left, top, right, and bottom margins of the layout inside the box. + Smaller than Qt's default, to keep tall tabs compact. + + Returns + ------- + box : QGroupBox + The box, to add to the tab's layout with ``addWidget``. + + """ + + box = QGroupBox(title, parent) + layout.setContentsMargins(*margins) + box.setLayout(layout) + return box + + class NeuXtalVizWidget(QWidget): """ Base widget for all NeuXtalViz views, providing shared functionality diff --git a/src/NeuXtalViz/views/crystal_structure_tools.py b/src/NeuXtalViz/views/crystal_structure_tools.py index 0a58f7e..3536bf8 100644 --- a/src/NeuXtalViz/views/crystal_structure_tools.py +++ b/src/NeuXtalViz/views/crystal_structure_tools.py @@ -29,7 +29,7 @@ from NeuXtalViz.config.atoms import colors, radii from NeuXtalViz.config.magnetic_form_factors import J0 as MAGNETIC_J0 from NeuXtalViz.views.periodic_table import PeriodicTableView -from NeuXtalViz.views.base_view import NeuXtalVizWidget +from NeuXtalViz.views.base_view import NeuXtalVizWidget, group_box import qtawesome as qta @@ -227,8 +227,10 @@ def structure_tab(self): crystal_layout.addWidget(self.load_CIF_button) crystal_layout.addWidget(self.save_INS_button) - structure_layout.addLayout(crystal_layout) - structure_layout.addLayout(parameters_layout) + structure_layout.addWidget(group_box("Space Group", crystal_layout)) + structure_layout.addWidget( + group_box("Lattice Parameters", parameters_layout) + ) stretch = QHeaderView.Stretch @@ -244,8 +246,6 @@ def structure_tab(self): self.atm_table.setEditTriggers(QTableWidget.NoEditTriggers) self.atm_table.setSelectionBehavior(QTableWidget.SelectRows) - structure_layout.addWidget(self.atm_table) - scatterer_layout = QHBoxLayout() self.atm_button = QPushButton("", self) @@ -309,8 +309,12 @@ def structure_tab(self): sample_layout.addWidget(self.V_line) sample_layout.addWidget(uc_vol_label) - structure_layout.addLayout(scatterer_layout) - structure_layout.addLayout(sample_layout) + atoms_layout = QVBoxLayout() + atoms_layout.addWidget(self.atm_table) + atoms_layout.addLayout(scatterer_layout) + + structure_layout.addWidget(group_box("Atoms", atoms_layout)) + structure_layout.addWidget(group_box("Composition", sample_layout)) struct_tab.setLayout(structure_layout) @@ -438,9 +442,14 @@ def factors_tab(self): indivdual_layout.addStretch(1) indivdual_layout.addWidget(self.individual_button) - factors_layout.addLayout(calculate_layout) - factors_layout.addWidget(self.f2_table) - factors_layout.addLayout(indivdual_layout) + all_layout = QVBoxLayout() + all_layout.addLayout(calculate_layout) + all_layout.addWidget(self.f2_table) + + factors_layout.addWidget(group_box("All Reflections", all_layout)) + factors_layout.addWidget( + group_box("Single Reflection", indivdual_layout) + ) fact_tab.setLayout(factors_layout) @@ -553,7 +562,6 @@ def absorption_tab(self): b_star_label1 = QLabel("b*", self) c_star_label1 = QLabel("c*", self) - sample_orient_label = QLabel("Sample Orientation", self) sample_u_label = QLabel("Beam Direction:", self) sample_v_label = QLabel("In-plane Direction:", self) @@ -567,9 +575,6 @@ def absorption_tab(self): sample_orient_layout = QGridLayout() - sample_orient_layout.addWidget( - sample_orient_label, 0, 0, Qt.AlignCenter - ) sample_orient_layout.addWidget(a_star_label1, 0, 1, Qt.AlignCenter) sample_orient_layout.addWidget(b_star_label1, 0, 2, Qt.AlignCenter) sample_orient_layout.addWidget(c_star_label1, 0, 3, Qt.AlignCenter) @@ -588,7 +593,6 @@ def absorption_tab(self): b_star_label2 = QLabel("b*", self) c_star_label2 = QLabel("c*", self) - shape_orient_label = QLabel("Shape Orientation", self) shape_u_label = QLabel("Along Thickness:", self) shape_v_label = QLabel("In-plane Lateral:", self) @@ -602,7 +606,6 @@ def absorption_tab(self): shape_orient_layout = QGridLayout() - shape_orient_layout.addWidget(shape_orient_label, 0, 0, Qt.AlignCenter) shape_orient_layout.addWidget(a_star_label2, 0, 1, Qt.AlignCenter) shape_orient_layout.addWidget(b_star_label2, 0, 2, Qt.AlignCenter) shape_orient_layout.addWidget(c_star_label2, 0, 3, Qt.AlignCenter) @@ -733,12 +736,20 @@ def absorption_tab(self): cryst_layout.addWidget(self.abs_m_line, 8, 1) cryst_layout.addWidget(m_unit_label, 8, 2) - abs_layout.addLayout(shape_layout) + abs_layout.addWidget( + group_box("Ellipsoid and Wavelength", shape_layout) + ) abs_layout.addWidget(self.abs_table) - abs_layout.addLayout(sample_orient_layout) - abs_layout.addLayout(shape_orient_layout) - abs_layout.addLayout(material_layout) - abs_layout.addLayout(cryst_layout) + abs_layout.addWidget( + group_box("Sample Orientation", sample_orient_layout) + ) + abs_layout.addWidget( + group_box("Shape Orientation", shape_orient_layout) + ) + abs_layout.addWidget(group_box("Material", material_layout)) + abs_layout.addWidget( + group_box("Scattering and Absorption", cryst_layout) + ) abs_tab.setLayout(abs_layout) @@ -831,7 +842,6 @@ def simulator_tab(self): notation = QDoubleValidator.StandardNotation # --- Instrument / d-min ----------------------------------------- - instrument_label = QLabel("Instrument", self) dmin_label = QLabel("d(min)", self) angstrom_label = QLabel("Å", self) @@ -849,7 +859,6 @@ def simulator_tab(self): self.sim_dmin_line.setPlaceholderText("d-min (Å)") instrument_layout = QHBoxLayout() - instrument_layout.addWidget(instrument_label) instrument_layout.addWidget(self.sim_instrument_combo) instrument_layout.addWidget(dmin_label) instrument_layout.addWidget(self.sim_dmin_line) @@ -880,7 +889,6 @@ def simulator_tab(self): b_star_label = QLabel("b*", self) c_star_label = QLabel("c*", self) - orient_label = QLabel("Sample Orientation", self) u_label = QLabel("Beam Direction:", self) v_label = QLabel("In-plane Direction:", self) @@ -894,7 +902,6 @@ def simulator_tab(self): orient_layout = QGridLayout() - orient_layout.addWidget(orient_label, 0, 0, Qt.AlignCenter) orient_layout.addWidget(a_star_label, 0, 1, Qt.AlignCenter) orient_layout.addWidget(b_star_label, 0, 2, Qt.AlignCenter) orient_layout.addWidget(c_star_label, 0, 3, Qt.AlignCenter) @@ -909,7 +916,6 @@ def simulator_tab(self): orient_layout.addWidget(self.sim_lv_line, 2, 3) # --- Goniometer ---------------------------------------------------- - gon_label = QLabel("Goniometer", self) omega_label = QLabel("ω", self) chi_label = QLabel("χ", self) phi_label = QLabel("φ", self) @@ -938,7 +944,6 @@ def simulator_tab(self): self.sim_calculate_button.setIcon(qta.icon("fa6s.calculator")) gon_layout = QHBoxLayout() - gon_layout.addWidget(gon_label) gon_layout.addWidget(omega_label) gon_layout.addWidget(self.sim_omega_line) gon_layout.addWidget(chi_label) @@ -1038,13 +1043,23 @@ def simulator_tab(self): R_sigma_layout.addWidget(R_sigma_mag_unit_label) R_sigma_layout.addStretch(1) - sim_layout.addLayout(instrument_layout) - sim_layout.addLayout(UB_layout) - sim_layout.addLayout(orient_layout) - sim_layout.addLayout(gon_layout) - sim_layout.addLayout(mag_layout) - sim_layout.addWidget(self.sim_table) - sim_layout.addLayout(R_sigma_layout) + sample_layout = QVBoxLayout() + sample_layout.addLayout(UB_layout) + sample_layout.addLayout(orient_layout) + + reflections_layout = QVBoxLayout() + reflections_layout.addWidget(self.sim_table) + reflections_layout.addLayout(R_sigma_layout) + + sim_layout.addWidget(group_box("Instrument", instrument_layout)) + sim_layout.addWidget(group_box("Sample Orientation", sample_layout)) + sim_layout.addWidget( + group_box("Goniometer and Counting Time", gon_layout) + ) + sim_layout.addWidget(group_box("Magnetic Ions", mag_layout)) + sim_layout.addWidget( + group_box("Simulated Reflections", reflections_layout) + ) sim_tab.setLayout(sim_layout) diff --git a/src/NeuXtalViz/views/experiment_planner.py b/src/NeuXtalViz/views/experiment_planner.py index 3e9cede..3d9f3cd 100644 --- a/src/NeuXtalViz/views/experiment_planner.py +++ b/src/NeuXtalViz/views/experiment_planner.py @@ -40,7 +40,7 @@ ExtremeFinderSimple, MaxNLocator, ) -from NeuXtalViz.views.base_view import NeuXtalVizWidget +from NeuXtalViz.views.base_view import NeuXtalVizWidget, group_box import qtawesome as qta @@ -464,7 +464,7 @@ def coverage_tab(self): data_layout.addWidget(l_max_label) data_layout.addWidget(self.l_max_line) - result_layout.addLayout(data_layout) + result_layout.addWidget(group_box("Display", data_layout)) self.canvas_cov = FigureCanvas( Figure(constrained_layout=True, figsize=(6.4, 4.8)) @@ -511,7 +511,9 @@ def coverage_tab(self): results_tab.addTab(coverage_tab, "Resolution") results_tab.addTab(cumulative_tab, "Cumulative") - planner_layout.addLayout(details_layout) + planner_layout.addWidget( + group_box("Experiment Settings", details_layout) + ) planner_layout.addLayout(result_layout) planner_layout.addWidget(results_tab) @@ -793,7 +795,9 @@ def mesh_tab(self): mesh_layout.addLayout(control_layout) mesh_layout.addWidget(NavigationToolbar2QT(self.canvas_slice, self)) mesh_layout.addWidget(self.canvas_slice) - mesh_layout.addLayout(convert_to_hkl_params_layout) + mesh_layout.addWidget( + group_box("Projection", convert_to_hkl_params_layout) + ) inst_tab.setLayout(mesh_layout) @@ -971,7 +975,7 @@ def peak_tab(self): calculator_layout.addWidget(self.d_spacing_line, 1, 9) calculator_layout.addWidget(self.d_spacing_alt_line, 2, 9) - peak_layout.addLayout(calculator_layout) + peak_layout.addWidget(group_box("Peak Calculator", calculator_layout)) self.canvas_inst = FigureCanvas(Figure(constrained_layout=True)) self.canvas_laue = FigureCanvas(Figure(constrained_layout=True)) @@ -1059,7 +1063,7 @@ def peak_tab(self): orientation_layout.addWidget(self.comment_line) orientation_layout.addWidget(self.add_button) - peak_layout.addLayout(orientation_layout) + peak_layout.addWidget(group_box("Orientation", orientation_layout)) stretch = QHeaderView.Stretch diff --git a/src/NeuXtalViz/views/ub_tools.py b/src/NeuXtalViz/views/ub_tools.py index fc8d118..aec8723 100644 --- a/src/NeuXtalViz/views/ub_tools.py +++ b/src/NeuXtalViz/views/ub_tools.py @@ -21,7 +21,6 @@ QGridLayout, QTabWidget, QFileDialog, - QFrame, QSlider, QAbstractItemView, QMessageBox, @@ -53,7 +52,7 @@ MaxNLocator, ) -from NeuXtalViz.views.base_view import NeuXtalVizWidget +from NeuXtalViz.views.base_view import NeuXtalVizWidget, group_box import qtawesome as qta @@ -136,6 +135,7 @@ def parameters_tab(self): self.tab_widget.addTab(ub_peaks_tab, "Parameters") ub_layout = QVBoxLayout() + ub_layout.setSpacing(2) self.save_q_button = QPushButton("Save Q", self) self.save_q_button.setToolTip("Save the Q workspace to a file.") @@ -166,18 +166,6 @@ def parameters_tab(self): self.peaks_label.setStyleSheet("color: red;") self.ub_label.setStyleSheet("color: red;") - convert_frame = QFrame() - convert_frame.setFrameShape(QFrame.Shape.HLine) - convert_frame.setFrameShadow(QFrame.Shadow.Sunken) - - peaks_frame = QFrame() - peaks_frame.setFrameShape(QFrame.Shape.HLine) - peaks_frame.setFrameShadow(QFrame.Shadow.Sunken) - - ubS_frame = QFrame() - ubS_frame.setFrameShape(QFrame.Shape.HLine) - ubS_frame.setFrameShadow(QFrame.Shadow.Sunken) - convert_io_layout = QHBoxLayout() convert_io_layout.addWidget(self.q_label) @@ -204,17 +192,19 @@ def parameters_tab(self): self.ub_tab = self.__init_ub_tab() values_tab = self.__init_values_tab() - ub_layout.addWidget(convert_tab) - ub_layout.addLayout(convert_io_layout) - ub_layout.addWidget(convert_frame) - - ub_layout.addWidget(self.peaks_tab) - ub_layout.addLayout(peaks_io_layout) - ub_layout.addWidget(peaks_frame) - - ub_layout.addWidget(self.ub_tab) - ub_layout.addLayout(ub_io_layout) - ub_layout.addWidget(ubS_frame) + sections = [ + ("Q-Sample", convert_tab, convert_io_layout), + ("Peaks", self.peaks_tab, peaks_io_layout), + ("UB Matrix", self.ub_tab, ub_io_layout), + ] + for title, tab, io_layout in sections: + section_layout = QVBoxLayout() + section_layout.setSpacing(2) + section_layout.addWidget(tab) + section_layout.addLayout(io_layout) + ub_layout.addWidget( + group_box(title, section_layout, margins=(2, 8, 2, 2)) + ) ub_layout.addWidget(values_tab) @@ -1762,11 +1752,17 @@ def table_tab(self): peak_info.addWidget(self.int_n_line, 1, 4) peak_info.addWidget(self.int_p_line, 1, 5) - peaks_layout.addLayout(calculator_layout) - peaks_layout.addWidget(self.peaks_table) - peaks_layout.addLayout(hkl_info) - peaks_layout.addLayout(peak_info) - peaks_layout.addLayout(extended_info) + table_layout = QVBoxLayout() + table_layout.addWidget(self.peaks_table) + table_layout.addLayout(hkl_info) + + selected_layout = QVBoxLayout() + selected_layout.addLayout(peak_info) + selected_layout.addLayout(extended_info) + + peaks_layout.addWidget(group_box("Peak Calculator", calculator_layout)) + peaks_layout.addWidget(group_box("Peaks Table", table_layout)) + peaks_layout.addWidget(group_box("Selected Peak", selected_layout)) peaks_table_tab.setLayout(peaks_layout) @@ -1979,7 +1975,9 @@ def __init_inspect_tab(self): convert_to_hkl_view_layout.addWidget(QLabel("V Max:", self)) convert_to_hkl_view_layout.addWidget(self.vmax_line) - convert_to_hkl_tab_layout.addLayout(convert_to_hkl_params_layout) + convert_to_hkl_tab_layout.addWidget( + group_box("Projection", convert_to_hkl_params_layout) + ) convert_to_hkl_tab_layout.addStretch(1) convert_to_hkl_tab_layout.addLayout(convert_to_hkl_action_layout) diff --git a/src/NeuXtalViz/views/volume_slicer.py b/src/NeuXtalViz/views/volume_slicer.py index 3b8cf06..dfff024 100644 --- a/src/NeuXtalViz/views/volume_slicer.py +++ b/src/NeuXtalViz/views/volume_slicer.py @@ -40,7 +40,7 @@ MaxNLocator, ) -from NeuXtalViz.views.base_view import NeuXtalVizWidget +from NeuXtalViz.views.base_view import NeuXtalVizWidget, group_box from NeuXtalViz.config import colormap import qtawesome as qta @@ -831,11 +831,16 @@ def transform_tab(self): steps_layout.addWidget(self.pdf_output_line, 3, 7) steps_layout.addWidget(self.calculate_pdf_button, 3, 8) - layout.addLayout(manage_layout) - layout.addLayout(combine_layout) - layout.addLayout(crystal_layout) - layout.addLayout(steps_layout) - layout.addLayout(self._bond_network_layout()) + pdf_layout = QVBoxLayout() + pdf_layout.addLayout(crystal_layout) + pdf_layout.addLayout(steps_layout) + + layout.addWidget(group_box("Workspaces", manage_layout)) + layout.addWidget(group_box("Arithmetic", combine_layout)) + layout.addWidget(group_box("3D-ΔPDF", pdf_layout)) + layout.addWidget( + group_box("Bond Network", self._bond_network_layout()) + ) layout.addStretch(1) transform_tab.setLayout(layout)