ROOT(CERN): Plot an figure with error bars using data from an csv file - c++

I'm trying to read data from a .csv file, which contains 4 columns: "x","y","Standard Deviation" and "Uncertainty". I want to plot a scatter diagram with error bars, which represent the uncertainty red from the .csv file. I run the following codes in root's REPL:
auto rdf = ROOT::RDF::MakeCsvDataFrame("./file.csv")
auto g1 = rdf.GraphAsymmErrors("x","y","","","Uncertainty","Uncertainty");
but I get an error:
ROOT_prompt_1:1:15: error: no member named 'GraphAsymmErrors' in 'ROOT::RDataFrame'
Meanwhile I can run the code below correctly:
auto g2=rdf.Graph("x","y");
g2->SetMarkerStyle(6);
g2->Draw();
, which confuses me because in the document of ROOT, the Graph() method and GraphAsymmErrors() method both seem to be the method of RDataFrame, so I think it should not show the error above.
Also, my root's version is 6.26, installed on Ubuntu 22.04 via snap.

GraphAsymmErrors doesn't seem to exist in the v6.26 documentation. The documentation you linked was for the master branch. You'll probably have to update to a nightly-build or wait for the next release in order to use that function.
In the meantime I would recommend you use RDataFrame::Take() on the respective branches to get them as std::vectors, and use the TGraphAsymmErrors constructor directly.

Related

Using QT and VS run CGAL5.2's official examples

I downloaded the official example which is CGAL-5.2\examples\Triangulation_2 from the website CGAL.org.
I successfully cmake the examples.
Then I opened Triangulation_2_Examples.sln from G:\MyCGAL_code\code_1\Triangulation_2\build by VS2017.
I also successfully built all projects (without errors).
I then click the debugger in VS: the draw triangulation.exe running fine, but the Triangulation_2 Basic_viewer is empty.
I knew someone's successful results has colored triangles in the window called Triangulation_2 Basic_viewer.
Did anyone try this official example before?
The program draw_triangulation_2 takes a filename as input (the file must contains a set of 2D points).
Without parameter, it takes data/triangulation_prog1.cin by default.
Thus the working directory must contains a directory data and this directory must contains a file triangulation_prog1.cin. Otherwise, the triangulation is empty.
To solve your problem, you need either to create the data directory and copy triangulation_prog1.cin in this directory; or give a valid filename as parameter.

Unable to display children:Attribute not found: value

I keep on getting this error when trying to view objects in the Debugger in PyCharm:
Unable to display children:Attribute not found: value
I have deduced that it is an error with Pycharm itself, not my code
(I get the same error on multiple scripts, but no error on with an older version of Pycharm on 2 different computers)
I'm on PyCharm Community 2017.3.4
Any ideas for workarounds, other than installing an older version?
I am finding similar issues. I too think there is something up with PyCharm it does not work as expected or previous version as you mention. I also found Pyscripter to debug as expected.
In some instances I would rely on the result object, result[0] or result.getOutput(0) to pass to next tool. Instead one can use a variable for the "output" or use the string (name) directly as input for the next tool.
For example,
facility_staging_polygons = os.path.join(outGDB, 'facility_staging_polygons\Polygon_1')
result = arcpy.MakeFeatureLayer_management(facility_staging_polygons, 'facility_staging_polygons_Layer')
# Process: Update Attributes
arcpy.AddField_management('facility_staging_polygons_Layer', "area_calc", "LONG")

custom kernel in e1071

i am currently trying to tune the svm function in the e1071 package for R. my input is genomic data (that is each attribute takes a value in the set {-1, 0, 1}) and none of the four kernels currently offered in the package is really good for this kind of data --- i would like to use Hamming distance as my kernel instead.
the svm function, it seems, is written in C++. i have downloaded the source via
download.packages(pkgs = "e1071",
destdir = ".",
type = "source")
found the svm.cpp file containing code for the function and the corresponding kernel portion, where i can potentially add my own custom kernel. has anyone tried doing this? is it possible to do this? once i've finished modifying svm.cpp (provided i figure out how..), how do i make the package "see" the modified file?
You can modify the existing kernel.
I changed the return statement of radial kernel to make the changes..
You can try with that

weka: how to generate libsvm training parameter

I am running libsvm through weka. Its output accuracy looks good to me, so I am planning to write a svm model by myself. However, weka didn't generate any training parameter, such as number of support vector. Therefore i cannot do anything. Searching the web, i found somebody said it would generate some parameters like the following:
optimization finished, #iter = 27
nu = 0.058475864943863545
obj = -1.871013102744184, rho = -0.19357337828800944
nSV = 9, nBSV = 0 `enter code here`
Total nSV = 9
but how come i didn't see any of them? any step that i missed? please help me. Thanks a lot.
Weka writes the output you mentioned to stderr.
So if you have started weka.sh or weka.bat from a terminal (or "command window" if you are on Windows), you should see that output appear in your terminal window after clicking "classify"
If you want to have access to this information via scripts, you can
redirect the output to a file and read in that file.
Here is how to edit the startup file weka.sh / weka.bat.
Edit this line (it is probably the last line) in order to write log info to a file instead of the terminal window:
java -cp $CP -Xmx8092m weka.gui.GUIChooser 2>>/opt/weka-stable/weka.log &
You can also add a properties file to your home directory to add more fine-grained behaviour.
https://weka.wikispaces.com/Properties+file
(You probably can also access information via the Weka Java API somehow, but you did not ask for that)

Matlab-compiler: update data into a figure window

Here is my problem:
I have an application in C++ and I use Matlab to visualize my results.
The code matlab is :
function y = plotArray(A)
plot(A)
end
I have create the library with mcc.
My data change with the time and want to update the plot and not close the windows and open a new one.
I've looked at the linkdata function available in matlab, but it is unsupported in the matlab complier.
Do you have any ideas?
Thank you
Would the clf command do what you want?
function y = plotArray(A)
clf %this clear the previous figure, without opening a new one
plot(A)
end