nxs-analysis-tools 0.0.17__tar.gz → 0.0.18__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 (17) hide show
  1. {nxs-analysis-tools-0.0.17/src/nxs_analysis_tools.egg-info → nxs-analysis-tools-0.0.18}/PKG-INFO +1 -1
  2. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/pyproject.toml +1 -1
  3. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/_meta/__init__.py +1 -1
  4. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools/chess.py +27 -12
  5. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools/datareduction.py +12 -2
  6. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18/src/nxs_analysis_tools.egg-info}/PKG-INFO +1 -1
  7. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/LICENSE +0 -0
  8. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/MANIFEST.in +0 -0
  9. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/README.md +0 -0
  10. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/setup.cfg +0 -0
  11. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/setup.py +0 -0
  12. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools/__init__.py +0 -0
  13. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools/pairdistribution.py +0 -0
  14. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools.egg-info/SOURCES.txt +0 -0
  15. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools.egg-info/dependency_links.txt +0 -0
  16. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools.egg-info/requires.txt +0 -0
  17. {nxs-analysis-tools-0.0.17 → nxs-analysis-tools-0.0.18}/src/nxs_analysis_tools.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nxs-analysis-tools
3
- Version: 0.0.17
3
+ Version: 0.0.18
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.17'
9
+ version = '0.0.18'
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.17'
9
+ __version__= '0.0.18'
10
10
  __repo_url__ = 'https://github.com/stevenjgomez/nxs_analysis_tools'
@@ -4,7 +4,6 @@ This module provides classes and functions for analyzing scattering datasets col
4
4
  plotting linecuts.
5
5
  '''
6
6
  import os
7
- from nexusformat.nexus import NXentry
8
7
  import matplotlib.pyplot as plt
9
8
  import matplotlib as mpl
10
9
 
@@ -19,7 +18,7 @@ class TempDependence():
19
18
  '''
20
19
  Initialize TempDependence class.
21
20
  '''
22
- self.datasets=[]
21
+ self.datasets={}
23
22
  self.folder=None
24
23
  self.temperatures=None
25
24
  self.scissors=None
@@ -40,7 +39,7 @@ class TempDependence():
40
39
  '''
41
40
  Clear the datasets stored in the TempDependence instance.
42
41
  '''
43
- self.datasets=NXentry()
42
+ self.datasets={}
44
43
 
45
44
  def load_datasets(self, folder, file_ending='hkli.nxs', temperatures_list=None):
46
45
  '''
@@ -72,25 +71,21 @@ class TempDependence():
72
71
  self.temperatures = temperature_folders
73
72
 
74
73
  if temperatures_list is not None:
75
- temperature_folders = [str(t) for t in temperatures_list]
76
- else:
77
- temperature_folders = self.temperatures
78
-
79
- self.temperatures = temperature_folders
74
+ self.temperatures = [str(t) for t in temperatures_list]
80
75
 
81
76
  # Load .nxs files
82
- for temperature in temperature_folders:
77
+ for temperature in self.temperatures:
83
78
  for file in os.listdir(os.path.join(self.folder, temperature)):
84
79
  if file.endswith(file_ending):
85
80
  filepath = os.path.join(self.folder, temperature, file)
86
81
  print('-----------------------------------------------')
87
82
  print('Loading ' + temperature + ' K indexed .nxs files...')
88
83
  print('Found ' + filepath)
89
- self.datasets.append(load_data(filepath))
84
+ self.datasets[temperature] = load_data(filepath)
90
85
 
91
86
  self.scissors = [Scissors() for _ in range(len(self.datasets))]
92
87
 
93
- for i,dataset in enumerate(self.datasets):
88
+ for i,dataset in enumerate(self.datasets.values()):
94
89
  self.scissors[i].set_data(dataset)
95
90
 
96
91
  def set_window(self, window):
@@ -168,7 +163,7 @@ class TempDependence():
168
163
  for i, linecut in enumerate(self.linecuts):
169
164
  x_data = linecut[linecut.axes[0]].nxdata
170
165
  y_data = linecut[linecut.signal].nxdata + i*vertical_offset
171
- ax.plot(x_data, y_data, color=cmap(i / len(self.linecuts)), label=linecut.nxname,
166
+ ax.plot(x_data, y_data, color=cmap(i / len(self.linecuts)), label=self.temperatures[i],
172
167
  **kwargs)
173
168
 
174
169
  xlabel_components = [self.linecuts[0].axes[0] if i == self.scissors[0].axis \
@@ -186,3 +181,23 @@ class TempDependence():
186
181
 
187
182
  # Create a new legend with reversed order
188
183
  plt.legend(handles, labels)
184
+
185
+ return fig,ax
186
+
187
+ def show_integration_window(self, temperature=None):
188
+ '''
189
+ Displays the integration window plot for a specific temperature or for all temperatures if
190
+ none is provided.
191
+
192
+ Parameters
193
+ ----------
194
+ temperature : str, optional
195
+ The temperature at which to display the integration window plot. If provided, the plot
196
+ will be generated using the dataset corresponding to the specified temperature. If not
197
+ provided, the integration window plots will be generated for all available
198
+ temperatures.
199
+ '''
200
+ if temperature is not None:
201
+ self.scissors[0].show_integration_window(data=self.datasets[temperature])
202
+ else:
203
+ self.scissors[0].show_integration_window(data=self.datasets[self.temperatures[0]])
@@ -444,11 +444,21 @@ class Scissors():
444
444
 
445
445
  return self.linecut
446
446
 
447
- def show_integration_window(self, label=None, **kwargs):
447
+ def show_integration_window(self, data=None, label=None, **kwargs):
448
448
  '''
449
449
  Plots integration window highlighted on 2D heatmap full dataset.
450
+
451
+ Parameters
452
+ ----------
453
+ data : array-like, optional
454
+ The 2D heatmap dataset to plot. If not provided, the dataset stored in `self.data` will be used.
455
+ label : str, optional
456
+ The label for the integration window plot.
457
+ **kwargs : keyword arguments, optional
458
+ Additional keyword arguments to customize the plot.
459
+
450
460
  '''
451
- data = self.data
461
+ data = self.data if data is None else data
452
462
  axis = self.axis
453
463
  center = self.center
454
464
  window = self.window
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nxs-analysis-tools
3
- Version: 0.0.17
3
+ Version: 0.0.18
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