Error sampling from energy spectra - Column 3 is invalid

Hi, dear Chirs.

I tried this package (https://fluka-forum.web.cern.ch/t/sampling-from-energy-spectra/515) but could not get my external spectra to work with it. I can run the example spectra no problem yet every time I try to run my spectra file it just gives out error message saying that the Fluence data on column 3 is invalid. I used Excel to separate the data into 3 different columns and then save it as .csv file (comma delimited/ tab delimited/ space delimited but none of them work). So I guess my question is what is a better way to generate these spectrum files?

The attached is my spectra file.TS.inp (1.6 KB)

Thanks in advance.

Martin

Hello! I am not Chris, still, I have an answer for you =)

The problem is with your file’s lines ending, it is in Windows format.

DOS uses carriage return and line feed ("\r\n") as a line ending, which Unix uses just line feed ("\n").

Take a look at http://www.cs.toronto.edu/~krueger/csc209h/tut/line-endings.html or https://en.wikipedia.org/wiki/Newline. It is better to work under unix to better handle such stuff because of such surprises. I changed your file line ending (it can be changed via text editor), now this should work.

TS.inp (1.6 KB)

Cheers,
Ivan

Thank you Ivan! I now know how to work with it.