def get_hits_of_scan_parameter(input_file_hits, scan_parameters=None, try_speedup=False, chunk_size=<NUM_LIT>):
with tb.open_file(input_file_hits, mode="<STR_LIT>") as in_file_h5:<EOL><INDENT>hit_table = in_file_h5.root.Hits<EOL>meta_data = in_file_h5.root.meta_data[:]<EOL>meta_data_table_at_scan_parameter = get_unique_scan_parameter_combinations(meta_data, scan_parameters=scan_parameters)<EOL>parameter_values = get_scan_parameters_table_from_meta_data(meta_data_table_at_scan_parameter, scan_parameters)<EOL>event_number_ranges = get_ranges_from_array(meta_data_table_at_scan_parameter['<STR_LIT>'])  <EOL>index_event_number(hit_table)  <EOL>index = <NUM_LIT:0>  <EOL>best_chunk_size = chunk_size  <EOL>for parameter_index, (start_event_number, stop_event_number) in enumerate(event_number_ranges):<EOL><INDENT>logging.debug('<STR_LIT>' + str(scan_parameters) + '<STR_LIT>' + str(parameter_values[parameter_index]))<EOL>readout_hit_len = <NUM_LIT:0>  <EOL>for hits, index in data_aligned_at_events(hit_table, start_event_number=start_event_number, stop_event_number=stop_event_number, start_index=index, try_speedup=try_speedup, chunk_size=best_chunk_size):<EOL><INDENT>yield parameter_values[parameter_index], hits<EOL>readout_hit_len += hits.shape[<NUM_LIT:0>]<EOL><DEDENT>best_chunk_size = int(<NUM_LIT> * readout_hit_len) if int(<NUM_LIT> * readout_hit_len) < chunk_size and int(<NUM_LIT> * readout_hit_len) > <NUM_LIT> else chunk_size<EOL><DEDENT><DEDENT>
Takes the hit table of a hdf5 file and returns hits in chunks for each unique combination of scan_parameters.
    Yields the hits in chunks, since they usually do not fit into memory.

    Parameters
    ----------
    input_file_hits : pytable hdf5 file
        Has to include a hits node
    scan_parameters : iterable with strings
    try_speedup : bool
        If true a speed up by searching for the event numbers in the data is done. If the event numbers are not in the data
        this slows down the search.
    chunk_size : int
        How many rows of data are read into ram.

    Returns
    -------
    Yields tuple, numpy.array
        Actual scan parameter tuple, hit array with the hits of a chunk of the given scan parameter tuple