mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:57:08 +00:00
23 lines
528 B
Python
23 lines
528 B
Python
import sps
|
|
|
|
"""
|
|
Preplot importing functions.
|
|
"""
|
|
|
|
def from_file (file):
|
|
if not "type" in file or file["type"] == "sps":
|
|
records = sps.from_file(file["path"], file["format"] if "format" in file else None )
|
|
else:
|
|
return "Not an SPS file"
|
|
|
|
lines = []
|
|
line_names = set([r["line_name"] for r in records])
|
|
for line_name in line_names:
|
|
line = dict(line_name=line_name)
|
|
line_points = [r for r in records if r["line_name"] == line_name]
|
|
if line_points:
|
|
line["points"] = line_points
|
|
lines.append(line)
|
|
|
|
return lines
|