@@ -689,19 +689,20 @@ def __init__(
689689 )
690690
691691 path = files ("dl1_data_handler.ressources" ).joinpath ("newcam_sipm_patches.h5" )
692- # path_fl_neigh = files("dl1_data_handler.ressources").joinpath("CTA_LST_Pixels_info_epsilon_1.csv")
693- # path_patch0_fl_neigh = files("dl1_data_handler.ressources").joinpath("flower_neighbors_central_patch.csv")
694692
695693 if geometry .name == "UNKNOWN-7987PX" :
696694 with tables .open_file (path , mode = "r" ) as f :
697- self .patch_coords = f .root .patches .centers_coords [:]
698695 self .trigger_patches = f .root .patches .masks [:]
699696 self .index_map = f .root .mappings .index_map [:]
700697 self .neighbor_array = f .root .neighbors .patch0_neighbors [:]
701698 self .cam_neighbor_array = f .root .neighbors .camera_neighbors [:]
702699 self .fl_neighbor_array_tdscan = f .root .neighbors .flower_neighbors_tdscan [:]
703700 self .fl_neighbor_array_l1 = f .root .neighbors .flower_neighbors_l1 [:]
704701 self .supfl_neighbor_array_l1 = f .root .neighbors .superflower_neighbors_l1 [:]
702+ self .sectors_bool = f .root .sectors .mask [:]
703+ self .sectors_indices = f .root .sectors .sectors_indices [:]
704+ self .sect0_neighbors = f .root .sectors .sect0_neighbors [:]
705+ self .sector_mappings = f .root .sectors .mapping [:]
705706 # Remove -1 padding from each row
706707 self .neighbor_tdscan_eps1_list = [row [row != - 1 ].tolist () for row in self .fl_neighbor_array_tdscan ]
707708 self .fl_neighbor_l1_list = [row [row != - 1 ].tolist () for row in self .fl_neighbor_array_l1 ]
@@ -710,20 +711,10 @@ def __init__(
710711
711712 self .num_patches = len (self .trigger_patches )
712713 self .patch_size = self .neighbor_array .shape [0 ]
714+ self .sector_size = self .sect0_neighbors .shape [0 ]
713715
714- # self.fl_neighbor_array, self.fl_neighbor_patch0_array = [], []
715- # with open(path_fl_neigh, "r") as f:
716- # next(f) # skip header
717- # for line in f:
718- # # Split, strip newline, convert to int
719- # neighbors = list(map(int, line.strip().split(",")))
720- # self.fl_neighbor_array.append(np.array(neighbors, dtype=np.int32))
721- # with open(path_patch0_fl_neigh, "r") as f:
722- # for line in f:
723- # # Split, strip newline, convert to int
724- # neighbors = list(map(int, line.strip().split(",")))
725- # self.fl_neighbor_patch0_array.append(np.array(neighbors, dtype=np.int32))
726-
716+ self .supfl_neighbor_l1_mask = self .supfl_neighbor_array_l1 >= 0
717+ # Retrieve the camera neighbor array to perform convolutions with cameras different from AdvSiPMCam.
727718 else :
728719 neighbor_matrix = geometry .neighbor_matrix
729720 num_pixels = neighbor_matrix .shape [0 ]
@@ -736,33 +727,18 @@ def __init__(
736727 self .cam_neighbor_array = np .full ((num_pixels , 7 ), - 1 , dtype = int )
737728 for i , neighbors in enumerate (neighbor_lists ):
738729 self .cam_neighbor_array [i , :len (neighbors )] = neighbors
739- print ("Computed neighbor array is" , self .cam_neighbor_array )
740-
741- def get_reordered_patch (self , raw_vector , patch_index ):
742- # Retrieve the patch needed
743- patch = self .trigger_patches [patch_index , :]
744- patched_wf = raw_vector [:, :][patch .astype (bool )]
745-
746- # Reorder the array so that all patches have the same spatial order in index
747- unmapped_waveform = np .zeros_like (patched_wf )
748-
749- for new , old in enumerate (self .index_map [patch_index ]):
750- unmapped_waveform [new ] = patched_wf [old ]
730+ print ("Computed neighbor array for: " , geometry .name )
731+
732+ def get_reordered_patch (self , raw_vector , patch_index , out_size ):
733+ # Retrieve the patch needed remapped to a standarized patch order.
734+ if out_size == "patch" :
735+ mapper = self .index_map
736+ elif out_size == "sector" :
737+ mapper = self .sector_mappings
738+ mapper = mapper [patch_index ]
739+ unmapped_waveform = raw_vector [mapper ]
751740 return unmapped_waveform
752741
753- def get_reordered_patch_image (self , image , patch_index ):
754- # Retrieve the patch needed
755- image = np .squeeze (image )
756- patch = self .trigger_patches [patch_index , :]
757- patched_im = image [:][patch .astype (bool )]
758-
759- # Reorder the array so that all patches have the same spatial order in index
760- unmapped_im = np .zeros_like (patched_im )
761-
762- for new , old in enumerate (self .index_map [patch_index ]):
763- unmapped_im [new ] = patched_im [old ]
764- return unmapped_im
765-
766742
767743class ShiftingMapper (ImageMapper ):
768744 """
0 commit comments