def shrink_matrix(this_matrix, to_have_this_size):
    max_dim = to_have_this_size
    row_dim = this_matrix.row_length

    box_size = int(math.ceil(row_dim/max_dim))
    number_of_boxes = int(math.ceil(row_dim /box_size))
    box_mid = int(math.ceil(box_size/2.))
    max_dim = number_of_boxes * box_size
    
    print "* Producing reduced matrix image (from %d pixels to %d pixels)."%(row_dim, to_have_this_size)
    print "* Box_size: %d pixels"%box_size

    tmp_condensed = CondensedMatrix(numpy.zeros(int((number_of_boxes*(number_of_boxes-1))/2.), dtype=numpy.float))

    for k in range(0, max_dim, box_size):
        for l in range(0, max_dim, box_size):
            values = []
            for i in range(-box_mid, box_mid):
                for j in range(-box_mid, box_mid):
                    if(k+i > 0 and l+j > 0 and k+i < max_dim and l+j < max_dim):
                        if k+i == l+j:
                            values.append(0)
                        else:
                            values.append(this_matrix[k+i,l+j])
            if(k/box_size != l/box_size):
                if values != []:
                    tmp_condensed[int(k/box_size), int(l/box_size)] = numpy.mean(values)
                else:
                    tmp_condensed[int(k/box_size), int(l/box_size)] = 0
    return tmp_condensed
Signal that indicates that a Ground Station channel has been saved.
dataset/ETHPy150Open victor-gil-sepulveda/pyProCT/pyproct/tools/plotTools.py/shrink_matrix--crossover with--dataset/ETHPy150Open satnet-project/server/services/scheduling/signals/availability.py/weekly_rule_saved