Skip to content

Commit

Permalink
Merge branch 'main' into particle-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Potrzebowski authored Sep 12, 2023
2 parents 3b75a12 + 1f6e909 commit 136b234
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build_tools/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pytest_qt
pytest-mock
unittest-xml-reporting
tinycc
h5py
h5py
sphinx
pyparsing
html5lib
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def run(self):
# Required packages
required = [
'bumps>=0.7.5.9', 'periodictable>=1.5.0', 'pyparsing>=2.0.0',
'lxml', 'h5py',
'lxml',
]

if os.name == 'nt':
Expand Down
31 changes: 16 additions & 15 deletions src/sas/qtgui/Utilities/OrientationViewer/OrientationViewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ class OrientationViewer(QtWidgets.QWidget):


# Dimensions of scattering cuboid
a = 0.1
b = 0.4
c = 1.0
a = 10
b = 40
c = 100

screen_scale = 0.01 # Angstroms to screen size

arrow_size = 0.2
arrow_color = uniform_coloring(0.9, 0.9, 0.9)
ghost_color = uniform_coloring(0.0, 0.6, 0.2)
cube_color = uniform_coloring(0.0, 0.8, 0.0)

cuboid_scaling = [a, b, c]

n_ghosts_per_perameter = 8
n_q_samples = 128
Expand All @@ -53,9 +54,9 @@ class OrientationViewer(QtWidgets.QWidget):
@staticmethod
def create_ghost():
""" Helper function: Create a ghost cube"""
return Scaling(OrientationViewer.a,
OrientationViewer.b,
OrientationViewer.c,
return Scaling(OrientationViewer.a*OrientationViewer.screen_scale,
OrientationViewer.b*OrientationViewer.screen_scale,
OrientationViewer.c*OrientationViewer.screen_scale,
Cube(edge_colors=OrientationViewer.ghost_color))

def __init__(self, parent=None):
Expand Down Expand Up @@ -130,9 +131,9 @@ def __init__(self, parent=None):


self.first_rotation = Rotation(0,0,0,1,
Scaling(OrientationViewer.a,
OrientationViewer.b,
OrientationViewer.c,
Scaling(OrientationViewer.a*OrientationViewer.screen_scale,
OrientationViewer.b*OrientationViewer.screen_scale,
OrientationViewer.c*OrientationViewer.screen_scale,
Cube(
edge_colors=OrientationViewer.ghost_color,
colors=OrientationViewer.cube_color)),
Expand Down Expand Up @@ -170,7 +171,7 @@ def colormap(self, colormap_name: str):
def _set_image_data(self, orientation: Orientation):
""" Set the data on the plot"""

data = self.scatering_data(orientation)
data = self.scattering_data(orientation)

scaled_data = (np.log(data) - OrientationViewer.log_I_min) / OrientationViewer.log_I_range
self.image_plane_data = np.clip(scaled_data, 0, 1)
Expand Down Expand Up @@ -252,7 +253,7 @@ def polydispersity_sample_count(self, orientation):

return (samples * x for x in is_polydisperse)

def scatering_data(self, orientation: Orientation) -> np.ndarray:
def scattering_data(self, orientation: Orientation) -> np.ndarray:

# add the orientation parameters to the model parameters

Expand All @@ -271,9 +272,9 @@ def scatering_data(self, orientation: Orientation) -> np.ndarray:
psi_pd=orientation.dpsi,
psi_pd_type=OrientationViewer.polydispersity_distribution,
psi_pd_n=psi_pd_n,
a=OrientationViewer.a,
b=OrientationViewer.b,
c=OrientationViewer.c,
length_a=OrientationViewer.a,
length_b=OrientationViewer.b,
length_c=OrientationViewer.c,
background=np.exp(OrientationViewer.log_I_min))

return np.reshape(data, (OrientationViewer.n_q_samples, OrientationViewer.n_q_samples))
Expand Down

0 comments on commit 136b234

Please sign in to comment.