<s> import nmrglue as ng <EOL> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> dic , data = ng . pipe . read ( "<STR_LIT>" ) <EOL> length = data . shape [ <NUM_LIT:0> ] <EOL> peak_list = np . recfromtxt ( "<STR_LIT>" ) <EOL> uc = ng . pipe . make_uc ( dic , data ) <EOL> ppm_scale = uc . ppm_scale ( ) <EOL> fig = plt . figure ( ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> ax . plot ( ppm_scale , data , '<STR_LIT>' ) <EOL> f = open ( "<STR_LIT>" , '<STR_LIT:w>' ) <EOL> f . write ( "<STR_LIT>" ) <EOL> for name , start , end in peak_list : <EOL> min = uc ( start , "<STR_LIT>" ) <EOL> max = uc ( end , "<STR_LIT>" ) <EOL> if min > max : <EOL> min , max = max , min <EOL> peak = data [ min : max + <NUM_LIT:1> ] <EOL> peak_scale = ppm_scale [ min : max + <NUM_LIT:1> ] <EOL> ax . plot ( peak_scale , peak . cumsum ( ) / <NUM_LIT> + peak . max ( ) , '<STR_LIT>' ) <EOL> ax . plot ( peak_scale , [ <NUM_LIT:0> ] * len ( peak_scale ) , '<STR_LIT>' ) <EOL> ax . text ( peak_scale [ <NUM_LIT:0> ] , <NUM_LIT:0.5> * peak . sum ( ) / <NUM_LIT> + peak . max ( ) , name , <EOL> fontsize = <NUM_LIT:8> ) <EOL> tup = ( name , peak_scale [ <NUM_LIT:0> ] , peak_scale [ - <NUM_LIT:1> ] , peak . sum ( ) ) <EOL> f . write ( "<STR_LIT>" % tup ) <EOL> f . close ( ) <EOL> ax . set_xlim ( ppm_scale [ <NUM_LIT:0> ] , ppm_scale [ - <NUM_LIT:1> ] ) <EOL> fig . savefig ( "<STR_LIT>" ) </s>
