Reference/API

Simple python wrapper for hessioxxx c library.

pyhessio.move_to_next_event(limit=0)[source]

Read data form input file and fill corresponding container Data can be then access with other available functions in this module By default all events are computed

Parameters:limit (int, optional) – limit the number of event generated
Returns:run number and event id in case of SUCCESS, otherwise -1,-1
Return type:tuple(int,int):
pyhessio.move_to_next_mc_event(limit=0)[source]

Read data form input file and fill corresponding container Data can be then access with other available functions in this module. This iterator scans all the simulated events, not only the triggered ones. By default all events are computed

Parameters:limit (int, optional) – limit the number of event generated
Returns:run number and event id in case of success, otherwise -1,-1
Return type:tuple(int,int):
pyhessio.file_open(filename)[source]

Open input data file

Parameters:filename (str) – file name to be opened
Returns:0 in case of success, otherwise -1
Return type:int:
pyhessio.file_close()[source]

Close opened iobuf

pyhessio.close_file()[source]

Close opened iobuf

pyhessio.get_global_event_count()[source]
Returns:counter for system trigger
Return type:int:
pyhessio.get_run_number()[source]
Returns:run number read in data file or -1 if not available
Return type:int
Raise:HessioGeneralError: when hsdata->run_header.run is not available
pyhessio.get_num_telescope()[source]
Returns:the number of telescopes in current run.
Return type:int
Raise:HessioGeneralError: when hsdata->event.num_tel is not available
pyhessio.get_telescope_with_data_list()[source]
Returns:list of telescope with data for current event
Return type:numpy.ndarray(num_teldata,dtype=np.int32)
Raise:HessioGeneralError: when information is not available
pyhessio.get_teldata_list()[source]
Returns:list of IDs of telescopes with data for current event
Return type:numpy.ndarray(num_teldata,dtype=np.int32)
Raise:HessioGeneralError: when information is not available
pyhessio.get_telescope_position(telescope_id)[source]
Parameters:telescope_id (int) – The telescope id
Returns:Telescope position for a telescope id.
  • x is counted from array reference position towards North
  • y towards West
  • z upwards
