def _chunk_pars(freq_vector, data_matrix, pformat):
pformat = pformat.upper()<EOL>length = <NUM_LIT:4><EOL>for freq, data in zip(freq_vector, data_matrix):<EOL><INDENT>data = data.flatten()<EOL>for index in range(<NUM_LIT:0>, data.size, length):<EOL><INDENT>fpoint = [freq] if not index else [None]<EOL>cdata = data[index : index + length]<EOL>if pformat == "<STR_LIT>":<EOL><INDENT>vector1 = np.abs(cdata)<EOL>vector2 = np.rad2deg(np.angle(cdata))<EOL><DEDENT>elif pformat == "<STR_LIT>":<EOL><INDENT>vector1 = np.real(cdata)<EOL>vector2 = np.imag(cdata)<EOL><DEDENT>else:  <EOL><INDENT>vector1 = <NUM_LIT> * np.log10(np.abs(cdata))<EOL>vector2 = np.rad2deg(np.angle(cdata))<EOL><DEDENT>sep_data = np.array([])<EOL>for item1, item2 in zip(vector1, vector2):<EOL><INDENT>sep_data = np.concatenate((sep_data, np.array([item1, item2])))<EOL><DEDENT>ret = np.concatenate((np.array(fpoint), sep_data))<EOL>yield ret<EOL><DEDENT><DEDENT>
Chunk input data into valid Touchstone file rows.