def ZFrequencyList_to_TFrequencyList(Z_frequency_list,Z01=complex(50,0),Z02=complex(50,0)):
    """ Converts z parameters into T parameters. Z-parameters should be in the form [[f,Z11,Z12,Z21,Z22],...]
    the port 1 (Z01) and port 2 (Z01) impedances can be specified, default is 50. Returns data in the form
    [[f,T11,T12,T21,T22],...]
    """
    t_frequency_list=[]
    for row in Z_frequency_list[:]:
        [frequency,Z11,Z12,Z21,Z22]=row
        denominator=2*Z21*(Z01.real*Z02.real)**(.5)
        T11= ((Z11+Z01)*(Z22+Z02)-Z12*Z21)/denominator
        T12=((Z11+Z01)*(Z02.conjugate()-Z22)+Z12*Z21)/denominator
        T21=((Z11-Z01.conjugate())*(Z22+Z02)-Z12*Z21)/denominator
        T22=((Z01.conjugate()-Z11)*(Z22-Z02.conjugate())+Z12*Z21)/denominator
        t_frequency_list.append([frequency,T11,T12,T21,T22])
    return t_frequency_list