Ejemplo n.º 1
0
def main(conf_data):

    selection = {"beam_tp":conf_data["beams_tp"],
                 "mcc_tp":None, "x_tp":None, "y_tp":None,
                 "rng_tp":None, "vel_tp":None, "az_tp":None}

    # Load Data from .mat files
    if conf_data["radar_tp"] == "L":
        filename_Radar = conf_data["filename_LeftRadar"]
    elif conf_data["radar_tp"] == "R":
        filename_Radar = conf_data["filename_RightRadar"]
    else:
        print("Both radars will not be tracked together")
        quit()

    l = []
    l.append(conf_data["path_data_folder"])
    l.append(filename_Radar)
    radar_path = ''.join(l)

    lst_det = dc.DetectionList()
    lst_det.append_from_m_file(radar_path, True, conf_data["EGO_car_width"])

    ##  Select an area to track (In terms of any parameter - beam, x, y, vel, ...)
    lst_det_s = dc.DetectionList()
    lst_det_s.extend_with_selection(lst_det, selection=selection)

    ##  Define the range of MCCs to do the filtering
    mcc_interval = lst_det_s.get_mcc_interval()
    mcc_start = mcc_interval[0] +100
    mcc_end = mcc_start + 15

    trackers = []       # List of trackers - empty for now

    ##  Filtering loop
    trk_counter = 0
    for i1 in range(mcc_start, mcc_end):    # Iterate through the set of MCCs within a range
        print("A new burst starts here, mcc:", i1)
        lst_det_i=[elem for elem in lst_det_s if elem._mcc == i1] # Get list of detections for MCC
        print("detections in this run",len(lst_det_i))
        no_det = len(lst_det_i)             # Number of detections in the list
        for i2 in list(range(0,no_det)):    # Iterate through the set of detections in a single MCC
            print("detection at x:",lst_det_i[i2]._x,"y:",lst_det_i[i2]._y,"vel:",lst_det_i[i2]._vel)
            print("beam of detection:",lst_det_i[i2]._beam)
            if trk_counter == 0:
                trackers.append(tf.Tracker(i1))
                trackers[0].append_detection(lst_det_i[i2])
                trk_counter += 1
            else:
                for i3 in list(range(0,trk_counter)):   # Iterate through trackers to assign the detection
                    gate = trackers[i3].get_predicted_gate()
                    print("Tracker number:",i3,"selection gate",gate)



    print("counter",trk_counter)
    print("trackers",len(trackers))
    print("detections in the selection",len(lst_det_s))
Ejemplo n.º 2
0
def main(conf_data):

    selection = {"beam_tp":conf_data["beams_tp"],
                 "mcc_tp":None, "x_tp":None, "y_tp":None,
                 "rng_tp":None, "vel_tp":(-5,5), "az_tp":None}

    if conf_data["filename_LeftRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_LeftRadar"])
        leftradar_path = ''.join(l)

        lst_det_left = dc.DetectionList()
        lst_det_left.append_from_m_file(leftradar_path, True, conf_data["EGO_car_width"])

        LR_data = lst_det_left.get_array_detections_selected(selection=selection)

        print("LR : N of Det: ", len(LR_data["mcc"]), "starting MCC: ", min(LR_data["mcc"]), "ending MCC: ",
              max(LR_data["mcc"]))
        print("LR : min vel: ", min(LR_data["velocity"]), "max vel: ", max(LR_data["velocity"]))
        print("LR : min az: ", min(LR_data["azimuth"]), "max az: ", max(LR_data["azimuth"]))
        print("LR : min rng: ", min(LR_data["range"]), "max rng: ", max(LR_data["range"]))
        print("LR : min x: ", min(LR_data["x"]), "max x: ", max(LR_data["x"]))
        print("LR : min y: ", min(LR_data["y"]), "max y: ", max(LR_data["y"]))

    if conf_data["filename_RightRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_RightRadar"])
        rightradar_path = ''.join(l)

        lst_det_right = dc.DetectionList()
        lst_det_right.append_from_m_file(rightradar_path, False, conf_data["EGO_car_width"])

        RR_data = lst_det_right.get_array_detections_selected(selection=selection)

        print("RR : N of Det: ", len(RR_data["mcc"]), "starting MCC: ", min(RR_data["mcc"]), "ending MCC: ",
                  max(RR_data["mcc"]))
        print("RR : min vel: ", min(RR_data["velocity"]), "max vel: ", max(RR_data["velocity"]))
        print("RR : min az: ", min(RR_data["azimuth"]), "max az: ", max(RR_data["azimuth"]))
        print("RR : min rng: ", min(RR_data["range"]), "max rng: ", max(RR_data["range"]))
        print("RR : min x: ", min(RR_data["x"]), "max x: ", max(RR_data["x"]))
        print("RR : min y: ", min(RR_data["y"]), "max y: ", max(RR_data["y"]))

    if conf_data["output_folder"]:
        l = []
        l.append(conf_data["output_folder"])
        fname_det = '_tmp%s.png' % conf_data["scenario"]
        l.append(fname_det)
        output_path = ''.join(l)
    else:
        output_path = None

    rplt.static_plot_selections(lst_det_left, lst_det_right, selection, output_path)