Return type:numpy.ndarray(3,dtype=np.double)
Raise:HessioGeneralError: when telescope position not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_num_teldata()[source]
Returns:number of telescopes for which we actually have data
Return type:int
Raise:HessioGeneralError when hsdata->event.num_teldata is not available
pyhessio.get_num_channel(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:type of channel used
  • HI_GAIN 0 Index to high-gain channels in adc_sum, adc_sample, pedestal, ...
  • LO_GAIN 1 Index to low-gain channels in adc_sum, adc_sample, pedestal, ...
Return type:int
Raise:HessioGeneralError: when hsdata->event.teldata[itel].raw
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_num_pixels(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:the number of pixels in the camera (as in configuration)
Return type:int
Raise:HessioGeneralError: when hsdata->camera_set[itel].num_pixels
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_num_samples(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:the number of samples (time slices) recorded
Return type:int
Raise:HessioGeneralError: when data->event.teldata[itel].raw->num->samples not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_adc_sample(telescope_id, channel)[source]
Parameters:
  • telescope_id (int) – telescope’s id
  • channel (int) – (0->HI_GAIN, 1->LOW_GAIN)
Returns:

pulses sampled

Return type:

numpy.array(npix,ntimeslices,dtype=np.uint16)

Raise:

HessioGeneralError: when information is not available

Raise:

HessioTelescopeIndexError when no telescope exist with this id

Raise:

HessioChannelIndexError when channel does not exist for this telescope

pyhessio.get_adc_sum(telescope_id, channel)[source]
Parameters:
  • telescope_id (int) – telescope’s id
  • channel (int) – (0->HI_GAIN, 1->LOW_GAIN)
Returns:

sum of ADC values.

Return type:

np.zeros(npix,dtype=np.int32)

Raise:

HessioGeneralError: when No adc_sum for telescope

Raise:

HessioTelescopeIndexError: when no telescope exist with this id

Raise:

HessioChannelIndexError: when channel does not exist for this telescope

pyhessio.get_pedestal(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:pedestal
Return type:numpy.ndarray(ngain,npix,dtype=np.double)
Raise:HessioGeneralError: when data not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_calibration(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:calibration numpy array (num_gain dimention)
Return type:nupy.array(ngain,npix,dtype=np.double)
Raise:HessioGeneralError: when data not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_position(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:pixels position for a telescope id (pos_x,pos_y)
Return type:tuple(numpy.ndarray(npix,dtype=np.double),numpy.ndarray(npix,dtype=np.double))
Raise:HessioGeneralError: when pixel position not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_timing_timval(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:PixelTiming.timval
Return type:numpy.array(npix,ntimes,dtype=np.float32)
Raise:HessioGeneralError: when hsdata->event.teldata[itel]->timval[ipix][itimes] not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_shape(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:pixels shape for a telescope id
Return type:numpy.ndarray(npix,dtype=np.double)
Raise:HessioGeneralError: when pixel shape not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_area(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:pixels area for a telescope id
Return type:numpy.ndarray(npix,dtype=np.double)
Raise:HessioGeneralError: when pixel area not available for this telescope
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_mirror_area(telescope_id)[source]
Parameters:telescope_id (int) – Telescope’s id
Returns:total area of individual mirrors corrected for inclination [m^2].
Return type:int
Raise:HessioGeneralError: when hsdata->camera_set[itel].mirror_area not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_timing_num_times_types(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:how many different types of times can we store
Return type:int
Raise:HessioGeneralError: when hsdata->event.teldata[itel].pixtm->num_types not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_timing_threshold(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:PixelTiming threshold: Minimum base-to-peak raw amplitude difference applied in pixel selection
Return type:numpy.int32
Raise:HessioGeneralError: When hsdata->event.teldata[itel].pixtm
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_pixel_timing_peak_global(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:PixelTiming peak_global: Camera-wide (mean) peak position [time slices]
Return type:numpy.float32
Raise:HessioGeneralError: when hsdata->event.teldata[itel].pixtm; not available
Raise:HessioTelescopeIndexError when no telescope exist with this id
pyhessio.get_mc_shower_primary_id()[source]
Returns:shower primary ID 0 (gamma), 1(e-), 2(mu-), 100*A+Z for nucleons and nuclei, negative for antimatter.
Return type:int
pyhessio.get_mc_shower_h_first_int()[source]
Returns:shower height of first interaction a.s.l. [m]
Return type:float
pyhessio.get_mc_event_xcore()[source]
Returns:x core position w.r.t. array reference point [m], x -> N
Return type:float
pyhessio.get_mc_event_ycore()[source]
Returns:y core position w.r.t. array reference point [m],y -> W
Return type:float
pyhessio.get_mc_shower_energy()[source]
Returns:shower primary energy [TeV]
Return type:float
pyhessio.get_mc_event_offset_fov()[source]
Returns:offset of pointing direction in camera f.o.v. divided by focal length, i.e. converted to radians: [0] = Camera x (downwards in normal pointing, i.e. increasing Alt) [1] = Camera y -> Az.
Return type:numpy.ndarray(2,dtype=np.double)
Raise:HessioGeneralError: when information is not available
pyhessio.get_mc_number_photon_electron(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:numbers of photon electron
Return type:int
Raise:HessioTelescopeIndexError when no telescope with this id exists
Raise:HessioGeneralError if hsdata is not available
pyhessio.get_mc_shower_azimuth()[source]
Returns:shower azimuth (N->E) [rad]
Return type:float
pyhessio.get_mc_shower_altitude()[source]
Returns:shower altitude [rad]
Return type:float
pyhessio.get_adc_known(telescope_id, channel, pixel_id)[source]
Parameters:
  • telescope_id (int) – telescope’s id
  • channel (int) – HI_GAIN, LOW_GAIN
  • pixel_id (int) – pixel’s id
Returns:

individual channel recorded information ? Bit 0: sum, 1: samples, 2: ADC was in saturation.

Return type:

int

pyhessio.get_ref_shape(telescope_id, channel, fshape)[source]
Parameters:
  • telescope_id (int) – telescope’s id
  • channel (int) – HI_GAIN, LOW_GAIN
  • fshape (int) –
Returns:

Reference pulse shape(s) If telescope_id, channel or fshape are not valid return 0.

Return type:

float

pyhessio.get_ref_step(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:If telescope_id, channel or fshape are not valid return 0.
Return type:int
pyhessio.get_time_slice(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:Width of readout time slice (i.e. one sample) [ns]. If telescope_id is not valid return 0.
Return type:float
pyhessio.get_ref_shapes(telescope_id, channel)[source]
Parameters:
  • telescope_id (int) – telescope’s id
  • channel (int) – HI_GAIN, LOW_GAIN
Returns:

Array of Reference pulse shape(s). 0 if channel is not valid TEL_INDEX_NOT_VALID if telescope index is not valid

Return type:

numpy.array(num_shapes,dtype=np.double)

pyhessio.get_nrefshape(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:Number of following reference pulse shapes (num_gains or 0) TEL_INDEX_NOT_VALID if telescope index is not valid
Return type:int
pyhessio.get_lrefshape(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:Length of following reference pulse shape(s). TEL_INDEX_NOT_VALID if telescope index is not valid
Return type:int
pyhessio.get_tel_event_gps_time(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:telescope event gps tine in a 2D array: -seconds -nonosecond
Return type:numpy.ndarray(1,dtype=np.long)
pyhessio.get_tel_event_gps_time(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:telescope event gps tine in a 2D array: -seconds -nonosecond
Return type:numpy.ndarray(1,dtype=np.long)
pyhessio.get_central_event_teltrg_list()[source]
Returns:List of IDs of triggered telescopes
Return type:np.ndarray(num_teltrig,dtype=np.int32)
Raise:HessioGeneralError: when information is not available
pyhessio.get_num_tel_trig()[source]
Returns:How many telescopes triggered in Central Event
Return type:int
Raise:HessioGeneralError: when hsdata is not available
pyhessio.get_central_event_gps_time()[source]
Returns:telescope central envent gps tine in a 2D array: -seconds -nonosecond
Return type:numpy.ndarray(1,dtype=np.long)
pyhessio.get_camera_rotation_angle(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:rotation angle of the camera of a given telescope (counter-clock-wise from back side for prime focus camera)L
Return type:float
Raise:HessioGeneralError: when hsdata->camera_set[itel].cam_rot not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_mirror_number(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:total number of mirror tiles of a telescope
Return type:int
Raise:HessioGeneralError: when hsdata->camera_set[itel].num_mirrors not available
Raise:HessioTelescopeIndexError when no telescope exist with this id
pyhessio.get_optical_foclen(telescope_id)[source]
Parameters:telescope_id (int) – telescope’s id
Returns:focal length of optics of a telescope [m]
Return type:float
Raise:HessioGeneralError: when hsdata->camera_set[itel].flen not available
Raise:HessioTelescopeIndexError: when no telescope exist with this id
pyhessio.get_telescope_ids()[source]
Returns:list of IDs of telescopes used in the run
Return type:numpy.ndarray(num_tel,dtype=np.int32)
Raise:HessioGeneralError: when information is not available