def two_port_matrix_to_complex_form(matrix_form_data):
    """two_port_matrix_to_complex_form takes a list of [[frequency,np.matrix([[S11,S12],[S21,S22]])]..]
    and returns a list in the
    form [[frequency,S11,S21,S12,S22],..] , it is meant to undo two_port_complex_to_matrix_form"""
    out_list=[]
    for row in matrix_form_data:
        frequency=row[0]
        m=row[1]
        [S11,S21,S12,S22]=[m[0,0],m[1,0],m[0,1],m[1,1]]
        out_list.append([frequency,S11,S12,S21,S22])
    return out_list