DefDAP 1.1.2__tar.gz → 1.2.2__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.
Files changed (37) hide show
  1. {defdap-1.1.2 → defdap-1.2.2}/DefDAP.egg-info/PKG-INFO +1 -1
  2. {defdap-1.1.2 → defdap-1.2.2}/PKG-INFO +1 -1
  3. defdap-1.2.2/defdap/_version.py +1 -0
  4. {defdap-1.1.2 → defdap-1.2.2}/defdap/base.py +7 -3
  5. {defdap-1.1.2 → defdap-1.2.2}/defdap/ebsd.py +2 -2
  6. {defdap-1.1.2 → defdap-1.2.2}/defdap/file_readers.py +55 -13
  7. {defdap-1.1.2 → defdap-1.2.2}/defdap/hrdic.py +2 -2
  8. {defdap-1.1.2 → defdap-1.2.2}/defdap/inspector.py +1 -1
  9. {defdap-1.1.2 → defdap-1.2.2}/defdap/plotting.py +1 -1
  10. {defdap-1.1.2 → defdap-1.2.2}/pyproject.toml +2 -2
  11. defdap-1.1.2/defdap/_version.py +0 -1
  12. {defdap-1.1.2 → defdap-1.2.2}/DefDAP.egg-info/SOURCES.txt +0 -0
  13. {defdap-1.1.2 → defdap-1.2.2}/DefDAP.egg-info/dependency_links.txt +0 -0
  14. {defdap-1.1.2 → defdap-1.2.2}/DefDAP.egg-info/requires.txt +0 -0
  15. {defdap-1.1.2 → defdap-1.2.2}/DefDAP.egg-info/top_level.txt +0 -0
  16. {defdap-1.1.2 → defdap-1.2.2}/LICENSE +0 -0
  17. {defdap-1.1.2 → defdap-1.2.2}/README.md +0 -0
  18. {defdap-1.1.2 → defdap-1.2.2}/defdap/__init__.py +0 -0
  19. {defdap-1.1.2 → defdap-1.2.2}/defdap/_accelerated.py +0 -0
  20. {defdap-1.1.2 → defdap-1.2.2}/defdap/crystal.py +0 -0
  21. {defdap-1.1.2 → defdap-1.2.2}/defdap/crystal_utils.py +0 -0
  22. {defdap-1.1.2 → defdap-1.2.2}/defdap/experiment.py +0 -0
  23. {defdap-1.1.2 → defdap-1.2.2}/defdap/file_writers.py +0 -0
  24. {defdap-1.1.2 → defdap-1.2.2}/defdap/quat.py +0 -0
  25. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/cubic_bcc.txt +0 -0
  26. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/cubic_bcc_110only.txt +0 -0
  27. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/cubic_fcc.txt +0 -0
  28. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/cubic_fcc_damask.txt +0 -0
  29. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/hexagonal_noca.txt +0 -0
  30. {defdap-1.1.2 → defdap-1.2.2}/defdap/slip_systems/hexagonal_withca.txt +0 -0
  31. {defdap-1.1.2 → defdap-1.2.2}/defdap/utils.py +0 -0
  32. {defdap-1.1.2 → defdap-1.2.2}/docs/source/conf.py +0 -0
  33. {defdap-1.1.2 → defdap-1.2.2}/setup.cfg +0 -0
  34. {defdap-1.1.2 → defdap-1.2.2}/tests/test_ebsd.py +0 -0
  35. {defdap-1.1.2 → defdap-1.2.2}/tests/test_hrdic.py +0 -0
  36. {defdap-1.1.2 → defdap-1.2.2}/tests/test_io.py +0 -0
  37. {defdap-1.1.2 → defdap-1.2.2}/tests/test_quat.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DefDAP
3
- Version: 1.1.2
3
+ Version: 1.2.2
4
4
  Summary: A python library for correlating EBSD and HRDIC data.
5
5
  Author: Rhys Thomas, João Quinta da Fonseca
6
6
  Author-email: "Michael D. Atkinson" <michael.atkinson@ukaea.uk>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DefDAP
3
- Version: 1.1.2
3
+ Version: 1.2.2
4
4
  Summary: A python library for correlating EBSD and HRDIC data.
5
5
  Author: Rhys Thomas, João Quinta da Fonseca
6
6
  Author-email: "Michael D. Atkinson" <michael.atkinson@ukaea.uk>
@@ -0,0 +1 @@
1
+ __version__ = '1.2.2'
@@ -44,7 +44,7 @@ class Map(ABC):
44
44
 
