def partition_project_file(fn_project):
    """
    The new pulse ekko dvl writes 'project' files with all the profiles stored together
    We want to break them out into all the .HD header files and .DT1 data files.

    Parameters
    --------
    fn_project: str
        Filename for the .gpz project file
    """
    with open(fn_project, 'rb') as fin:
        f = fin.read()
    profile_num = 1
    while f.find(b'line%d' % profile_num) != -1:
        hd_start = f.find(b'line%d.hd' % profile_num)
        hd_end = f[hd_start:].find(b'PK') + hd_start
        hd_str = str(f[hd_start:hd_end])
        hd_lines = hd_str.split('\\r\\n')
        hd_lines[0] = hd_lines[0][2:]
        hd_lines[-1] = ''
        ini_start = f.find(b'line%d.ini' % profile_num)
        ini_end = f[ini_start:].find(b'PK') + ini_start
        ini_str = str(f[ini_start:ini_end])
        for i, line in enumerate(ini_str.split('\\r\\n')):
            if i == 0:
                hd_lines.append(line[2:len('line%d.ini' % profile_num) + 2])
                hd_lines.append(line[len('line%d.ini' % profile_num) + 2:])
            elif i == len(ini_str.split('\\r\\n')) - 1:
                continue
            else:
                hd_lines.append(line)
        with open('LINE' + str(profile_num) + '.HD', 'w') as fout:
            for line in hd_lines:
                fout.write(line + '\n')
        dt_start = f.find(b'line%d.dt1' % profile_num)
        dt_start += len(b'line%d.dt1' % profile_num)
        dt_end = f[dt_start:].find(b'Lineset') + dt_start
        dt_str = f[dt_start:dt_end]
        with open('LINE' + str(profile_num) + '.DT1', 'wb') as fout:
            fout.write(dt_str)
        profile_num += 1
