Skip to content
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

super basic question for tabtos #115

Closed
krobsp opened this issue Dec 29, 2022 · 5 comments
Closed

super basic question for tabtos #115

krobsp opened this issue Dec 29, 2022 · 5 comments

Comments

@krobsp
Copy link

krobsp commented Dec 29, 2022

Hi !
I have a super basic question for tabtos
I have made a txt files containing two lines and 7 columns separated by spaces, see attached.
When launching tabtos in=smachin.txt out=snap1.nemo block1=m,pos,vel ndim=3, I get a fatal parsing error. (I know that I had such a problem in the past, but can't remember how to solve...)
Could you see the problem ?
Thanks !
smachin.txt

@teuben
Copy link
Owner

teuben commented Dec 29, 2022

When I look at the file, you didn't have a closing newline after the last line, so for unix read lines program that last line never terminated :-) It's easy to create such files with "vim" (maybe emacs too), but it's just not a good idea. I've seen compilers also fail when the last line is such a funky black hole line.

The program
hexdump -C smachin.txt
show it clearly.

Also, it's a file that comes from DOS, it has CR/NL instead of the unix NL convention for the end of line. I converted them in emacs , but you can also use the dos2unix program.

I will admit though this is an error that NEMO should be able to handle, so I'll put that on the buglist :-) Arguably also the funky last line that never terminated.

@teuben
Copy link
Owner

teuben commented Dec 29, 2022

An example I tried first to show it should work:

mkplummer - 10 | snapprint - m,x,y,z,vx,vy,vz  > tab2
tabtos tab2 . block1=m,pos,vel

@krobsp
Copy link
Author

krobsp commented Dec 29, 2022

thank you a lot

@teuben
Copy link
Owner

teuben commented Dec 29, 2022

The core problem in table.c was resolved, it now reads dos/unix/mac files. However, tabtos doesn't use the new table system yet, so e.g. tabcols (which does use the table I/O) needs to be used in a filter, e.g.

 tabcols smachin.txt  | tabtos - . block1=m,pos,vel nbody=2

will show now errors. If you use not a pipe but a file, the nbody=2 is not needed,as the number of lines is used for nbody :-)

(since table.c was modified, you would need to rebuild NEMO, to be on the safe side,e.g.

   cd $NEMO
  make rebuild

@teuben
Copy link
Owner

teuben commented Dec 29, 2022

Turns out such a fix was also easy in tabtos, so now it can read DOS and MAC files. The new version of tabtos is 2.1

This command would do that update and recompile:

   mknemo -u tabtos

but this patch doesn't solve the final line problem.

@teuben teuben closed this as completed Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants