@@ -501,7 +501,15 @@ def _construct_mono_example_identifiers(self):
501501 right = tel_pointing ,
502502 keys = ["obs_id" , "tel_id" ],
503503 )
504- events = self ._transform_to_spherical_offsets (events )
504+ events = self ._transform_to_cam_coord_offsets (events )
505+ array_pointing = self ._get_array_pointing (f )
506+ # Join the prediction table with the telescope pointing table
507+ events = join (
508+ left = events ,
509+ right = array_pointing ,
510+ keys = ["obs_id" ],
511+ )
512+ events = self ._transform_to_sky_spher_offsets (events )
505513 # Add the logarithm of the true energy in TeV
506514 events = self ._transform_to_log_energy (events )
507515 # Add the true shower primary class to the table based on the filename
@@ -657,19 +665,13 @@ def _multiplicity_cut_subarray(table, key_colnames):
657665 simulation_info_table = read_table (f , "/configuration/simulation/run" )
658666 # Append the simulation information to the list of simulation information
659667 simulation_info .append (simulation_info_table )
660- # Assuming min_az = max_az and min_alt = max_alt
661- fix_array_pointing = simulation_info_table .copy ()
662- fix_array_pointing .keep_columns (["obs_id" , "min_az" , "min_alt" ])
663- fix_array_pointing .rename_column ("min_az" , "pointing_azimuth" )
664- fix_array_pointing .rename_column ("min_alt" , "pointing_altitude" )
668+ array_pointing = self ._get_array_pointing (f )
665669 # Join the prediction table with the telescope pointing table
666670 events = join (
667671 left = events ,
668- right = fix_array_pointing ,
672+ right = array_pointing ,
669673 keys = ["obs_id" ],
670674 )
671- # TODO: use keep_order for astropy v7.0.0
672- events .sort (["obs_id" , "event_id" ])
673675 events = self ._transform_to_sky_spher_offsets (events )
674676 # Appending the events to the list of example identifiers
675677 example_identifiers .append (events )
@@ -716,8 +718,7 @@ def get_tel_pointing(self, file, tel_ids) -> Table:
716718 Returns:
717719 --------
718720 tel_pointing : astropy.table.Table
719- A dictionary with telescope IDs as keys and their corresponding
720- pointing information (azimuth and altitude) as values.
721+ A table containing pointing information (azimuth and altitude) for each telescope.
721722 """
722723 tel_pointing = []
723724 for tel_id in tel_ids :
@@ -730,6 +731,32 @@ def get_tel_pointing(self, file, tel_ids) -> Table:
730731 )
731732 return vstack (tel_pointing )
732733
734+ def get_array_pointing (self , file ) -> Table
735+ """
736+ Retrieve the array pointing information.
737+
738+ This method extracts the array pointing information (azimuth and altitude)
739+ from the provided file.
740+
741+ Parameters:
742+ -----------
743+ file : str
744+ Path to the file containing the array pointing data.
745+
746+ Returns:
747+ --------
748+ array_pointing : astropy.table.Table
749+ A table containing array pointing information (azimuth and altitude).
750+ """
751+ # Read simulation information for each observation
752+ array_ppointing = read_table (file , "/configuration/simulation/run" )
753+ # Assuming min_az = max_az and min_alt = max_alt
754+ array_pointing = simulation_info_table .copy ()
755+ array_pointing .keep_columns (["obs_id" , "min_az" , "min_alt" ])
756+ array_pointing .rename_column ("min_az" , "pointing_azimuth" )
757+ array_pointing .rename_column ("min_alt" , "pointing_altitude" )
758+ return array_pointing
759+
733760 def _transform_to_log_energy (self , table ):
734761 """
735762 Transform energy values to their logarithmic scale.
0 commit comments