mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:07:09 +00:00
Initial commit
This commit is contained in:
22
bin/preplots.py
Normal file
22
bin/preplots.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user