<s> from pylab import errorbar , xlabel , ylabel , show , legend <EOL> from numpy import array , arange <EOL> def event_profiler ( asset , truth , periods = <NUM_LIT:5> ) : <EOL> cut = [ ] <EOL> for i in range ( periods , len ( asset ) - periods ) : <EOL> if truth [ i ] == <NUM_LIT:1> and asset [ i ] > <NUM_LIT:0> : <EOL> cut . append ( asset [ i - periods : i + periods ] / asset [ i ] ) <EOL> return array ( cut ) <EOL> def plot_event_profile ( events , name = '<STR_LIT>' ) : <EOL> mn = events . mean ( axis = <NUM_LIT:0> ) - <NUM_LIT:1.0> <EOL> st = events . std ( axis = <NUM_LIT:0> ) <EOL> errorbar ( arange ( len ( mn ) ) , mn , st , label = name ) <EOL> xlabel ( '<STR_LIT>' , fontsize = <NUM_LIT:16> ) <EOL> ylabel ( '<STR_LIT>' , fontsize = <NUM_LIT:16> ) <EOL> if len ( name ) > <NUM_LIT:1> : <EOL> legend ( loc = '<STR_LIT>' , shadow = True , fancybox = True ) <EOL> show ( ) </s>
