Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/NeuXtalViz/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ def show_about_dialog(self):
"Modern toolkit for single-crystal neutron diffraction analysis and visualization.<br>"
"<br>Project webpage: "
'<a href="https://neutrons.github.io/NeuXtalViz-tools/index.html">https://neutrons.github.io/NeuXtalViz-tools/index.html</a>'
"<br><br>If you use NeuXtalViz, please cite:<br>"
"Z. Morgan, Z. Xiao, S. Pawledzio, I. Ye, K. Loughlin, "
"S. Jin, V. Lynch, T. Proffen, C. Hoffmann, and X. Wang, "
"<i>J. Appl. Cryst.</i> <b>59</b>(6) (2026).<br>"
'<a href="https://doi.org/10.1107/S1600576726009106">https://doi.org/10.1107/S1600576726009106</a>'
),
)

Expand Down
32 changes: 32 additions & 0 deletions src/NeuXtalViz/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from qtpy.QtWidgets import (
QWidget,
QFrame,
QGroupBox,
QGridLayout,
QHBoxLayout,
QVBoxLayout,
Expand Down Expand Up @@ -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
Expand Down
83 changes: 49 additions & 34 deletions src/NeuXtalViz/views/crystal_structure_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down
16 changes: 10 additions & 6 deletions src/NeuXtalViz/views/experiment_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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

Expand Down
Loading
Loading