MCPcopy Create free account
hub / github.com/DragonisCV/RAM / read_data_from_txt_1v

Function read_data_from_txt_1v

ram/utils/plot_util.py:48–65  ·  view source on GitHub ↗

Read data from txt with 1 returned values. Args: path (str): path to the txt file. pattern (str): re (regular expression) pattern.

(path, pattern)

Source from the content-addressed store, hash-verified

46
47
48def read_data_from_txt_1v(path, pattern):
49 """Read data from txt with 1 returned values.
50
51 Args:
52 path (str): path to the txt file.
53 pattern (str): re (regular expression) pattern.
54 """
55 with open(path) as f:
56 lines = f.readlines()
57 lines = [line.strip() for line in lines]
58 data = []
59
60 pattern = re.compile(pattern)
61 for line in lines:
62 match = pattern.match(line)
63 if match:
64 data.append(float(match.group(1)))
65 return data
66
67
68def smooth_data(values, smooth_weight):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected