Skip to content

Commit

Permalink
Update read_ops_file.jl
Browse files Browse the repository at this point in the history
account for +/- signs in front of numbers
  • Loading branch information
VEZY committed May 27, 2024
1 parent 452b12a commit 0fbebac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ops/read_ops_file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function read_ops_file(file)

# Extract scene dimensions
# Match a line starting with "T " followed by 5 floats or integers and ending with " flat"
scene_dim_line = findfirst(x -> occursin(r"^T (\d+(\.\d+)?)(\s+\d+(\.\d+)?){4}\s+flat", x), lines)
scene_dim_line = findfirst(x -> occursin(r"^T ([+-]?\d+(\.\d+)?)(\s+[+-]?\d+(\.\d+)?){4}\s+flat", x), lines)
if scene_dim_line === nothing
error("Scene dimensions not found in file $file")
end
Expand All @@ -45,7 +45,7 @@ function read_ops_file(file)
continue
end

if occursin(r"^\d+\t\d+\t.*\.opf\t(-?\d+(\.\d+)?\t){6}-?\d+(\.\d+)?$", line)
if occursin(r"^\d+\t\d+\t.*\.opf\t([+-]?\d+(\.\d+)?\t){6}[+-]?\d+(\.\d+)?$", line)
if functional_group == ""
error("Functional group not found for line $(i+scene_dim_line+1): $line in file $file")
end
Expand Down

0 comments on commit 0fbebac

Please sign in to comment.