Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2577 orientation viewer doesnt work from nigthly build on mac #2600

Merged
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
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