Fitting a closed curve to a set of points

后端 未结 4 2038
清歌不尽
清歌不尽 2020-11-27 04:04

I have a set of points pts which form a loop and it looks like this:

\"enter

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 04:59

    Using the ROOT Framework and the pyroot interface I was able to generate the following image Drawing Using pyroot

    With the following code(I converted your data to a CSV called data.csv so reading it into ROOT would be easier and gave the columns titles of xp,yp)

    from ROOT import TTree, TGraph, TCanvas, TH2F
    
    c1 = TCanvas( 'c1', 'Drawing Example', 200, 10, 700, 500 )
    t=TTree('TP','Data Points')
    t.ReadFile('./data.csv')
    t.SetMarkerStyle(8)
    t.Draw("yp:xp","","ACP")
    c1.Print('pydraw.png')
    

提交回复
热议问题