Skip to content

Commit

Permalink
working on pystog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvieta1990 committed Oct 6, 2024
1 parent fefc584 commit e266b96
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ dmypy.json

# VSCode
.vscode
.linenoteplus

# generated files
MANIFEST
Expand Down
36 changes: 30 additions & 6 deletions addie/addiedriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from mantid.api import AnalysisDataService
import mantid.simpleapi as simpleapi

from pystog import Transformer
import numpy as np
import os
import addie.utilities

Expand Down Expand Up @@ -137,7 +139,29 @@ def calculate_gr(
print(
'[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])
transformer = Transformer()
r_pystog = np.arange(0, max_r + delta_r, delta_r)
print(q_pystog)
print(sq_pystog)
r_pystog, gr_pystog, _ = transformer.S_to_G(q_pystog, sq_pystog, r_pystog)
print(r_pystog)
print(gr_pystog)

gr_ws_name = '%s(R)_%s_%d' % (prefix, self._currSqWsName, ws_seq_index)
simpleapi.CreateWorkspace(
OutputWorkspace=gr_ws_name,
DataX=r_pystog,
DataY=gr_pystog,
NSpec=1,
UnitX="AtomicDistance"
)
axis = simpleapi.mtd[gr_ws_name].getAxis(1)
axis.setUnit("Label").setLabel('PDF', '')

kwargs = {'OutputWorkspace': gr_ws_name,
'Qmin': min_q,
'Qmax': max_q,
Expand All @@ -152,13 +176,13 @@ def calculate_gr(
if 'rho0' in kwargs and pdf_type == "G(r)":
print("WARNING: Modifying the density does not affect G(r) function")

# get the input unit
sofq_type = 'S(Q)'
# # get the input unit
# sofq_type = 'S(Q)'

# do the FFT
simpleapi.PDFFourierTransform(InputWorkspace=self._currSqWsName,
InputSofQType=sofq_type,
**kwargs)
# # do the FFT
# simpleapi.PDFFourierTransform(InputWorkspace=self._currSqWsName,
# InputSofQType=sofq_type,
# **kwargs)

# check
assert AnalysisDataService.doesExist(
Expand Down

1 comment on commit e266b96

@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/622295"

Please sign in to comment.