本文整理汇总了Golang中github.com/tflovorn/scExplorer/plots.GraphVars类的典型用法代码示例。如果您正苦于以下问题:Golang GraphVars类的具体用法?Golang GraphVars怎么用?Golang GraphVars使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphVars类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: solveAndPlot
// Solve each given Environment and plot it.
func solveAndPlot(envs []*tempAll.Environment, epsabs, epsrel float64, vars plots.GraphVars, xyLabels []string, fileLabelF0, fileLabelMu, fileLabelD1, xmax string) error {
// solve
var plotEnvs []interface{}
var errs []error
if *plotFS || *preciseFS {
plotEnvs, errs = tempAll.MultiSolve(envs, epsabs, epsrel, SolveNoninteracting)
} else {
plotEnvs, errs = tempAll.MultiSolve(envs, epsabs, epsrel, ZeroTempSolve)
}
wd, _ := os.Getwd()
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabelF0, plots.XLABEL_KEY: xyLabels[0], plots.YLABEL_KEY: xyLabels[1], plots.YMIN_KEY: "0.0", "xmax": xmax}
if !*plotFS && !*preciseFS {
// plot F0
err := plots.MultiPlotStyle(plotEnvs, errs, vars, graphParams, grapherPath, *printerPlots)
if err != nil {
return fmt.Errorf("error making plots: %v", err)
}
}
// plot Mu_h
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelMu
graphParams[plots.YLABEL_KEY] = xyLabels[2]
graphParams[plots.YMIN_KEY] = ""
vars.Y = "Mu_h"
err := plots.MultiPlotStyle(plotEnvs, errs, vars, graphParams, grapherPath, *printerPlots)
if err != nil {
return fmt.Errorf("error making plots: %v", err)
}
// plot D1
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelD1
graphParams[plots.YLABEL_KEY] = xyLabels[3]
vars.Y = "D1"
err = plots.MultiPlotStyle(plotEnvs, errs, vars, graphParams, grapherPath, *printerPlots)
if err != nil {
return fmt.Errorf("error making plots: %v", err)
}
graphParams["xmax"] = ""
if *plotFS || *preciseFS {
// plot Fermi surface
for _, env := range envs {
X := strconv.FormatFloat(env.X, 'f', 6, 64)
Tz := strconv.FormatFloat(env.Tz, 'f', 6, 64)
Thp := strconv.FormatFloat(env.Thp, 'f', 6, 64)
outPrefix := wd + "/" + "plot_data.FermiSurface_x_" + X + "_tz_" + Tz + "_thp_" + Thp
err = tempAll.FermiSurface(env, outPrefix, grapherPath, *preciseFS)
if err != nil {
return fmt.Errorf("error making plots: %v", err)
}
}
}
return nil
}
开发者ID:tflovorn,项目名称:scExplorer,代码行数:54,代码来源:system_test.go
示例2: TestPlotTpVsX
// Plot evolution of Tp vs X.
func TestPlotTpVsX(t *testing.T) {
flag.Parse()
if !*testPlot || *production {
return
}
defaultEnv, err := ptDefaultEnv()
if err != nil {
t.Fatal(err)
}
envs := defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{2, 2, 2}, []float64{0.01, -0.1, -0.05}, []float64{0.15, 0.1, 0.05})
if *longPlot {
if !*tinyX {
envs = defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{10, 1, 1}, []float64{0.0005, 0.1, 0.1}, []float64{0.15, 0.1, 0.1})
} else {
envs = defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{10, 2, 2}, []float64{0.001, 0.05, 0.05}, []float64{0.01, 0.1, 0.1})
}
}
eps := 1e-9
plotEnvs, errs := tempAll.MultiSolve(envs, eps, eps, PairTempSolve)
// T_p vs x plot
vars := plots.GraphVars{"X", "", []string{"Tz", "Thp"}, []string{"t_z", "t_h^{\\prime}"}, nil, tempAll.GetTemp}
fileLabel := "plot_data.tp_x"
wd, _ := os.Getwd()
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabel, plots.XLABEL_KEY: "$x_{eff}$", plots.YLABEL_KEY: "$T_p$", plots.YMIN_KEY: "0"}
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making plot: %v", err)
}
// Mu_h vs x plot
fileLabel = "plot_data.mu_x"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$\\mu_h$"
graphParams[plots.YMIN_KEY] = ""
vars.Y = "Mu_h"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_h plot: %v", err)
}
// D1 vs x plot
fileLabel = "plot_data.D1_x"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$D_1$"
vars.Y = "D1"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making D1 plot: %v", err)
}
}
开发者ID:tflovorn,项目名称:scExplorer,代码行数:53,代码来源:system_test.go
示例3: TestPlotX2Collapse
// X = 0.1; tz = 0.1; thp = 0.1; -0.7 < mu_b < -0.8
func TestPlotX2Collapse(t *testing.T) {
flag.Parse()
if !*collapsePlot {
return
}
defaultEnv, err := flucDefaultEnv()
if err != nil {
t.Fatal(err)
}
defaultEnv.X = 0.1
defaultEnv.Tz = 0.1
defaultEnv.Thp = 0.1
envs := defaultEnv.MultiSplit([]string{"Mu_b"}, []int{20}, []float64{-0.75}, []float64{-0.9})
eps := 1e-6
plotEnvs, errs := tempAll.MultiSolve(envs, eps, eps, FlucTempSolve)
// X2 vs Mu_b plots
vars := plots.GraphVars{"Mu_b", "", []string{"Tz"}, []string{"t_z"}, nil, tempCrit.GetX2}
fileLabel := "plot.x2_mu_b"
wd, _ := os.Getwd()
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabel, plots.XLABEL_KEY: "$\\mu_b$", plots.YLABEL_KEY: "$x_2$"}
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_b plot: %v", err)
}
// T vs Mu_b plots
fileLabel = "plot_data.T_mu_b"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$T$"
vars.YFunc = tempAll.GetTemp
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making T plot: %v", err)
}
// Mu_h vs Mu_b plots
fileLabel = "plot_data.mu_h_mu_b"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$\\mu_h$"
vars.Y = "Mu_h"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_h plot: %v", err)
}
}
开发者ID:tflovorn,项目名称:scExplorer,代码行数:48,代码来源:system_test.go
示例4: TestPlotX2VsT
func TestPlotX2VsT(t *testing.T) {
flag.Parse()
if !(*testPlot || *longPlot) {
return
}
var plotEnvs []interface{}
var errs []error
wd, _ := os.Getwd()
cachePath := wd + "/__data_cache_tempLow"
if *loadCache {
var err error
plotEnvs, errs, err = tempAll.LoadEnvCache(cachePath)
if err != nil {
t.Fatal(err)
}
} else {
envs, err := lowDefaultEnvSet(*longPlot)
if err != nil {
t.Fatal(err)
}
// solve the full system
eps := 1e-9
plotEnvs, errs = tempAll.MultiSolve(envs, eps, eps, D1MuBetaSolve)
// cache results for future use
err = tempAll.SaveEnvCache(cachePath, plotEnvs, errs)
if err != nil {
t.Fatal(err)
}
}
Xs := getXs(plotEnvs)
// T vs F0 plots
vars := plots.GraphVars{"F0", "", []string{"Tz", "Thp", "X", "Be_field"}, []string{"t_z", "t_h^{\\prime}", "x", "eB"}, nil, tempAll.GetTemp}
fileLabel := "plot_data.T_F0"
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabel, plots.XLABEL_KEY: "$F_0$", plots.YLABEL_KEY: "$T$"}
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making T(F0) plot: %v", err)
}
// X2 vs T plots
fileLabel = "plot_data.x2_T"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.XLABEL_KEY] = "$T$"
graphParams[plots.YLABEL_KEY] = "$x_2$"
vars.X = ""
vars.XFunc = tempAll.GetTemp
vars.YFunc = tempCrit.GetX2
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making X2(T) plot: %v", err)
}
// Mu_h vs T plots
fileLabel = "plot_data.mu_h_T"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$\\mu_h$"
vars.Y = "Mu_h"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_h(T) plot: %v", err)
}
// if looking for magnetization plot, make that plot and don't get Cv
if *magnetization_calc {
fileLabel = "plot_data.M_eB"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.XLABEL_KEY] = "$eB$"
graphParams[plots.YLABEL_KEY] = "$M$"
vars.X = "Be_field"
vars.XFunc = nil
vars.Y = ""
vars.YFunc = tempCrit.GetMagnetization
vars.Params = []string{"Tz", "Thp", "X", "F0"}
vars.ParamLabels = []string{"t_z", "t_h^{\\prime}", "x", "F_0"}
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making M plot: %v", err)
}
return
}
// calculate specific heat contributions
SHenvs := make([]interface{}, len(plotEnvs))
F := func(i int, cerr chan<- error) {
pe := plotEnvs[i]
if pe == nil {
cerr <- errors.New("pe is nil")
return
}
if errs[i] != nil {
cerr <- errs[i]
return
}
env, ok := pe.(tempAll.Environment)
if !ok {
cerr <- errors.New("pe is not Environment")
}
X2, err := tempCrit.X2(&env)
if err != nil {
cerr <- err
return
}
//.........这里部分代码省略.........
开发者ID:tflovorn,项目名称:scExplorer,代码行数:101,代码来源:system_test.go
示例5: makeSHPlots
func makeSHPlots(SHenvs []interface{}, errs []error, fileLabelSH1, fileLabelSH2, fileLabelSH12, fileLabelGamma1, fileLabelGamma2, fileLabelGamma12 string) error {
wd, _ := os.Getwd()
vars := plots.GraphVars{"", "", []string{"Tz", "Thp", "X", "Be_field"}, []string{"t_z", "t_h^{\\prime}", "x_{eff}", "eB"}, GetSHTemp, nil}
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.XLABEL_KEY: "$T$"}
// specific heat from unpaired holons
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH1
graphParams[plots.YLABEL_KEY] = "$C_V^{1}$"
vars.Y = "SH_1"
err := plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH1 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
}
// specific heat from pairs
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH2
graphParams[plots.YLABEL_KEY] = "$C_V^{2}$"
vars.Y = "SH_2"
err = plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH2 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
}
// specific heat from holons+pairs
SH12 := func(d interface{}) float64 {
env := d.(SpecificHeatEnv)
return env.SH_1 + env.SH_2
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH12
graphParams[plots.YLABEL_KEY] = "$C_V^{12}$"
vars.Y = ""
vars.YFunc = SH12
err = plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelSH12 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
}
// plot gamma = C_V / T = C_V * Beta
// gamma from holons+pairs
Gamma := func(d interface{}) float64 {
env := d.(SpecificHeatEnv)
return SH12(d) * env.Beta
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma12
graphParams[plots.YLABEL_KEY] = "$\\gamma^{12}$"
vars.YFunc = Gamma
err = plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma12 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
}
// gamma from unpaired holons
Gamma1 := func(d interface{}) float64 {
env := d.(SpecificHeatEnv)
return env.SH_1 * env.Beta
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma1
graphParams[plots.YLABEL_KEY] = "$\\gamma^{1}$"
vars.YFunc = Gamma1
err = plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma1 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
}
// gamma from pairs
Gamma2 := func(d interface{}) float64 {
env := d.(SpecificHeatEnv)
return env.SH_2 * env.Beta
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma2
graphParams[plots.YLABEL_KEY] = "$\\gamma^{2}$"
vars.YFunc = Gamma2
err = plots.MultiPlot(SHenvs, errs, vars, graphParams, grapherPath)
if err != nil {
return err
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabelGamma2 + "_BW_"
err = plots.MultiPlotStyle(SHenvs, errs, vars, graphParams, grapherPath, true)
if err != nil {
return err
//.........这里部分代码省略.........
开发者ID:tflovorn,项目名称:scExplorer,代码行数:101,代码来源:system_test.go
示例6: TestPlotX2VsMu_b
func TestPlotX2VsMu_b(t *testing.T) {
flag.Parse()
if !(*testPlot || *longPlot) {
return
}
var plotEnvs []interface{}
var errs []error
wd, _ := os.Getwd()
cachePath := wd + "/__data_cache_tempFluc"
if *loadCache {
var err error
plotEnvs, errs, err = tempAll.LoadEnvCache(cachePath)
if err != nil {
t.Fatal(err)
}
} else {
envs, err := flucDefaultEnvSet(*longPlot)
if err != nil {
t.Fatal(err)
}
// solve the full system
eps := 1e-9
plotEnvs, errs = tempAll.MultiSolve(envs, eps, eps, FlucTempSolve)
// cache results for future use
err = tempAll.SaveEnvCache(cachePath, plotEnvs, errs)
if err != nil {
t.Fatal(err)
}
}
Xs := getXs(plotEnvs)
// T vs Mu_b plots
vars := plots.GraphVars{"Mu_b", "", []string{"Tz", "Thp", "X", "Be_field"}, []string{"t_z", "t_h^{\\prime}", "x", "eB"}, nil, tempAll.GetTemp}
fileLabel := "plot_data.T_mu_b"
grapherPath := wd + "/../plots/grapher.py"
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabel, plots.XLABEL_KEY: "$\\mu_b$", plots.YLABEL_KEY: "$T$"}
if !*skipPlots {
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making T(Mu_b) plot: %v", err)
}
}
// X2 vs T plots
fileLabel = "plot_data.x2_T"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.XLABEL_KEY] = "$T$"
graphParams[plots.YLABEL_KEY] = "$x_2$"
vars.X = ""
vars.XFunc = tempAll.GetTemp
vars.YFunc = tempCrit.GetX2
if !*skipPlots {
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making X2(T) plot: %v", err)
}
}
// Mu_h vs T plots
fileLabel = "plot_data.mu_h_T"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$\\mu_h$"
vars.Y = "Mu_h"
vars.YFunc = nil
if !*skipPlots {
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_h plot: %v", err)
}
}
// omega(q) parameters (a, b) vs T
get_fit := func(data interface{}, i int) float64 {
env := data.(tempAll.Environment)
if env.FixedPairCoeffs {
if i == 0 || i == 1 {
return env.A
} else {
return env.B
}
}
fit, err := tempCrit.OmegaFit(&env, tempCrit.OmegaPlus)
if err != nil {
fmt.Printf("%v\n", err)
}
return fit[i]
}
get_a := func(data interface{}) float64 {
return get_fit(data, 0)
}
get_b := func(data interface{}) float64 {
return get_fit(data, 2)
}
fileLabel = "plot_data.a_T"
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$a$"
vars.Y = ""
vars.YFunc = get_a
if !*skipPlots {
err := plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making a plot: %v", err)
}
}
//.........这里部分代码省略.........
开发者ID:tflovorn,项目名称:scExplorer,代码行数:101,代码来源:system_test.go
示例7: TestPlotTcVsX
// Plot evolution of Tc vs X.
func TestPlotTcVsX(t *testing.T) {
flag.Parse()
if !*testPlot && !*longPlot {
return
}
defaultEnv, err := ctDefaultEnv()
if err != nil {
t.Fatal(err)
}
envs := defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{4, 1, 1}, []float64{0.025, 0.05, 0.05}, []float64{0.10, 0.1, 0.1})
if *longPlot {
if !*tinyX {
envs = defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{10, 2, 2}, []float64{0.0001, 0.05, 0.05}, []float64{0.15, 0.1, 0.10})
} else {
envs = defaultEnv.MultiSplit([]string{"X", "Tz", "Thp"}, []int{10, 2, 2}, []float64{0.001, 0.05, 0.05}, []float64{0.01, 0.1, 0.1})
}
}
vars := plots.GraphVars{"X", "", []string{"Tz", "Thp"}, []string{"t_z", "t_h^{\\prime}"}, nil, tempAll.GetTemp}
eps := 1e-6
// solve the full system
plotEnvs, errs := tempAll.MultiSolve(envs, eps, eps, CritTempSolve)
// Tc vs x plots
wd, _ := os.Getwd()
grapherPath := wd + "/../plots/grapher.py"
var fileLabel string
if !*tinyX {
fileLabel = "plot_data.tc_x"
} else {
fileLabel = "plot_data.tinyX_tc_x"
}
graphParams := map[string]string{plots.FILE_KEY: wd + "/" + fileLabel, plots.XLABEL_KEY: "$x_{eff}$", plots.YLABEL_KEY: "$T_c/t_0$"}
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Tc plot: %v", err)
}
// Mu_h vs x plots
if !*tinyX {
fileLabel = "plot_data.mu_x_data"
} else {
fileLabel = "plot_data.tinyX_mu_x_data"
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$\\mu_h/t_0$"
vars.Y = "Mu_h"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making Mu_h plot: %v", err)
}
// D_1 vs x plots
if !*tinyX {
fileLabel = "plot_data.D1_x_data"
} else {
fileLabel = "plot_data.tinyX_D1_x_data"
}
graphParams[plots.FILE_KEY] = wd + "/" + fileLabel
graphParams[plots.YLABEL_KEY] = "$D_1$"
vars.Y = "D1"
vars.YFunc = nil
err = plots.MultiPlot(plotEnvs, errs, vars, graphParams, grapherPath)
if err != nil {
t.Fatalf("error making D1 plot: %v", err)
}
}
开发者ID:tflovorn,项目名称:scExplorer,代码行数:67,代码来源:system_test.go
注:本文中的github.com/tflovorn/scExplorer/plots.GraphVars类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论