You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue when tying to use the PySRIM package for my master thesis at Politecnico di Milano. When PySRIM is done with the computation of the ions in matter simulations, it has troubles reading the output file IONIZ.txt. Even if the simulations are over, we are still in the "trim.run(srim_executable_directory)" function.
More precisely, in the python code "output.py", at the line 71, the match.group(1) that needs to be converted from string to float seems to be equal to " b'000025,00' ", it is either the "b" or the "," sign compared to "." that create the error written in the title.
The complete message error is :
"
Traceback (most recent call last):
File "C:\Users\Julien Bouix\Desktop\SRIM-2013\AvecPysrim.py", line 36, in
results = trim.run(srim_executable_directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\srim.py", line 223, in run
return Results(srim_directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 111, in init
self.ioniz = Ioniz(directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 138, in init
num_ions = self._read_num_ions(output)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 71, in _read_num_ions
return int(float(match.group(1)))
ValueError: could not convert string to float: b'000025,00'
"
I would like to know your thoughts on what could give rise to this error since we have no control on the type of output files TRIM creates. We can choose what file we want but not what they contain (a comma instead of a point for instance). If it is systematic, I could remove the "b" and replace the comma by a point manually by changing the output.py file, but I would like to keep the source code of PySRIM unaltered.
I would very highly appreciate an answer and a possible solution you can think of. I would gladly give you more details if necessary.
Best regards,
Julien Bouix
The text was updated successfully, but these errors were encountered:
I think that most of this issues can be solved by using locale and adding a cast to float with atof . They are mainlky problems casting ",". In your case if you work with a french locale then SRIM is writting decimal "," instead of ".". Yo can see this MR https://gitlab.com/costrouc/pysrim/-/merge_requests/5 probalbly your problem will be solved by extending the strategy there.
Dear all,
I have an issue when tying to use the PySRIM package for my master thesis at Politecnico di Milano. When PySRIM is done with the computation of the ions in matter simulations, it has troubles reading the output file IONIZ.txt. Even if the simulations are over, we are still in the "trim.run(srim_executable_directory)" function.
More precisely, in the python code "output.py", at the line 71, the match.group(1) that needs to be converted from string to float seems to be equal to " b'000025,00' ", it is either the "b" or the "," sign compared to "." that create the error written in the title.
The complete message error is :
"
Traceback (most recent call last):
File "C:\Users\Julien Bouix\Desktop\SRIM-2013\AvecPysrim.py", line 36, in
results = trim.run(srim_executable_directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\srim.py", line 223, in run
return Results(srim_directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 111, in init
self.ioniz = Ioniz(directory)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 138, in init
num_ions = self._read_num_ions(output)
File "c:\users\julien bouix\anaconda3\lib\site-packages\srim\output.py", line 71, in _read_num_ions
return int(float(match.group(1)))
ValueError: could not convert string to float: b'000025,00'
"
I would like to know your thoughts on what could give rise to this error since we have no control on the type of output files TRIM creates. We can choose what file we want but not what they contain (a comma instead of a point for instance). If it is systematic, I could remove the "b" and replace the comma by a point manually by changing the output.py file, but I would like to keep the source code of PySRIM unaltered.
I would very highly appreciate an answer and a possible solution you can think of. I would gladly give you more details if necessary.
Best regards,
Julien Bouix
The text was updated successfully, but these errors were encountered: