def linstack(streams, normalize=True):
stack = streams[np.argmax([len(stream) for stream in streams])].copy()<EOL>if normalize:<EOL><INDENT>for tr in stack:<EOL><INDENT>tr.data = tr.data / np.sqrt(np.mean(np.square(tr.data)))<EOL>tr.data = np.nan_to_num(tr.data)<EOL><DEDENT><DEDENT>for i in range(<NUM_LIT:1>, len(streams)):<EOL><INDENT>for tr in stack:<EOL><INDENT>matchtr = streams[i].select(station=tr.stats.station,<EOL>channel=tr.stats.channel)<EOL>if matchtr:<EOL><INDENT>if normalize:<EOL><INDENT>norm = matchtr[<NUM_LIT:0>].data /np.sqrt(np.mean(np.square(matchtr[<NUM_LIT:0>].data)))<EOL>norm = np.nan_to_num(norm)<EOL><DEDENT>else:<EOL><INDENT>norm = matchtr[<NUM_LIT:0>].data<EOL><DEDENT>tr.data = np.sum((norm, tr.data), axis=<NUM_LIT:0>)<EOL><DEDENT><DEDENT><DEDENT>return stack<EOL>
Compute the linear stack of a series of seismic streams of \
multiplexed data.

:type streams: list
:param streams: List of streams to stack
:type normalize: bool
:param normalize: Normalize traces before stacking, normalizes by the RMS \
    amplitude.

:returns: stacked data
:rtype: :class:`obspy.core.stream.Stream`