royallgroup / TCC

The Topological Cluster Classification algorithm
https://royallgroup.github.io/TCC/
GNU General Public License v3.0
12 stars 5 forks source link

cluster movie maker assumes user had analysed all frames #129

Open yangyushi opened 4 years ago

yangyushi commented 4 years ago

If the I had 100 frames in the .xyz file but only analysed 10 of them, I get a complain like this

Traceback (most recent call last):
  File "/home/yushi/Code/Github/TCC/tcc_python_scripts/post_processing/cluster_movie_maker.py", line 251, in <module>
    main(XYZ_NAME, RAW_STUB, CLUSTER_LIST)
  File "/home/yushi/Code/Github/TCC/tcc_python_scripts/post_processing/cluster_movie_maker.py", line 59, in main
    cluster_types = raw_file.get_frame()
  File "/home/yushi/Code/Github/TCC/tcc_python_scripts/post_processing/cluster_movie_maker.py", line 191, in get_frame
    self.num_particles = int(self.file_handle.readline())
ValueError: invalid literal for int() with base 10: ''

This should be because all frames in the .xyz file were considered, but there are not enough frames in the raw output, so RawFileReader can't get a frame that does not exist.

I still get the movie exported all-right but I guess the users would not expect a python error. Maybe just try to catch the error and ignore it?