45
45
  """
46
46
  def __init__(self, file_name, data_type=None, experiment=None,
47
- increment=None, frame=None, map_name=None):
47
+ increment=None, frame=None, map_name=None, **kwargs):
48
48
  """
49
49
 
50
50
  Parameters
@@ -83,8 +83,12 @@ class Map(ABC):
83
83
  self.grain_plot = None
84
84
  self.profile_plot = None
85
85
 
86
- self.file_name = Path(file_name)
87
- self.load_data(self.file_name, data_type=data_type)
86
+ self.file_name = None
87
+ if isinstance(file_name, str):
88
+ file_name = Path(file_name)
89
+ if isinstance(file_name, (str, Path)):
90
+ self.file_name = file_name
91
+ self.load_data(file_name, data_type=data_type, **kwargs)
88
92
 
89
93
  self.data.add_generator(
90
94
  'proxigram', self.calc_proxigram, unit='', type='map', order=0,
@@ -148,7 +148,7 @@ class Map(base.Map):
148
148
  )
149
149
 
150
150
  @report_progress("loading EBSD data")
151
- def load_data(self, file_name, data_type=None):
151
+ def load_data(self, file_name, data_type=None, **kwargs):
152
152
  """Load in EBSD data from file.
153
153
 
154
154
  Parameters
@@ -160,7 +160,7 @@ class Map(base.Map):
160
160
 
161
161
  """
162
162
  data_loader = EBSDDataLoader.get_loader(data_type, file_name)
163
- data_loader.load(file_name)
163
+ data_loader.load(file_name, **kwargs)
164
164
 
165
165
  metadata_dict = data_loader.loaded_metadata
166
166
  self.shape = metadata_dict['shape']
@@ -289,6 +289,8 @@ class EdaxAngLoader(EBSDDataLoader):
289
289
  self.check_metadata()
290
290
 
291
291
  # Construct fixed data format
292
+ # .ang format seems to take all sorts of forms, only columns that seem
293
+ # to be agreed on by most files are loaded
292
294
  self.data_format = np.dtype([
293
295
  ('ph1', 'float32'),
294
296
  ('phi', 'float32'),
@@ -298,10 +300,8 @@ class EdaxAngLoader(EBSDDataLoader):
298
300
  ('IQ', 'float32'),
299
301
  ('CI', 'float32'),
300
302
  ('phase', 'uint8'),
301
- # ('SE_signal', 'float32'),
302
- ('FF', 'float32'),
303
303
  ])
304
- load_cols = (0, 1, 2, 5, 6, 7, 8, 9)
304
+ load_cols = (0, 1, 2, 5, 6, 7)
305
305
 
306
306
  # now read the data from file
307
307
  data = np.loadtxt(
@@ -325,15 +325,8 @@ class EdaxAngLoader(EBSDDataLoader):
325
325
  'clabel': 'Confidence index',
326
326
  }
327
327
  )
328
- self.loaded_data.add(
329
- 'fit_factor', data['FF'].reshape(shape),
330
- unit='', type='map', order=0,
331
- plot_params={
332
- 'plot_colour_bar': True,
333
- 'clabel': 'Fit factor',
334
- }
335
- )
336
- self.loaded_data.phase = data['phase'].reshape(shape) + 1
328
+ add_phase = 1 if data['phase'].min() == 0 else 0
329
+ self.loaded_data.phase = data['phase'].reshape(shape) + add_phase
337
330
  self.loaded_data['phase', 'plot_params']['vmax'] = len(self.loaded_metadata['phases'])
338
331
 
339
332
  # flatten the structured dtype
@@ -647,7 +640,8 @@ class DICDataLoader(ABC):
647
640
  'openpiv': OpenPivTextLoader, #Backwards compatability
648
641
  'openpivtext': OpenPivTextLoader,
649
642
  'openpivbinary': OpenPivBinaryLoader,
650
- 'pyvale': PyValeLoader
643
+ 'pyvale': PyValeLoader,
644
+ 'matflow': MatflowLoader,
651
645
  }[data_type]
652
646
  except KeyError:
653
647
  raise ValueError(f"No loader for DIC data of type {data_type}.")
@@ -797,6 +791,7 @@ class OpenPivTextLoader(DICDataLoader):
797
791
 
798
792
  self.check_data()
799
793
 
794
+
800
795
  class OpenPivBinaryLoader(DICDataLoader):
