nxs-analysis-tools 0.0.39__tar.gz → 0.0.41__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nxs-analysis-tools might be problematic. Click here for more details.

Files changed (24) hide show
  1. {nxs_analysis_tools-0.0.39/src/nxs_analysis_tools.egg-info → nxs_analysis_tools-0.0.41}/PKG-INFO +1 -1
  2. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/pyproject.toml +1 -1
  3. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/_meta/__init__.py +1 -1
  4. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools/pairdistribution.py +26 -20
  5. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41/src/nxs_analysis_tools.egg-info}/PKG-INFO +1 -1
  6. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/LICENSE +0 -0
  7. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/MANIFEST.in +0 -0
  8. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/README.md +0 -0
  9. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/setup.cfg +0 -0
  10. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/setup.py +0 -0
  11. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools/__init__.py +0 -0
  12. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools/chess.py +0 -0
  13. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools/datareduction.py +0 -0
  14. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools/fitting.py +0 -0
  15. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools.egg-info/SOURCES.txt +0 -0
  16. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools.egg-info/dependency_links.txt +0 -0
  17. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools.egg-info/requires.txt +0 -0
  18. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/src/nxs_analysis_tools.egg-info/top_level.txt +0 -0
  19. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_chess.py +0 -0
  20. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_chess_fitting.py +0 -0
  21. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_datareduction.py +0 -0
  22. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_fitting.py +0 -0
  23. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_lmfit.py +0 -0
  24. {nxs_analysis_tools-0.0.39 → nxs_analysis_tools-0.0.41}/tests/test_pairdistribution.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nxs-analysis-tools
3
- Version: 0.0.39
3
+ Version: 0.0.41
4
4
  Summary: Reduce and transform nexus format (.nxs) scattering data.
5
5
  Author-email: "Steven J. Gomez Alvarado" <stevenjgomez@ucsb.edu>
6
6
  License: MIT License
@@ -6,7 +6,7 @@ build-backend = 'setuptools.build_meta'
6
6
 
7
7
  [project]
8
8
  name = 'nxs-analysis-tools'
9
- version = '0.0.39'
9
+ version = '0.0.41'
10
10
  description = 'Reduce and transform nexus format (.nxs) scattering data.'
11
11
  readme = 'README.md'
12
12
  requires-python = '>=3.7'
@@ -6,5 +6,5 @@ __author__ = 'Steven J. Gomez Alvarado'
6
6
  __email__ = 'stevenjgomez@ucsb.edu'
7
7
  __copyright__ = f"2023, {__author__}"
8
8
  __license__ = 'MIT'
9
- __version__ = '0.0.39'
9
+ __version__ = '0.0.41'
10
10
  __repo_url__ = 'https://github.com/stevenjgomez/nxs_analysis_tools'
@@ -1140,7 +1140,7 @@ class Interpolator:
1140
1140
  self.tapered = self.interpolated * self.window
1141
1141
 
1142
1142
 
1143
- def fourier_transform_nxdata(data):
1143
+ def fourier_transform_nxdata(data, is_2d=False):
1144
1144
  """
1145
1145
  Perform a 3D Fourier Transform on the given NXdata object.
1146
1146
 
@@ -1156,6 +1156,10 @@ def fourier_transform_nxdata(data):
1156
1156
  include the `signal` field for the data and `axes` fields
1157
1157
  specifying the coordinate axes.
1158
1158
 
1159
+ is_2d : bool
1160
+ If true, skip FFT on out-of-plane direction and only do FFT
1161
+ on axes 0 and 1. Default False.
1162
+
1159
1163
  Returns
1160
1164
  -------
1161
1165
  NXdata
@@ -1163,16 +1167,13 @@ def fourier_transform_nxdata(data):
1163
1167
  result includes:
1164
1168
 
1165
1169
  - `dPDF`: The transformed data array.
1166
- - `x`, `y`, `z`: Arrays representing the frequency components along each axis.
1170
+ - `x`, `y`, `z`: Arrays representing the real-space components along each axis.
1167
1171
 
1168
1172
  Notes
1169
1173
  -----
1170
- - The FFT is performed in two stages: first along the last dimension of
1171
- the input array and then along the first two dimensions.
1172
- - The function uses `pyfftw` for efficient computation of the Fourier
1173
- Transform.
1174
- - The output frequency components are computed based on the step sizes
1175
- of the original data axes.
1174
+ - The FFT is performed in two stages: first along the last dimension of the input array and then along the first two dimensions.
1175
+ - The function uses `pyfftw` for efficient computation of the Fourier Transform.
1176
+ - The output frequency components are computed based on the step sizes of the original data axes.
1176
1177
 
1177
1178
  """
