Hi,
I am trying to plot what we call VMEC cuts with the method ROOT::RDF::RCsvDS method but unfortunately I get a lot of errors (including segmentation faults) and I cannot picture why. Are the graphs not allowed to close on themselves?
Usually these Error arises when the first line of the File does not exist of floating points with a single space in between. But unfortunately this is not the case, so I sadly have no clue what the problem could be.
Hi,
sorry I started looking at this yesterday but forgot to reply.
It looks like a problem with the parsing in RCsvDS, but it will require a bit more time to figure out.
~/Downloads root -l (tvem)
root [0] a = ROOT::RDF::MakeCsvDataFrame("cross_vmec_beta485_ref_bean.txt", false, ' ')
(ROOT::RDataFrame &) A data frame associated to the data source "CSV data source"
root [1] a.GetColumnType("Col0")
(std::string) "double"
root [2] a.GetColumnType("Col1")
(std::string) "std::string"
sadly I have a time problem attached to the plotting problem. The referees want to have the correction of my paper not later then the 25th of September. Is it possible to fix the bug until a day before or maybe supply myself with an alternative solution?
I had a quick look, my guess is that your second column is not being parsed as a double because it has values with this exponential syntax: -7.6076468e-16, which is perfectly fine, it is just not supported by the current implementation. I will add support for it when I have some time.
In the meantime, what you can do as a workaround is have an extra Define in your RDataFrame chain that transforms your string column into a double column.That Define should receive a lambda function that accepts an std::string as parameter, transforms it into a double and returns that double.
sadly this is not true. I deleted the lines, which included a number of the form e-16 but the segmentation fault is still present. Check for yourself cross_vmec_beta485_ref_bean.txt (14.8 KB)
The issue is that the .txt file was generated in Windows. When reading from the file in Linux, std::getline returns a string ended in \r. That \r is parsed as part of the second column, and therefore the inferred type is string. You can convert your Windows file to unix format with e.g. dos2unix.
Also, I noticed that the first row contains a 0 in the second column. Provided that you convert the file to unix format, and since it is the first row that is used to infer the types, the second column will be inferred as an integer. You can change that just by changing that value to 0. to force the infererred type to be double.