#NEWLINE# def unpack_adjoints( ratios ) : #NEWLINE# #INDENT# new_ratios = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# offset = 0 #NEWLINE# for ( k , ( num , ratios ) ) in sorted ( ratios . items ( ) ) : #NEWLINE# #INDENT# unpacked = [ [ ] for _ in range ( num ) ] #NEWLINE# for r in ratios : #NEWLINE# #INDENT# nr = len ( r ) #NEWLINE# for i in range ( num ) : #NEWLINE# #INDENT# unpacked [ i ] . append ( ( r [ i ] if ( i < nr ) else np . nan ) ) #NEWLINE# #UNINDENT# #UNINDENT# for ( i , r ) in enumerate ( unpacked ) : #NEWLINE# #INDENT# new_ratios [ ( ( k + i ) + offset ) ] = r #NEWLINE# #UNINDENT# offset += ( num - 1 ) #NEWLINE# #UNINDENT# return new_ratios