lstmcpipe.hiperta package#

Submodules#

lstmcpipe.hiperta.hiperta_r0_to_dl1lstchain module#

lstmcpipe.hiperta.hiperta_r0_to_dl1lstchain.main()#

Run hiperta_r0_dl1 and reorganize_dl1hipertaV300_to_dl1lstchain060

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060 module#

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.create_hfile_out(input_filename, outfile_name, sim_pointer08, config_pointer08, dl1_pointer, filter_pointer)#

Create output hfile (lstchainv0.6 like hdf5 file)

Parameters input_filename : [ste] input hfile name outfile_name : [str] output hfile name sim_pointer08 : dl1-file_v0.8_simulation pointer config_pointer08 : dl1-file_v.08_configuration pointer dl1_pointer : dl1-file_v0.8_dl1 pointer filter_pointer : dl1-file_v0.8 filters pointer

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.dump_plus_copy_node_to_create_new_table(input_filename, hfile_out, astropy_table_to_copy, newparent_pointer, newname_pointer, tmp_name, overwrite=False)#

General function to write an astropy table to a temporal file, and immediately after copy it to the output v0.6 hfile.

Parameters input_filename : [ste] input hfile name hfile_out : output File pointer astropy_table_to_copy : astropy table to be copied newparent_pointer : newparent copy_node parameter newname_pointer : newname copy_node parameter tmp_name : [str] flag to identify the temportal table and make it unique (necessary when simultaneous reorganizers are run in the same dir) overwrite : overwrite parameter of the copy_node method

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.main(input_filename, output_filename)#

Conversion from dl1 data model (ctapipe and hiper(CTA)RTA) data model, and convert it to lstchain_v0.6 data mode.

Parameters input_filename : [str] Input filename output_filename : [str] Output filename

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.rename_mc_shower_colnames(input_filename, hfile_out, event_node, output_mc_table_pointer)#

Rename column names of the mc_shower table and dump the table to the v0.6 output hfile.

Parameters input_filename : [ste] input hfile name hfile_out : output File pointer event_node : root.dl1.event node (of output hfile, so V0.6) output_mc_table_pointer : output subarray node pointer

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.stack_and_write_images_table(input_filename, hfile_out, node_dl1_event)#

Stack all the tel_00X image tables (in case they exit) and write in the v0.6 file

Parameters input_filename : [ste] input hfile name hfile_out : output File pointer node_dl1_event : Output hfile (V0.6) dl1.event node pointer

lstmcpipe.hiperta.reorganize_dl1hiperta300_to_dl1lstchain060.stack_and_write_parameters_table(input_filename, hfile_out, node_dl1_event, output_mc_table_pointer)#

Stack all the tel_00X parameters tables (of v0.8), change names of the columns and write the table in the V0.6 (lstchain like) format

Parameters hfile_out : output File pointer node_dl1_event : Output hfile (V0.6) dl1.event node pointer output_mc_table_pointer : output subarray node pointer

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain module#

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.add_column_table(table, ColClass, col_label, values)#

FUNCTION COPIED FROM lstchain.io.io to avoid hiperta depend on lstchain.

Add a column to an pytable Table

Parameters:
  • table (tables.table.Table)

  • ColClass (tables.atom.MetaAtom)

  • col_label (str)

  • values (list or numpy.ndarray)

Return type:

tables.table.Table

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.add_disp_and_mc_type_to_parameters_table(dl1_file, table_path)#

HARDCODED function obtained from lstchain.reco.dl0_to_dl1 because mc_alt_tel and mc_az_tel are zipped within run_array_direction. 1. Reconstruct the disp parameters and source position from a DL1 parameters table and write the result in the file. 2. Computes mc_type from the name of the file.

Parameters:
  • dl1_file (HDF5 DL1 file containing the required field in table_path:) –

    • mc_alt

    • mc_az

    • mc_alt_tel

    • mc_az_tel

  • table_path (path to the parameters table in the file)

