def read_bdf(sdmpath, scan, nskip=<NUM_LIT:0>, readints=<NUM_LIT:0>, writebdfpkl=False, bdfdir=None):
assert os.path.exists(sdmpath), '<STR_LIT>' % sdmpath<EOL>scans, sources = read_metadata(sdmpath, scan, bdfdir=bdfdir)<EOL>assert scans[scan]['<STR_LIT>'], '<STR_LIT>' % scan<EOL>bdffile = scans[scan]['<STR_LIT>']<EOL>assert os.path.exists(bdffile), '<STR_LIT>' % (scan, scans[scan]['<STR_LIT>'])<EOL>with open(bdffile, '<STR_LIT:r>') as fp:<EOL><INDENT>if writebdfpkl:<EOL><INDENT>bdfpkldir = os.path.join(sdmpath, '<STR_LIT>')   <EOL>if not os.path.exists(bdfpkldir):<EOL><INDENT>os.makedirs(bdfpkldir)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>bdfpkldir = '<STR_LIT>'<EOL><DEDENT>bdf = BDFData(fp, bdfpkldir=bdfpkldir).parse()<EOL>if readints == <NUM_LIT:0>:<EOL><INDENT>readints = bdf.n_integrations - nskip<EOL><DEDENT>logger.info('<STR_LIT>' % (readints, nskip))<EOL>data = np.empty( (readints, bdf.n_baselines, bdf.n_channels, len(bdf.crosspols)), dtype='<STR_LIT>', order='<STR_LIT:C>')<EOL>for i in xrange(readints):<EOL><INDENT>data[i] = bdf.get_data ('<STR_LIT>', i+nskip)<EOL><INDENT>flag[i] = bdf.get_data ('<STR_LIT>', i+nskip)  <EOL><DEDENT><DEDENT><DEDENT>return data<EOL>
Reads given range of integrations from sdm of given scan.
    Uses BDFData object to read.
    readints=0 will read all of bdf (skipping nskip).
    Option to write pkl to store bdf info for faster parse next time.