import struct


def read_spectrum(filestream, n):
    """Reads n mz and intensity pairs from existing .sbd filestream. Assumes double
    precision for mass and single for intensity.
    
    Returns:
    Tuple:tuple of mz and intensity vectors    
    """    
    mzs = struct.unpack("<%dd" % n, filestream.read(8 * n))
    intensities = struct.unpack("<%df" % n, filestream.read(4 * n))    
    
    return (mzs, intensities)