#NEWLINE# def create_dic( udic ) : #NEWLINE# #INDENT# '\n    Create a Agilent/Varian parameter dictionary from a universal dictionary.\n\n    Parameters\n    ----------\n    udic : dict\n        Universal dictionary of spectral parameters.\n\n    Returns\n    -------\n    dic : dict\n        Dictionary of Agilent/Varian parameters\n    ' #NEWLINE# ddic = udic [ ( udic [ 'ndim' ] - 1 ) ] #NEWLINE# if ddic [ 'complex' ] : #NEWLINE# #INDENT# num_points = ( ddic [ 'size' ] * 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# num_points = ddic [ 'size' ] #NEWLINE# #UNINDENT# num_blocks = 1 #NEWLINE# for f in [ udic [ k ] [ 'size' ] for k in range ( ( udic [ 'ndim' ] - 1 ) ) ] : #NEWLINE# #INDENT# num_blocks = ( num_blocks * f ) #NEWLINE# #UNINDENT# dic = dict ( ) #NEWLINE# dic [ 'S_DATA' ] = 1 #NEWLINE# dic [ 'S_SPEC' ] = 0 #NEWLINE# dic [ 'S_32' ] = 0 #NEWLINE# dic [ 'S_FLOAT' ] = 1 #NEWLINE# dic [ 'S_COMPLEX' ] = 0 #NEWLINE# dic [ 'S_HYPERCOMPLEX' ] = 0 #NEWLINE# dic [ 'S_ACQPAR' ] = 1 #NEWLINE# dic [ 'S_SECND' ] = 0 #NEWLINE# dic [ 'S_TRANSF' ] = 0 #NEWLINE# dic [ 'S_NP' ] = 0 #NEWLINE# dic [ 'S_NF' ] = 0 #NEWLINE# dic [ 'S_NI' ] = 0 #NEWLINE# dic [ 'S_NI2' ] = 0 #NEWLINE# dic [ 'nblocks' ] = num_blocks #NEWLINE# dic [ 'ntraces' ] = 1 #NEWLINE# dic [ 'np' ] = num_points #NEWLINE# dic [ 'ebytes' ] = 4 #NEWLINE# dic [ 'tbytes' ] = ( 4 * num_points ) #NEWLINE# dic [ 'bbytes' ] = ( dic [ 'tbytes' ] + 28 ) #NEWLINE# dic [ 'vers_id' ] = 0 #NEWLINE# dic [ 'status' ] = 201 #NEWLINE# dic [ 'nbheaders' ] = 1 #NEWLINE# pdic = dict ( ) #NEWLINE# ndim = udic [ 'ndim' ] #NEWLINE# pdic [ 'np' ] = create_pdic_param ( 'np' , [ str ( ( udic [ ( ndim - 1 ) ] [ 'size' ] * 2 ) ) ] ) #NEWLINE# if ( ndim >= 2 ) : #NEWLINE# #INDENT# if udic [ ( ndim - 2 ) ] [ 'complex' ] : #NEWLINE# #INDENT# pdic [ 'ni' ] = create_pdic_param ( 'ni' , [ str ( ( udic [ ( ndim - 2 ) ] [ 'size' ] // 2 ) ) ] ) #NEWLINE# pdic [ 'phase' ] = create_pdic_param ( 'phase' , [ '0' , '1' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pdic [ 'ni' ] = create_pdic_param ( 'ni' , [ str ( udic [ ( ndim - 2 ) ] [ 'size' ] ) ] ) #NEWLINE# pdic [ 'phase' ] = create_pdic_param ( 'phase' , [ '0' ] ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ndim >= 3 ) : #NEWLINE# #INDENT# pdic [ 'array' ] = create_pdic_param ( 'array' , [ 'phase,phase2' ] ) #NEWLINE# if udic [ ( ndim - 3 ) ] [ 'complex' ] : #NEWLINE# #INDENT# pdic [ 'ni2' ] = create_pdic_param ( 'ni2' , [ str ( ( udic [ ( ndim - 3 ) ] [ 'size' ] // 2 ) ) ] ) #NEWLINE# pdic [ 'phase2' ] = create_pdic_param ( 'phase' , [ '0' , '1' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pdic [ 'ni2' ] = create_pdic_param ( 'ni2' , [ str ( udic [ ( ndim - 3 ) ] [ 'size' ] ) ] ) #NEWLINE# pdic [ 'phase2' ] = create_pdic_param ( 'phase2' , [ '0' ] ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ndim >= 4 ) : #NEWLINE# #INDENT# pdic [ 'array' ] = create_pdic_param ( 'array' , [ 'phase,phase2,phase3' ] ) #NEWLINE# if udic [ ( ndim - 4 ) ] [ 'complex' ] : #NEWLINE# #INDENT# pdic [ 'ni3' ] = create_pdic_param ( 'ni3' , [ str ( ( udic [ ( ndim - 4 ) ] [ 'size' ] // 2 ) ) ] ) #NEWLINE# pdic [ 'phase3' ] = create_pdic_param ( 'phase3' , [ '0' , '1' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pdic [ 'ni3' ] = create_pdic_param ( 'ni3' , [ str ( udic [ ( ndim - 4 ) ] [ 'size' ] ) ] ) #NEWLINE# pdic [ 'phase3' ] = create_pdic_param ( 'phase3' , [ '0' ] ) #NEWLINE# #UNINDENT# #UNINDENT# dic [ 'procpar' ] = pdic #NEWLINE# return dic