Skip to content

Commit

Permalink
Merge pull request #204 from rprospero/Ticket_1223
Browse files Browse the repository at this point in the history
Ticket 1223: Expand permitted range of transformed data in Corfunc implementation
  • Loading branch information
smk78 authored Jan 23, 2019
2 parents a13c41b + ef74a8b commit 3d5e629
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/sas/sascalc/corfunc/transform_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def compute(self):
# ----- 3D Correlation Function -----
# gamma3(R) = 1/R int_{0}^{R} gamma1(x) dx
# trapz uses the trapezium rule to calculate the integral
mask = xs <= 200.0 # Only calculate gamma3 up to x=200 (as this is all that's plotted)
mask = xs <= 1000.0 # Only calculate gamma3 up to x=1000 (as this is all that's plotted)
# gamma3 = [trapz(gamma1[:n], xs[:n])/xs[n-1] for n in range(2, len(xs[mask]) + 1)]j
# gamma3.insert(0, 1.0) # Gamma_3(0) is defined as 1
n = len(xs[mask])
Expand Down Expand Up @@ -78,7 +78,7 @@ def compute(self):
self.update(msg="Fourier transform completed.")

transform1 = Data1D(xs, gamma1)
transform3 = Data1D(xs[xs <= 200], gamma3)
transform3 = Data1D(xs[xs <= 1000], gamma3)
idf = Data1D(xs, idf)

transforms = (transform1, transform3, idf)
Expand Down
10 changes: 5 additions & 5 deletions src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ def transform_complete(self, transforms=None):

self._transformed_data = transforms
(transform1, transform3, idf) = transforms
plot_x = transform1.x[transform1.x <= 200]
plot_y = transform1.y[transform1.x <= 200]
plot_x = transform1.x[transform1.x <= 1000]
plot_y = transform1.y[transform1.x <= 1000]
self._manager.show_data(Data1D(plot_x, plot_y), TRANSFORM_LABEL1)
# No need to shorten gamma3 as it's only calculated up to x=200
# No need to shorten gamma3 as it's only calculated up to x=1000
self._manager.show_data(transform3, TRANSFORM_LABEL3)

plot_x = idf.x[idf.x <= 200]
plot_y = idf.y[idf.x <= 200]
plot_x = idf.x[idf.x <= 1000]
plot_y = idf.y[idf.x <= 1000]
self._manager.show_data(Data1D(plot_x, plot_y), IDF_LABEL)

# Only enable extract params button if a fourier trans. has been done
Expand Down

0 comments on commit 3d5e629

Please sign in to comment.