Return type:

None

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.clip_alt(alt)#

FUNCTION COPIED FROM lstchain.reco.utils to avoid hiperta depend on lstchain.

Make sure altitude is not larger than 90 deg (it happens in some MC files for zenith=0), to keep astropy happy

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.create_final_h5(hfile, hfile_tmp, hfile_tmp2, output_filename)#

Create the final output HDF5 file. It copies /instruments and /simulations nodes from the output of hipecta_hdf5_r1_to_dl1.py,

  • and /dl1/event from the created table.

  • and includes the image and pulse_time within the correct path, i.e., /dl1/event/telescope/

TODO: Define somehow the paths globally so that it can be used .get_node()

Parameters:
  • hfile ([obj, astropy.table.table.Table] output file)

  • hfile_tmp ([obj, astropy.table.table.Table] hdf5 file with dl1 parameters. path:) – dl1/event/telescope/parameters/LST_LSTCam

  • hfile_tmp2 ([obj, astropy.table.table.Table] hdf5 file with images and pulse_time. path:) – dl1/event/telescope/image/LST_LSTCam

  • output_filename ([str] name of output file)

Return type:

None

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.disp(cog_x, cog_y, src_x, src_y)#

FUNCTION COPIED FROM lstchain.reco.disp to avoid hiperta depend on lstchain.

Compute the disp parameters

Parameters:
  • cog_x (numpy.ndarray or float)

  • cog_y (numpy.ndarray or float)

  • src_x (numpy.ndarray or float)

  • src_y (numpy.ndarray or float)

Returns:

disp_dx: ‘astropy.units.m` disp_dy: ‘astropy.units.m` disp_norm: ‘astropy.units.m` disp_angle: ‘astropy.units.rad` disp_sign: numpy.ndarray

Return type:

(disp_dx, disp_dy, disp_norm, disp_angle, disp_sign)

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.modify_params_table(table, tel_id, focal=28)#

Modify column names and compute missing parameters

Parameters:
  • table ([obj, astropy.table.table.Table] The table to be modified.)

  • tel_id ([int] telescope identifier, i.e., 1,2,3,4 for LSTs)

  • focal ([float] focal length in meters # TODO: deprecated, done at hipecta/rta level)

Return type:

None

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.reorganize_dl1(input_filename, output_filename)#

Reorganize the output dl1 files of hiperta/hipecta codes to reach the same structure found in lstchain dl1 files.

Parameters:
  • input_filename (str) – Input filename

  • output_filename (str) – Output filename

Return type:

None. It dumps the final hdf5 file with the correct structure.

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.sky_to_camera(alt, az, focal, pointing_alt, pointing_az)#

FUNCTION COPIED FROM lstchain.reco.utils to avoid hiperta depend on lstchain.

Coordinate transform from aky position (alt, az) (in angles) to camera coordinates (x, y) in distance :param alt: :type alt: astropy Quantity :param az: :type az: astropy Quantity :param focal: :type focal: astropy Quantity :param pointing_alt: :type pointing_alt: pointing altitude in angle unit :param pointing_az: :type pointing_az: pointing altitude in angle unit

Returns:

camera frame

Return type:

astropy.coordinates.sky_coordinate.SkyCoord

lstmcpipe.hiperta.reorganize_dl1hiperta_to_dl1lstchain.stack_by_telid(dl1_pointer, focal=28)#
Stack :
  • LST telescopes’ parameters into a table

  • Calibrated images and pulse_times into another table

Parameters:
  • dl1_pointer ([obj, tables.group.Group] pointer of the input hdf5 file hfile.root.dl1)

  • focal ([float] focal length in meters # TODO: deprecated, done at hipecta/rta level)

Returns:

respective path

Return type:

Two tables [obj, astropy.table.table.Table] containing the parameters, and the images and pulse_times int their

Module contents#