Ejemplo n.º 3
0
def main(config_data):
    if config_data["filename_LOGcfg"]:
        cfg_logfile_path = config_data["filename_LOGcfg"]
        logging.config.fileConfig(cfg_logfile_path)
        # create logger
        logger = logging.getLogger(__name__)
        # logfile_level = config_data["log_level"]
        # level_of_logging = getattr(logging,logfile_level.upper())
        # logging.basicConfig(filename=logfile_path,level=level_of_logging)
        logger.info('Started the test_implementing')
        logger.info('Configuration file: %s',cfg_logfile_path)
        logger.info(76 * '=')
    else:
        raise(NoLoggerConfiguration())

    selection = {"beam_tp": config_data["beams_tp"],
                 "mcc_tp": None, "x_tp": None, "y_tp": None,
                 "rng_tp": None, "vel_tp": None, "az_tp": None,
                 "trackID_tp": None, }
    # Structure 'selection' constrains  data to use as input to the tracker.
    # An exact value or interval of 'mcc', 'azimuth', 'range' ... etc can be
    # specified here to block unwanted data to enter.

    logger.info("Dataset to process: %s", config_data["scenario"])
    logger.info("Data files are stored in: %s", config_data["path_data_folder"])
    logger.info("Data for the scenario are in:")
    logger.info('\t \t left_radar: %s', config_data["filename_LeftRadar"])
    logger.info('\t \t right_radar: %s', config_data["filename_RightRadar"])
    logger.info('\t \t left_dgps: %s', config_data["filename_LeftDGPS"])
    logger.info('\t \t right_dgps %s:', config_data["filename_RightDGPS"])
    logger.info('\t \t both_dgps: %s', config_data["filename_BothDGPS"])
    logger.info('\t \t logger_cfg_file: %s', config_data["filename_LOGcfg"])
    logger.info("Radar to process: %s", config_data["radar_tp"])
    logger.info(76 * '=')

    # In this example only linear KF is being used, classical constant velocity model,
    # measurement contains only 2D vector (rho, theta)
    used_tracker_type = {'filter_type': 'kalman_filter', 'dim_x': 4, 'dim_z': 2}

    track_mgmt_LR = tm.TrackManager(tracker_type=used_tracker_type)
    track_mgmt_RR = tm.TrackManager(tracker_type=used_tracker_type)



    for n_beams in range(0, 4):
        if config_data["beams_tp"].count(n_beams):
            logger.info("Beams %d will be processed: %d times", n_beams, config_data["beams_tp"].count(n_beams))

    # Load Data from .mat files
    if config_data["filename_LeftRadar"]:
        logger.info(76 * '=')
        logger.info("Left Radar Data:")
        l = []
        l.append(config_data["path_data_folder"])
        l.append(config_data["filename_LeftRadar"])
        leftradar_path = ''.join(l)     

        lst_det_LR = dc.DetectionList()
        lst_det_LR.append_data_from_m_file(leftradar_path, True, config_data["EGO_car_width"])
        mcc_interval_LR = lst_det_LR.get_mcc_interval()
        logger.info('MCC Left start: %s, end: %s, dMCC=%d, number of detections: %d.',
                                                                            mcc_interval_LR[0],
                                                                            mcc_interval_LR[1],
                                                                            mcc_interval_LR[1] - mcc_interval_LR[0],
                                                                            len(lst_det_LR))
    #
    if config_data["filename_RightRadar"]:
        logger.info(76 * '=')
        logger.info("Right Radar Data:")
        l = []
        l.append(config_data["path_data_folder"])
        l.append(config_data["filename_RightRadar"])
        rightradar_path = ''.join(l)

        lst_det_RR = dc.DetectionList()
        lst_det_RR.append_data_from_m_file(rightradar_path, False, config_data["EGO_car_width"])
        mcc_interval_RR = lst_det_RR.get_mcc_interval()
        logger.info('MCC Right start: %s, end: %s, dMCC=%d, number of detections: %d.',
                                                                             mcc_interval_RR[0],
                                                                             mcc_interval_RR[1],
                                                                             mcc_interval_RR[1] -  mcc_interval_RR[0],
                                                                             len(lst_det_RR))

    # Calculate valid mcc interval for detections to be presented
    logger.info(76 * '=')
    logger.info("Data Preprocessor Settings:")
    if config_data["filename_LeftRadar"] and config_data["filename_RightRadar"]:
        mcc_start = min(mcc_interval_LR[0], mcc_interval_RR[0])
        logger.debug('Both radars will be processed ')
        mcc_end = max(mcc_interval_LR[1], mcc_interval_RR[1])
    elif config_data["filename_LeftRadar"]:
        mcc_start = mcc_interval_LR[0]
        mcc_end = mcc_interval_LR[1]
        logger.debug('Just left radar will be processed ')
    else:
        mcc_start = mcc_interval_RR[0]
        mcc_end = mcc_interval_RR[1]
        logger.debug('Just right radar will be processed ')
    if config_data["number_of_mcc_to_process"]:
        mcc_end = min(mcc_start + int(config_data["number_of_mcc_to_process"]),mcc_end)
        logger.debug('Number of processed MCCs from cnf file: %s.', config_data["number_of_mcc_to_process"])
    logger.info('Processing will start at: %d, end: %d, dMCC=%d.',
                    mcc_start,
                    mcc_end,
                    mcc_end - mcc_start)


    logger.debug('Inside of the MCC interval from %s to %s: ', mcc_start, mcc_end)
    mcc_step = 1

    # Prepare options to plot results
    if config_data["plot_tp"]:
        l = []

    logger.debug(75 * '=')
    logger.debug("Filtering loop:")

    #----------------- Filtering loop
    i_prev = mcc_start
    for i in range(mcc_start, mcc_end, mcc_step):  # number of frames

        selection["mcc_tp"] = (i_prev, i)
        #-------------- Left radar filter
        if lst_det_LR:

            lst_det_per_loop_cycle_LR = lst_det_LR.get_lst_detections_selected(selection=selection)
            print("The new step of the filtering loop, mcc: ",i,"number of selected dets",len(lst_det_per_loop_cycle_LR),
                  "number of dets to process: ",len(lst_det_LR))

            # Is it correct to assign this for every iteration? Potential to write
            # more effective code.
            if lst_det_per_loop_cycle_LR:
                lst_det_per_loop_cycle_LR.calculate_intervals()
                logger.debug('Filtering loop: Number of detections for a LR mcc %d is %d', i, len(lst_det_per_loop_cycle_LR))
                track_mgmt_LR.new_detections(lst_det_per_loop_cycle_LR)
            else:
                logger.debug('There is no detection for current LR mcc %d.', i)
        logger.debug('Predict cycle for each track in a list of %d started for LR at mcc: %d.',len(track_mgmt_LR), i)
        track_mgmt_LR.predict(i)

        lst_not_assigned_LR, new_track_LR = track_mgmt_LR.port_data("track_init")

        if new_track_LR:
            logger.debug("Type of ported new_track list %s", type(new_track_LR))
            logger.debug("Type of ported new_track element %s", type(new_track_LR[-1]))
        else:
            logger.debug("New_track not ported/created")

        # This line is redundant if only one mcc is being processed per loop cycle.
        # However if mcc_step is different than 1, it might be a good idea to keep it here:
        i_prev = i + 1

    list_of_tracks = track_mgmt_LR.port_data("tracks_array")
    sio.savemat("tracks.mat", {'track':list_of_tracks})
