|
1 | 1 | import datetime |
2 | | -import os |
3 | 2 | import re |
4 | 3 | from typing import List, Tuple |
5 | 4 |
|
6 | 5 | import numpy as np |
7 | 6 | import pandas as pd |
8 | 7 |
|
9 | 8 | from wfdb.io import _signal |
| 9 | +from wfdb.io import util |
10 | 10 |
|
11 | 11 |
|
12 | 12 | """ |
@@ -603,7 +603,7 @@ def wr_header_file(self, rec_write_fields, sig_write_fields, write_dir): |
603 | 603 | comment_lines = ["# " + comment for comment in self.comments] |
604 | 604 | header_lines += comment_lines |
605 | 605 |
|
606 | | - lines_to_file(self.record_name + ".hea", write_dir, header_lines) |
| 606 | + util.lines_to_file(self.record_name + ".hea", write_dir, header_lines) |
607 | 607 |
|
608 | 608 |
|
609 | 609 | class MultiHeaderMixin(BaseHeaderMixin): |
@@ -795,7 +795,7 @@ def wr_header_file(self, write_fields, write_dir): |
795 | 795 | comment_lines = ["# " + comment for comment in self.comments] |
796 | 796 | header_lines += comment_lines |
797 | 797 |
|
798 | | - lines_to_file(self.record_name + ".hea", header_lines, write_dir) |
| 798 | + util.lines_to_file(self.record_name + ".hea", header_lines, write_dir) |
799 | 799 |
|
800 | 800 | def get_sig_segments(self, sig_name=None): |
801 | 801 | """ |
@@ -1122,25 +1122,3 @@ def _read_segment_lines(segment_lines): |
1122 | 1122 |
|
1123 | 1123 | class HeaderSyntaxError(ValueError): |
1124 | 1124 | """Invalid syntax found in a WFDB header file.""" |
1125 | | - |
1126 | | - |
1127 | | -def lines_to_file(file_name, write_dir, lines): |
1128 | | - """ |
1129 | | - Write each line in a list of strings to a text file. |
1130 | | -
|
1131 | | - Parameters |
1132 | | - ---------- |
1133 | | - write_dir : str |
1134 | | - The output directory in which the header is written. |
1135 | | - lines : list |
1136 | | - The lines to be written to the text file. |
1137 | | -
|
1138 | | - Returns |
1139 | | - ------- |
1140 | | - N/A |
1141 | | -
|
1142 | | - """ |
1143 | | - f = open(os.path.join(write_dir, file_name), "w") |
1144 | | - for l in lines: |
1145 | | - f.write("%s\n" % l) |
1146 | | - f.close() |
0 commit comments