801
796
  def load(self, file_name: pathlib.Path) -> None:
802
797
  """ Load from Open PIV .npz file.
@@ -905,6 +900,53 @@ class PyValeLoader(DICDataLoader):
905
900
 
906
901
  self.loaded_data.coordinate = coord_dense
907
902
  self.loaded_data.displacement = disp_dense
903
+ self.loaded_data.add(
904
+ 'cost', data['cost'].reshape(shape),
905
+ unit='', type='map', order=0,
906
+ plot_params={
907
+ 'plot_colour_bar': True,
908
+ 'clabel': 'Cost',
909
+ }
910
+ )
911
+
912
+ self.check_data()
913
+
914
+
915
+ class MatflowLoader(DICDataLoader):
916
+ def load(self, data_dict: Dict[str, Any], step_index: int = 0) -> None:
917
+ """ Load from matflow workflow element output.
918
+
919
+ Parameters
920
+ ----------
921
+ data_dict
922
+ Dictionary with keys:
923
+ 'ss_x'
924
+ 'ss_y'
925
+ 'u'
926
+ 'v'
927
+
928
+ """
929
+ # Software name and version
930
+ self.loaded_metadata['format'] = 'PyVale'
931
+ self.loaded_metadata['version'] = 'n/a'
932
+
933
+ # Sub-window width in pixels
934
+ binning_x = np.diff(data_dict['ss_x'], axis=1)
935
+ binning = int(binning_x[0, 0])
936
+ assert np.all(binning_x == binning)
937
+ binning_y = np.diff(data_dict['ss_y'], axis=0)
938
+ assert np.all(binning_y == binning)
939
+ self.loaded_metadata['binning'] = binning
940
+ self.loaded_metadata['shape'] = data_dict['ss_x'].shape
941
+
942
+ self.checkMetadata()
943
+
944
+ self.loaded_data.coordinate = np.stack(
945
+ (data_dict['ss_x'], data_dict['ss_y'])
946
+ )
947
+ self.loaded_data.displacement = np.stack(
948
+ (data_dict['u'][step_index], data_dict['v'][step_index])
949
+ )
908
950
 
909
951
  self.check_data()
910
952
 
@@ -185,7 +185,7 @@ class Map(base.Map):
185
185
  return self.ebsd_map.crystal_sym
186
186
 
187
187
  @report_progress("loading HRDIC data")
188
- def load_data(self, file_name, data_type=None):
188
+ def load_data(self, file_name, data_type=None, **kwargs):
189
189
  """Load DIC data from file.
190
190
 
191
191
  Parameters
@@ -197,7 +197,7 @@ class Map(base.Map):
197
197
 
198
198
  """
199
199
  data_loader = DICDataLoader.get_loader(data_type)
200
- data_loader.load(file_name)
200
+ data_loader.load(file_name, **kwargs)
201
201
 
202
202
  metadata_dict = data_loader.loaded_metadata
203
203
  self.format = metadata_dict['format'] # Software name
@@ -331,7 +331,7 @@ class GrainInspector:
331
331
  # Draw slip bands
332
332
  bands = [elem[1] for elem in self.selected_dic_grain.groups_list]
333
333
  if self.selected_dic_grain.groups_list != None:
334
- slipPlot.add_slip_bands(top_only=True, angles=list(np.deg2rad(bands)))
334
+ slipPlot.add_traces(list(np.deg2rad(bands)), ["black"], top_only=True)
335
335
 
336
336
  def run_rdr_group(self,
337
337
  event: int,
@@ -309,7 +309,7 @@ class Plot(object):
309
309
  """Draw plot
310
310
 
311
311
  """
312
- self.fig.canvas.draw()
312
+ self.fig.canvas.draw_idle()
313
313
 
314
314
 
315
315
  class MapPlot(Plot):
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "DefDAP"
7
- version = "1.1.2"
7
+ version = "1.2.2"
8
8
  authors = [
9
9
  {name = "Michael D. Atkinson", email = "michael.atkinson@ukaea.uk"},
10
10
  {name = "Rhys Thomas"},
@@ -75,7 +75,7 @@ defdap = ["slip_systems/*.txt"]
75
75
 
76
76
  [tool.commitizen]
77
77
  name = "cz_conventional_commits"
78
- version = "1.1.2"
78
+ version = "1.2.2"
79
79
  tag_format = "v$version"
80
80
  version_files = [
81
81
  "pyproject.toml:version",
@@ -1 +0,0 @@
1
- __version__ = '1.1.2'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes