-
最近の投稿
最近のコメント
Archive
カテゴリー
メタ情報
投稿者「n3956」のアーカイブ
よく使う VS Code のキーボードショートカット
ターミナルにフォーカス Ctrl + @ ターミナルパネルを閉じる Ctrl + @ + @ エディタにフォーカス Ctrl + 1 エディタのタブ移動 Ctrl + Tab サイドバーを閉じる Ctrl + B &n … 続きを読む
numpy 配列の結合
例えば, # xdata ydata yerror 0.0 1.0 1.0 1.0 4.0 2.0 2.0 9.0 3.0 …. のようなデータが入ったファイル file. … 続きを読む
ヒストグラムの引き算
1 2 |
sub_hist = histA.Clone("sub_hist") sub_hist.Add(histB, -1) # sub_hist = histA - histB |
カーブフィットパラメータの取得
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
fitfunc = TF1("fitfunc", "gaus") # guas, expo, pol1, pol2, etc. fitfunc.SetLineColor(1) fitfunc.SetParameter(0, 100.) # A fitfunc.SetParameter(1, 5.0) # mu fitfunc.SetParameter(2, 0.01) # sigma hist.Fit("fitfunc", "M", "") # function, algorithm, draw option #save fit param with open("fit.log", "w") as fitlog: fitlog.write("# Function: %s\n" % (fitfunc.GetTitle(),)) fitlog.write("# No.\tparam\terror\n") for i in range(fitfunc.GetNpar()): fitlog.write("%s\t%s\t%s\n" % (i, fitfunc.GetParameter(i), fitfunc.GetParError(i))) |
ガウス関数の FWHM を Mathematica の数式処理で求める
g[x_, mu_, sigma_] := 1/(Sqrt[2 *Pi]*sigma)*Exp[-(x – mu)^2/(2*sigma^2)] x = mu で最大値を取るので,その値の 1/2 になる x … 続きを読む