def trim_data(xmin, xmax, xdata, *args):
<EOL>if not isinstance(xdata, _n.ndarray): xdata = _n.array(xdata)<EOL>if xmin is None: xmin = min(xdata)<EOL>if xmax is None: xmax = max(xdata)<EOL>ns = _n.argwhere((xdata >= xmin) & (xdata <= xmax)).transpose()[<NUM_LIT:0>]<EOL>output = []<EOL>output.append(xdata[ns])<EOL>for a in args:<EOL><INDENT>if not isinstance(a, _n.ndarray): a = _n.array(a)<EOL>output.append(a[ns])<EOL><DEDENT>return output<EOL>
Removes all the data except that in which xdata is between xmin and xmax. 
This does not mutilate the input arrays, and additional arrays
can be supplied via args (provided they match xdata in shape)

xmin and xmax can be None