Ejemplo n.º 4
0
def main(conf_data):
    lst_det_left = None
    lst_det_right = None

    # selection = {"beam_tp":conf_data["beams_tp"],
    #              "mcc_tp":None, "x_tp":None, "y_tp":None,
    #              "rng_tp":None, "vel_tp":(-5,5), "az_tp":None}
    selection = {
        "beam_tp": conf_data["beams_tp"],
        "mcc_tp": None,
        "x_tp": None,
        "y_tp": None,
        "rng_tp": None,
        "vel_tp": None,
        "az_tp": None,
        "trackID_tp": None
    }

    # Load Data from .mat files
    if conf_data["filename_LeftRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_LeftRadar"])
        leftradar_path = ''.join(l)

        lst_det_left = dc.DetectionList()
        lst_det_left.append_data_from_m_file(leftradar_path, True,
                                             conf_data["EGO_car_width"])
        mcc_interval_left = lst_det_left.get_mcc_interval()
        print("MCC Left starts at: ", mcc_interval_left[0], "and ends at: ",
              mcc_interval_left[1])

    if conf_data["filename_RightRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_RightRadar"])
        rightradar_path = ''.join(l)

        lst_det_right = dc.DetectionList()
        lst_det_right.append_data_from_m_file(rightradar_path, False,
                                              conf_data["EGO_car_width"])
        mcc_interval_right = lst_det_right.get_mcc_interval()
        print("MCC Right starts at: ", mcc_interval_right[0], "and ends at: ",
              mcc_interval_right[1])

    # Calculate valid mcc interval for detections to be presented
    if conf_data["filename_LeftRadar"] and conf_data["filename_RightRadar"]:
        mcc_start = min(mcc_interval_left[0], mcc_interval_right[0])
        mcc_end = max(mcc_interval_left[1], mcc_interval_right[1])
    elif conf_data["filename_LeftRadar"]:
        mcc_start = mcc_interval_left[0]
        mcc_end = mcc_interval_left[1]
    else:
        mcc_start = mcc_interval_right[0]
        mcc_end = mcc_interval_right[1]
    print("MCC starts at: ", mcc_start, "MCC ends at: ", mcc_end)
    mcc_step = 1

    ###### Movie starts here:
    i_prev = mcc_start
    for i in range(mcc_start, mcc_end, mcc_step):  # number of frames frames
        if conf_data["output_folder"]:
            fname_det = '_tmp%08d.png' % i
            l = []
            l.append(conf_data["output_folder"])
            l.append(fname_det)
            output_path = ''.join(l)
        else:
            output_path = None
        selection["mcc_tp"] = (i_prev, i)
        rplt.static_plot_grid_hist_selections(lst_det_left, lst_det_right,
                                              selection, output_path)

        i_prev = i
