Coverage for /opt/conda/envs/apienv/lib/python3.11/site-packages/daiquiri/implementors/imageviewer/createadditional.py: 0%

20 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-03-29 02:12 +0000

1import numpy as np 

2 

3from daiquiri.core.components import ComponentActor 

4 

5 

6class CreateadditionalActor(ComponentActor): 

7 name = "createadditional" 

8 

9 def method( 

10 self, datacollectionid, datacollection, selected_scalars, scalars, **kwargs 

11 ): 

12 steps_per_patch_x = int(datacollection["steps_x"] / datacollection["patchesx"]) 

13 steps_per_patch_y = int(datacollection["steps_y"] / datacollection["patchesy"]) 

14 

15 maps = [] 

16 for selected_scalar in selected_scalars: 

17 full_scalar_map = np.full( 

18 (datacollection["steps_y"], datacollection["steps_x"]), -1.0 

19 ) 

20 for scan_number, scalar in enumerate(scalars): 

21 data = scalar["data"][selected_scalar]["data"] 

22 patch_y, patch_x = np.unravel_index( 

23 scan_number, 

24 (datacollection["patchesy"], datacollection["patchesx"]), 

25 ) 

26 scan_map = np.full((steps_per_patch_y * steps_per_patch_x), -1.0) 

27 for point_id, point in enumerate(data): 

28 scan_map[point_id] = point 

29 

30 scan_map.shape = (steps_per_patch_y, steps_per_patch_x) 

31 full_scalar_map[ 

32 patch_y * steps_per_patch_y : patch_y * steps_per_patch_y 

33 + steps_per_patch_y, 

34 patch_x * steps_per_patch_x : patch_x * steps_per_patch_x 

35 + steps_per_patch_x, 

36 ] = scan_map 

37 

38 maps.append( 

39 {"scalar": selected_scalar, "data": full_scalar_map.flatten().tolist()} 

40 ) 

41 

42 return maps