Skip to content

Commit

Permalink
fix the FT param reading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
y8z committed Oct 15, 2024
1 parent 6da0bd5 commit 0f81320
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
32 changes: 30 additions & 2 deletions addie/addiedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,43 @@ def calculate_gr(
pdf_filter = True
if pdf_filter != 'lorch':
print(
'[WARNING] PDF filter {0} is not supported.'.format(pdf_filter))
'[WARNING] PDF filter {0} is not supported.'.format(pdf_filter)
)

q_pystog = simpleapi.mtd[sq_ws_name].readX(0)
sq_pystog = simpleapi.mtd[sq_ws_name].readY(0)
if len(sq_pystog) != len(q_pystog):
sq_pystog = np.insert(sq_pystog, 0, sq_pystog[0])
q_pystog_f = list()
sq_pystog_f = list()
for qi, qv in enumerate(q_pystog):
if min_q <= qv <= max_q:
q_pystog_f.append(qv)
sq_pystog_f.append(sq_pystog[qi])
q_pystog_f = np.array(q_pystog_f)
sq_pystog_f = np.array(sq_pystog_f)
transformer = Transformer()
r_pystog = np.arange(0, max_r + delta_r, delta_r)
r_pystog, gr_pystog, _ = transformer.S_to_G(q_pystog, sq_pystog, r_pystog)
r_pystog, gr_pystog, _ = transformer.S_to_G(
q_pystog_f,
sq_pystog_f,
r_pystog
)

if pdf_type == "G(r)":
pass
else:
if rho0 is None:
warn_msg = "[Warning] No number density provided. "
warn_msg += "A dummy value of 1.0 will be used "
warn_msg += "for the conversion."
print(warn_msg)
rho0 = 1.

gr_pystog = gr_pystog / (4. * np.pi * rho0 * r_pystog) + 1.

if pdf_type == "RDF(r)":
gr_pystog = 4. * np.pi * rho0 * r_pystog**2. * gr_pystog

gr_ws_name = '%s(R)_%s_%d' % (prefix, self._currSqWsName, ws_seq_index)
simpleapi.CreateWorkspace(
Expand Down
1 change: 1 addition & 0 deletions addie/calculate_gr/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def load_sq(main_window):
# set the UI widgets
main_window.calculategr_ui.doubleSpinBoxQmin.setValue(q_min)
main_window.calculategr_ui.doubleSpinBoxQmax.setValue(q_max)
main_window.calculategr_ui.lineEdit_rho.setText("1.0")

# plot S(Q) - TODO why is it getting the name again?
ws_name = main_window._myController.get_current_sq_name()
Expand Down

1 comment on commit 0f81320

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitLab pipeline for addie-dev has been submitted for this commit: "https://code.ornl.gov/sns-hfir-scse/deployments/addie-deploy/-/pipelines/625526"

Please sign in to comment.