def generate_protocol(self):
<EOL>self.offsetX = int(self.sweepSize/<NUM_LIT:64>)<EOL>if not len(self.header['<STR_LIT>']):<EOL><INDENT>self.log.debug("<STR_LIT>")<EOL>self.protoX,self.protoY=[<NUM_LIT:0>,self.sweepX[-<NUM_LIT:1>]],[self.holding,self.holding]<EOL>self.protoSeqX,self.protoSeqY=[<NUM_LIT:0>],[self.holding]<EOL>return<EOL><DEDENT>proto=self.header['<STR_LIT>'][self.channel]<EOL>self.protoX,self.protoY=[] ,[]<EOL>self.protoX.append(<NUM_LIT:0>)<EOL>self.protoY.append(self.holding) <EOL>for step in proto:<EOL><INDENT>dX = proto[step]['<STR_LIT>']<EOL>Y = proto[step]['<STR_LIT>']+proto[step]['<STR_LIT>']*self.sweep<EOL>self.protoX.append(self.protoX[-<NUM_LIT:1>])<EOL>self.protoY.append(Y)<EOL>self.protoX.append(self.protoX[-<NUM_LIT:1>]+dX)<EOL>self.protoY.append(Y)<EOL><DEDENT>finalVal=self.holding <EOL>if self.header['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']:<EOL><INDENT>finalVal=self.protoY[-<NUM_LIT:1>]<EOL><DEDENT>self.protoX.append(self.protoX[-<NUM_LIT:1>])<EOL>self.protoY.append(finalVal)<EOL>self.protoX.append(self.sweepSize)<EOL>self.protoY.append(finalVal)<EOL>for i in range(<NUM_LIT:1>,len(self.protoX)-<NUM_LIT:1>): <EOL><INDENT>self.protoX[i]=self.protoX[i]+self.offsetX<EOL><DEDENT>self.protoSeqY=[self.protoY[<NUM_LIT:0>]]<EOL>self.protoSeqX=[self.protoX[<NUM_LIT:0>]]<EOL>for i in range(<NUM_LIT:1>,len(self.protoY)):<EOL><INDENT>if not self.protoY[i]==self.protoY[i-<NUM_LIT:1>]:<EOL><INDENT>self.protoSeqY.append(self.protoY[i])<EOL>self.protoSeqX.append(self.protoX[i])<EOL><DEDENT><DEDENT>if self.protoY[<NUM_LIT:0>]!=self.protoY[<NUM_LIT:1>]:<EOL><INDENT>self.protoY.insert(<NUM_LIT:1>,self.protoY[<NUM_LIT:0>])<EOL>self.protoX.insert(<NUM_LIT:1>,self.protoX[<NUM_LIT:1>])<EOL>self.protoY.insert(<NUM_LIT:1>,self.protoY[<NUM_LIT:0>])<EOL>self.protoX.insert(<NUM_LIT:1>,self.protoX[<NUM_LIT:0>]+self.offsetX/<NUM_LIT:2>)<EOL><DEDENT>self.protoSeqY.append(finalVal)<EOL>self.protoSeqX.append(self.sweepSize)<EOL>self.protoX=np.array(self.protoX)/self.pointsPerSec<EOL>self.protoY=np.array(self.protoY)<EOL>
Recreate the command stimulus (protocol) for the current sweep.
It's not stored point by point (that's a waste of time and memory!)
Instead it's stored as a few (x,y) points which can be easily graphed.

TODO: THIS
for segment in abf.ABFreader.read_protocol():
    for analogsignal in segment.analogsignals:
        print(analogsignal)
        plt.plot(analogsignal)
        plt.show()
        plt.close('all')