1178
1179
  start = time.time()
@@ -1181,7 +1182,9 @@ def fourier_transform_nxdata(data):
1181
1182
  padded = data[data.signal].nxdata
1182
1183
 
1183
1184
  fft_array = np.zeros(padded.shape)
1185
+
1184
1186
  print("FFT on axes 1,2")
1187
+
1185
1188
  for k in range(0, padded.shape[2]):
1186
1189
  fft_array[:, :, k] = np.real(
1187
1190
  np.fft.fftshift(
@@ -1190,17 +1193,18 @@ def fourier_transform_nxdata(data):
1190
1193
  )
1191
1194
  print(f'k={k} ', end='\r')
1192
1195
 
1193
- print("FFT on axis 3")
1194
- for i in range(0, padded.shape[0]):
1195
- for j in range(0, padded.shape[1]):
1196
- f_slice = fft_array[i, j, :]
1197
- print(f'i={i} ', end='\r')
1198
- fft_array[i, j, :] = np.real(
1199
- np.fft.fftshift(
1200
- pyfftw.interfaces.numpy_fft.ifftn(np.fft.fftshift(f_slice),
1201
- planner_effort='FFTW_MEASURE')
1196
+ if not is_2d:
1197
+ print("FFT on axis 3")
1198
+ for i in range(0, padded.shape[0]):
1199
+ for j in range(0, padded.shape[1]):
1200
+ f_slice = fft_array[i, j, :]
1201
+ print(f'i={i} ', end='\r')
1202
+ fft_array[i, j, :] = np.real(
1203
+ np.fft.fftshift(
1204
+ pyfftw.interfaces.numpy_fft.ifftn(np.fft.fftshift(f_slice),
1205
+ planner_effort='FFTW_MEASURE')
1206
+ )
1202
1207
  )
1203
- )
1204
1208
 
1205
1209
  end = time.time()
1206
1210
  print("FFT complete.")
@@ -1292,6 +1296,7 @@ class DeltaPDF:
1292
1296
  self.data = data
1293
1297
  self.puncher.set_data(data)
1294
1298
  self.interpolator.set_data(data)
1299
+ self.padder.set_data(data)
1295
1300
  self.tapered = data
1296
1301
  self.padded = data
1297
1302
  self.interpolated = data
@@ -1475,6 +1480,7 @@ class DeltaPDF:
1475
1480
  preserves hexagonal symmetry.
1476
1481
  """
1477
1482
  self.interpolator.set_hexagonal_tukey_window(tukey_alphas)
1483
+ self.window = self.interpolator.window
1478
1484
 
1479
1485
  def set_window(self, window):
1480
1486
  """
@@ -1518,7 +1524,7 @@ class DeltaPDF:
1518
1524
  """
1519
1525
  self.padded = self.padder.pad(padding)
1520
1526
 
1521
- def perform_fft(self):
1527
+ def perform_fft(self, is_2d=False):
1522
1528
  """
1523
1529
  Perform a 3D Fourier Transform on the padded data.
1524
1530
 
@@ -1546,4 +1552,4 @@ class DeltaPDF:
1546
1552
 
1547
1553
 
1548
1554
  """
1549
- self.fft = fourier_transform_nxdata(self.padded)
1555
+ self.fft = fourier_transform_nxdata(self.padded, is_2d=is_2d)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nxs-analysis-tools
3
- Version: 0.0.39
3
+ Version: 0.0.41
4
4
  Summary: Reduce and transform nexus format (.nxs) scattering data.
5
5
  Author-email: "Steven J. Gomez Alvarado" <stevenjgomez@ucsb.edu>
6
6
  License: MIT License