-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update ply_io and filter_branch.py #1
base: main
Are you sure you want to change the base?
Conversation
…mpare and problem casued by NAN values
@@ -29,15 +29,22 @@ def read_ply(fp, newline=None): | |||
if 'element face' in line: | |||
raise Exception('.ply appears to be a mesh') | |||
if 'end_header' in line: break | |||
|
|||
|
|||
for j in range(len(prop)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding this section I would change line 28 to prop.append(line.split()[2].replace('scalar_', ''))
else: | ||
arr = np.loadtxt(ply) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there NaN values?
Also this below is slightly more succinct?
if fmt == 'binary':
arr = np.fromfile(ply, dtype=','.join(dtype))
df = pd.DataFrame(data=arr, columns=prop)
else:
df = pd.read_csv(ply, sep='\s+', names=prop, header=None)
df = df.dropna() # drop rows with NAN values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last point of an extracted cloud has NAN values in the last two columns (it does not have the last two properties), which caused filter_branch.py stopped running.
Yes, I agree. Moving df.dropna() out of the if statement is more succinct. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, how is the cloud being written in the first place before being read here as I think there must be an underlying issue. Dropping NaN here is a fix but could hide other errors e.g. what if it was the last 10,000 lines? I think I would put this outside the ply_io function.
The qrdar library still can't be imported now. |
ply_io.py
filter_branch.py