Ejemplo n.º 5
0
def main(conf_data):
    # Load Data from .mat file
    if conf_data["filename_LeftRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_LeftRadar"])
        leftradar_path = ''.join(l)

        lst_det_left = dc.DetectionList()
        lst_det_left.append_data_from_m_file(leftradar_path, True,
                                             conf_data["EGO_car_width"])
        mcc_interval_left = lst_det_left.get_mcc_interval()
        print("MCC Left starts at: ", mcc_interval_left[0], "and ends at: ",
              mcc_interval_left[1])
    else:
        lst_det_left = None

    if conf_data["filename_RightRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_RightRadar"])
        rightradar_path = ''.join(l)

        lst_det_right = dc.DetectionList()
        lst_det_right.append_data_from_m_file(rightradar_path, False,
                                              conf_data["EGO_car_width"])
        mcc_interval_right = lst_det_right.get_mcc_interval()
        print("MCC Right starts at: ", mcc_interval_right[0], "and ends at: ",
              mcc_interval_right[1])
    else:
        lst_det_right = None

    if conf_data["filename_LeftDGPS"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_LeftDGPS"])
        leftDGPS_path = ''.join(l)

        lst_ref_left = dc.ReferenceList()
        lst_ref_left.append_from_m_file(leftDGPS_path)
        mcc_intervalDGPS_left = lst_ref_left.get_mccL_interval()
        print("MCC Left DGPS starts at: ", mcc_intervalDGPS_left[0],
              "and ends at: ", mcc_intervalDGPS_left[1])
    else:
        lst_ref_left = None

    if conf_data["filename_RightDGPS"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_RightDGPS"])
        rightDGPS_path = ''.join(l)

        lst_ref_right = dc.ReferenceList()
        lst_ref_right.append_from_m_file(rightDGPS_path)
        mcc_intervalDGPS_right = lst_ref_right.get_mccR_interval()
        print("MCC Left DGPS starts at: ", mcc_intervalDGPS_right[0],
              "and ends at: ", mcc_intervalDGPS_right[1])
    else:
        lst_ref_right = None

    if conf_data["filename_BothDGPS"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_BothDGPS"])
        bothDGPS_path = ''.join(l)

        lst_ref_both = dc.ReferenceList()
        lst_ref_both.append_from_m_file(bothDGPS_path)
        mcc_intervalDGPS_both = lst_ref_both.get_mccB_interval()
        print("MCC Both DGPS starts at: ", mcc_intervalDGPS_both[0],
              "and ends at: ", mcc_intervalDGPS_both[1])
    else:
        lst_ref_both = None

    if conf_data["output_folder"]:
        l = []
        l.append(conf_data["output_folder"])
        fname_det = '_tmp%s.png' % conf_data["scenario"]
        l.append(fname_det)
        output_path = ''.join(l)
    else:
        output_path = None

    selection = {
        "beam_tp": conf_data["beams_tp"],
        "mcc_tp": None,
        "x_tp": None,
        "y_tp": None,
        "rng_tp": None,
        "vel_tp": None,
        "az_tp": None,
        "trackID_tp": None
    }

    DGPS_xcompensation = float(conf_data["DGPS_xcompensation"])
    #rplt.static_plot_selections(lst_det_left, lst_det_right, selection, output_path)
    rplt.static_plotREF_selections(lst_det_left, lst_det_right, lst_ref_left,
                                   lst_ref_right, lst_ref_both, selection,
                                   output_path, DGPS_xcompensation)
Ejemplo n.º 6
0
def main(conf_data):

    selection = {
        "beam_tp": conf_data["beams_tp"],
        "mcc_tp": None,
        "x_tp": (10, 55),
        "y_tp": (-30, 55),
        "rng_tp": (25, 30),
        "vel_tp": None,
        "az_tp": None
    }

    # Load Data from .mat files
    if conf_data["radar_tp"] == "L":
        filename_Radar = conf_data["filename_LeftRadar"]
    elif conf_data["radar_tp"] == "R":
        filename_Radar = conf_data["filename_RightRadar"]
    else:
        print("Both radars will not be tracked together")
        quit()

    l = []
    l.append(conf_data["path_data_folder"])
    l.append(filename_Radar)
    radar_path = ''.join(l)

    lst_det = dc.DetectionList()
    lst_det.append_from_m_file(radar_path, True, conf_data["EGO_car_width"])

    ############  Select an arrea to track (filter out unwanted detections)
    lst_det_s = dc.DetectionList()
    lst_det_s.extend_with_selection(lst_det, selection=selection)

    mcc_interval = lst_det_s.get_mcc_interval()
    mcc_start = mcc_interval[0]
    mcc_end = mcc_interval[0] + 15

    mcc_history_depth = 3

    ############ Filtering loop
    i_prev = mcc_start
    for i in range(mcc_start + mcc_history_depth,
                   mcc_end):  # number of frames frames
        print("A new burst starts here, mcc:", i_prev, i)
        tf.my_fltr_range(lst_det_s, i_prev, i)
        # rplt.GridPlot_hist(lst_det_left,lst_det_right,conf_data["beams_tp"],i_prev,i+1,None)
        i_prev += 1

    if conf_data["output_folder"]:
        l = []
        l.append(conf_data["output_folder"])
        fname_det = '_tmp%s.png' % conf_data["scenario"]
        l.append(fname_det)
        output_path = ''.join(l)
    else:
        output_path = None

    selection_pl = {
        "beam_tp": conf_data["beams_tp"],
        "mcc_tp": None,
        "x_tp": None,
        "y_tp": None,
        "rng_tp": None,
        "vel_tp": None,
        "az_tp": None,
        "trackID_tp": None
    }

    rplt.static_plot_selections(lst_det_s, None, selection_pl, output_path)
Ejemplo n.º 7
0
def main(conf_data):
    if conf_data["filename_LeftRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_LeftRadar"])
        leftradar_path = ''.join(l)

        lst_det_left = dc.DetectionList()
        lst_det_left.append_from_m_file(leftradar_path, True,
                                        conf_data["EGO_car_width"])

        LR0_data = lst_det_left.get_array_detections_selected(beam=[0])
        LR1_data = lst_det_left.get_array_detections_selected(beam=[1])
        LR2_data = lst_det_left.get_array_detections_selected(beam=[2])
        LR3_data = lst_det_left.get_array_detections_selected(beam=[3])
        print("LR Beam 0: N of Det: ", len(LR0_data["mcc"]), "starting MCC: ",
              min(LR0_data["mcc"]), "ending MCC: ", max(LR0_data["mcc"]))
        print("LR Beam 1: N of Det: ", len(LR1_data["mcc"]), "starting MCC: ",
              min(LR1_data["mcc"]), "ending MCC: ", max(LR1_data["mcc"]))
        print("LR Beam 2: N of Det: ", len(LR2_data["mcc"]), "starting MCC: ",
              min(LR2_data["mcc"]), "ending MCC: ", max(LR2_data["mcc"]))
        print("LR Beam 3: N of Det: ", len(LR3_data["mcc"]), "starting MCC: ",
              min(LR3_data["mcc"]), "ending MCC: ", max(LR3_data["mcc"]))

        print("LR Beam 0: min vel: ", min(LR0_data["velocity"]), "max vel: ",
              max(LR0_data["velocity"]))
        print("LR Beam 1: min vel: ", min(LR1_data["velocity"]), "max vel: ",
              max(LR1_data["velocity"]))
        print("LR Beam 2: min vel: ", min(LR2_data["velocity"]), "max vel: ",
              max(LR2_data["velocity"]))
        print("LR Beam 3: min vel: ", min(LR3_data["velocity"]), "max vel: ",
              max(LR3_data["velocity"]))

        print("LR Beam 0: min az: ", min(LR0_data["azimuth"]), "max az: ",
              max(LR0_data["azimuth"]))
        print("LR Beam 1: min az: ", min(LR1_data["azimuth"]), "max az: ",
              max(LR1_data["azimuth"]))
        print("LR Beam 2: min az: ", min(LR2_data["azimuth"]), "max az: ",
              max(LR2_data["azimuth"]))
        print("LR Beam 3: min az: ", min(LR3_data["azimuth"]), "max az: ",
              max(LR3_data["azimuth"]))

        print("LR Beam 0: min rng: ", min(LR0_data["range"]), "max rng: ",
              max(LR0_data["range"]))
        print("LR Beam 1: min rng: ", min(LR1_data["range"]), "max rng: ",
              max(LR1_data["range"]))
        print("LR Beam 2: min rng: ", min(LR2_data["range"]), "max rng: ",
              max(LR2_data["range"]))
        print("LR Beam 3: min rng: ", min(LR3_data["range"]), "max rng: ",
              max(LR3_data["range"]))

        max_detections_per_mcc_left, at = lst_det_left.get_max_of_detections_per_mcc(
        )
        print("Max detections in a mcc's", max_detections_per_mcc_left, "at",
              at)

        mcc_min, mcc_max = lst_det_left.get_mcc_interval()
        number_of_mccs_left = mcc_max - mcc_min
        print("Number of mcc samples", number_of_mccs_left)
        m = max_detections_per_mcc_left if max_detections_per_mcc_left > 20 else 20
        array_of_detections_left = np.empty((2, m, number_of_mccs_left))
        array_of_detections_left.fill(np.nan)

        for i in range(0, number_of_mccs_left):
            det = [
                elem._x for elem in lst_det_left if (elem._mcc == i + mcc_min)
            ]
            n_o_el = np.size(det)
            array_of_detections_left[0, 0:n_o_el, i] = [
                elem._x for elem in lst_det_left if (elem._mcc == i + mcc_min)
            ]
            array_of_detections_left[1, 0:n_o_el, i] = [
                elem._y for elem in lst_det_left if (elem._mcc == i + mcc_min)
            ]
            print("n o Elements in a mcc", i, "is", n_o_el)

        L = {"detections": array_of_detections_left}

        print("Matrix size:", array_of_detections_left.shape)
        sio.savemat("LR_detections.mat", L)

    if conf_data["filename_RightRadar"]:
        l = []
        l.append(conf_data["path_data_folder"])
        l.append(conf_data["filename_RightRadar"])
        rightradar_path = ''.join(l)

        lst_det_right = dc.DetectionList()
        lst_det_right.append_from_m_file(rightradar_path, True,
                                         conf_data["EGO_car_width"])

        RR0_data = lst_det_right.get_array_detections_selected(beam=[0])
        RR1_data = lst_det_right.get_array_detections_selected(beam=[1])
        RR2_data = lst_det_right.get_array_detections_selected(beam=[2])
        RR3_data = lst_det_right.get_array_detections_selected(beam=[3])
        print("RR Beam 0: N of Det: ", len(RR0_data["mcc"]), "starting MCC: ",
              min(RR0_data["mcc"]), "ending MCC: ", max(RR0_data["mcc"]))
        print("RR Beam 1: N of Det: ", len(RR1_data["mcc"]), "starting MCC: ",
              min(RR1_data["mcc"]), "ending MCC: ", max(RR1_data["mcc"]))
        print("RR Beam 2: N of Det: ", len(RR2_data["mcc"]), "starting MCC: ",
              min(RR2_data["mcc"]), "ending MCC: ", max(RR2_data["mcc"]))
        print("RR Beam 3: N of Det: ", len(RR3_data["mcc"]), "starting MCC: ",
              min(RR3_data["mcc"]), "ending MCC: ", max(RR3_data["mcc"]))

        print("RR Beam 0: min vel: ", min(RR0_data["velocity"]), "max vel: ",
              max(RR0_data["velocity"]))
        print("RR Beam 1: min vel: ", min(RR1_data["velocity"]), "max vel: ",
              max(RR1_data["velocity"]))
        print("RR Beam 2: min vel: ", min(RR2_data["velocity"]), "max vel: ",
              max(RR2_data["velocity"]))
        print("RR Beam 3: min vel: ", min(RR3_data["velocity"]), "max vel: ",
              max(RR3_data["velocity"]))

        print("RR Beam 0: min az: ", min(RR0_data["azimuth"]), "max az: ",
              max(RR0_data["azimuth"]))
        print("RR Beam 1: min az: ", min(RR1_data["azimuth"]), "max az: ",
              max(RR1_data["azimuth"]))
        print("RR Beam 2: min az: ", min(RR2_data["azimuth"]), "max az: ",
              max(RR2_data["azimuth"]))
        print("RR Beam 3: min az: ", min(RR3_data["azimuth"]), "max az: ",
              max(RR3_data["azimuth"]))

        print("RR Beam 0: min rng: ", min(RR0_data["range"]), "max rng: ",
              max(RR0_data["range"]))
        print("RR Beam 1: min rng: ", min(RR1_data["range"]), "max rng: ",
              max(RR1_data["range"]))
        print("RR Beam 2: min rng: ", min(RR2_data["range"]), "max rng: ",
              max(RR2_data["range"]))
        print("RR Beam 3: min rng: ", min(RR3_data["range"]), "max rng: ",
              max(RR3_data["range"]))

        max_detections_per_mcc_right, at = lst_det_right.get_max_of_detections_per_mcc(
        )
        print("Max detections in a mcc's", max_detections_per_mcc_right, "at",
              at)

        mcc_min, mcc_max = lst_det_right.get_mcc_interval()
        number_of_mccs_right = mcc_max - mcc_min
        print("Number of mcc samples", number_of_mccs_right)
        m = max_detections_per_mcc_right if max_detections_per_mcc_right > 20 else 20
        array_of_detections_right = np.empty((2, m, number_of_mccs_right))
        array_of_detections_right.fill(np.nan)

        for i in range(0, number_of_mccs_right):
            det = [
                elem._x for elem in lst_det_right if (elem._mcc == i + mcc_min)
            ]
            n_o_el = np.size(det)
            array_of_detections_right[0, 0:n_o_el, i] = [
                elem._x for elem in lst_det_right if (elem._mcc == i + mcc_min)
            ]
            array_of_detections_right[1, 0:n_o_el, i] = [
                elem._y for elem in lst_det_right if (elem._mcc == i + mcc_min)
            ]
            print("n o Elements in a mcc", i, "is", n_o_el)

        R = {"detections": array_of_detections_right}

        print("Matrix size:", array_of_detections_right.shape)
        sio.savemat("RR_detections.mat", R)