コード例 #1
0
ファイル: x-ray-scaling.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]
	tempTable := table.NewOutTable(tempColNames...)
	yTable := table.NewOutTable(yColNames...)
	fGasTable := table.NewOutTable(fGasColNames...)

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		bMass := math.Pow(10, massLog)

		h := halo.New(fTh, ppt, cFunc, halo.Biased, bMass, z)

		bTemp := h.EWTemperature(halo.Biased, bpbt, ppt, h.R500cBias)
		cTemp := h.EWTemperature(halo.Corrected, cpbt, ppt, h.C500.R)
		tempTable.AddRow(bMass, h.C500.M, bTemp, cTemp, cTemp/bTemp)

		bY := h.ThompsonY(bpbt, ppt, h.R500cBias)
		cY := h.ThompsonY(cpbt, ppt, h.C500.R)
		yTable.AddRow(bMass, h.C500.M, bY, cY, cY/bY)

		bFGas := fGas(h, halo.Biased)
		cFGas := fGas(h, halo.Corrected)
		fGasTable.AddRow(bMass, h.C500.M, bFGas, cFGas, cFGas/bFGas)
	}

	tempTable.Write(table.KeepHeader, path.Join(outDir, "mass-temp.table"))
	yTable.Write(table.KeepHeader, path.Join(outDir, "mass-y.table"))
	fGasTable.Write(table.KeepHeader, path.Join(outDir, "mass-fgas.table"))
}
コード例 #2
0
ファイル: radial-bias.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]

	alphaTable := table.NewOutTable(alphaNames...)
	betaTable := table.NewOutTable(betaNames...)
	fthTable := table.NewOutTable(fthNames...)
	biasTable := table.NewOutTable(biasNames...)

	cFunc0 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0)
	cFunc5 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0.5)

	h014 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 1e14, 0)
	h015 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 5e14, 0)
	h214 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 1e14, 0.2)
	h215 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 5e14, 0.2)

	minFracLog, maxFracLog := math.Log10(0.01), math.Log10(10)
	logWidth := (maxFracLog - minFracLog) / steps
	for fracLog := minFracLog; fracLog <= maxFracLog; fracLog += logWidth {
		frac := math.Pow(10, fracLog)
		r014 := h014.C500.R * frac
		r015 := h015.C500.R * frac
		r214 := h214.C500.R * frac
		r215 := h215.C500.R * frac

		alphaTable.AddRow(frac,
			h014.AlphaBias(r014),
			h015.AlphaBias(r015),
			h214.AlphaBias(r214),
			h215.AlphaBias(r215))

		betaTable.AddRow(frac,
			h014.BetaBias(r014),
			h015.BetaBias(r015),
			h214.BetaBias(r214),
			h215.BetaBias(r215))

		fthTable.AddRow(frac,
			h014.FThermal(r014),
			h015.FThermal(r015),
			h214.FThermal(r214),
			h215.FThermal(r215))

		biasTable.AddRow(frac,
			h014.BFrac(r014),
			h015.BFrac(r015),
			h214.BFrac(r214),
			h215.BFrac(r215))
	}

	alphaTable.Write(table.KeepHeader, path.Join(outDir, "radial-alpha.table"))
	betaTable.Write(table.KeepHeader, path.Join(outDir, "radial-beta.table"))
	fthTable.Write(table.KeepHeader, path.Join(outDir, "radial-fth.table"))
	biasTable.Write(table.KeepHeader, path.Join(outDir, "radial-bias.table"))
}
コード例 #3
0
ファイル: hystersis.go プロジェクト: phil-mansfield/mcarlo
func main() {
	// Temperature-dependent curves:

	t := table.NewOutTable("Temp", "Energy", "Magnetization", "C", "Chi")
	im := ising.New(ising.Grid2DType, 16)

	t0 := time.Now()
	for temp := 0.0; temp < 5.0; temp += 0.1 {
		ising.Equilibriate(im, temp, 100)

		es := make([]float64, 100)
		ms := make([]float64, 100)

		for i := 0; i < len(es); i++ {
			ising.Equilibriate(im, temp, 1000/len(es))
			es[i] = ising.AverageEnergy(im)
			ms[i] = math.Abs(ising.AverageMag(im))
		}
		t.AddRow(temp, avg(es), avg(ms),
			16*16*variance(es)/temp/temp,
			16*16*variance(ms)/temp)
	}
	t1 := time.Now()

	t.Write(table.KeepHeader, "temp.table")
	println("ising seconds:", sec(t0, t1))

	// Hysteresis loop:

	t = table.NewOutTable("h", "Magnetization")
	temp := 2.15

	t2 := time.Now()

	im = ising.New(ising.Grid2DType, 32)

	update := func(mag float64) {
		im.SetMag(mag)
		ising.Equilibriate(im, temp, 20)
		t.AddRow(mag, ising.AverageMag(im), ising.AverageEnergy(im),
			ising.SpecificHeat(im), ising.Chi(im))
	}

	for mag := -1.5; mag <= 1.5; mag += 0.03 {
		update(mag)
	}
	for mag := 1.5; mag >= -1.5; mag -= 0.03 {
		update(mag)
	}

	t3 := time.Now()
	println("hysteresis seconds:", sec(t2, t3))

	t.Write(table.KeepHeader, "mag.table")
}
コード例 #4
0
ファイル: radial-fgas.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]

	println("WARNING: You still need to implement this quickly :3")

	fgasTable := table.NewOutTable(fgasNames...)
	normTable := table.NewOutTable(normNames...)

	cFunc0 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0.0)
	cFunc5 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0.5)

	h014 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 1e14, 0.0)
	h015 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 5e14, 0.0)
	h514 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 1e14, 0.5)
	h515 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 5e14, 0.5)

	minFracLog, maxFracLog := math.Log10(0.01), math.Log10(10)
	logWidth := (maxFracLog - minFracLog) / steps

	for fracLog := minFracLog; fracLog <= maxFracLog; fracLog += logWidth {
		frac := math.Pow(10, fracLog)
		r14 := h014.C500.R * frac
		r15 := h015.C500.R * frac

		frac014 := h014.GasEnclosed(bt, valPpt, r14) /
			h014.MassEnclosed(bt, r14)
		frac015 := h015.GasEnclosed(bt, valPpt, r15) /
			h015.MassEnclosed(bt, r15)
		frac514 := h514.GasEnclosed(bt, valPpt, r14) /
			h514.MassEnclosed(bt, r14)
		frac515 := h515.GasEnclosed(bt, valPpt, r15) /
			h515.MassEnclosed(bt, r15)

		fgasTable.AddRow(frac, frac014, frac015, frac514, frac515)

		normTable.AddRow(frac,
			frac014/(cosmo.OmegaB/cosmo.OmegaM),
			frac015/(cosmo.OmegaB/cosmo.OmegaM),
			frac514/(cosmo.OmegaB/cosmo.OmegaM),
			frac515/(cosmo.OmegaB/cosmo.OmegaM))
	}

	fgasTable.Write(table.KeepHeader,
		path.Join(outDir, "radial-density-frac.table"))
	normTable.Write(table.KeepHeader,
		path.Join(outDir, "radial-density-frac-norm.table"))
}
コード例 #5
0
ファイル: mass-temp.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]
	outTable := table.NewOutTable(colNames...)

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		mass := math.Pow(10, massLog)

		h0 := halo.New(fTh, simPpt, cFunc0, halo.Biased, mass, 0.0)
		h0p := halo.New(fThP, simPpt, cFunc0, halo.Biased, mass, 0.0)
		h0m := halo.New(fThM, simPpt, cFunc0, halo.Biased, mass, 0.0)

		h5 := halo.New(fTh, simPpt, cFunc5, halo.Biased, mass, 0.5)
		h5p := halo.New(fThP, simPpt, cFunc5, halo.Biased, mass, 0.5)
		h5m := halo.New(fThM, simPpt, cFunc5, halo.Biased, mass, 0.5)

		outTable.AddRow(mass,
			h0.EWTemperature(tempBt, valPpt, h5p.C500.R),
			h0p.EWTemperature(tempBt, valPpt, h0p.C500.R),
			h0m.EWTemperature(tempBt, valPpt, h0m.C500.R),
			h5.EWTemperature(tempBt, valPpt, h5p.C500.R),
			h5p.EWTemperature(tempBt, valPpt, h5p.C500.R),
			h5m.EWTemperature(tempBt, valPpt, h5m.C500.R))
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "mass-temp.table"))
}
コード例 #6
0
ファイル: mass-fgas.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]
	outTable := table.NewOutTable(colNames...)

	fGas := func(h *halo.Halo, bt halo.BiasType, pbt halo.PressureBiasType) float64 {
		if bt != halo.Biased {
			return h.GasEnclosed(bt, pbt, valPpt, h.C500.R) /
				h.MassEnclosed(bt, h.C500.R)
		} else {
			return h.GasEnclosed(bt, pbt, valPpt, h.R500cBias) /
				h.MassEnclosed(bt, h.R500cBias)
		}
	}

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		mass := math.Pow(10, massLog)

		h := halo.New(fTh, simPpt, cFunc0, halo.Corrected, mass, 0.0)

		fGasCorrected := fGas(h, halo.Corrected, halo.EffectivePressure)
		fGasNaive := fGas(h, halo.Corrected, halo.NaiveThermalPressure)
		outTable.AddRow(mass, h.M500cBias, fGasCorrected, fGasNaive,
			fGasCorrected*mass, fGasNaive*h.M500cBias)
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "mass-fgas.table"))
}
コード例 #7
0
func main() {
	if len(os.Args) != 2 {
		panic("Must provite a target directory.")
	}

	outDir := os.Args[1]
	outTable := table.NewOutTable(colNames...)

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		mass := math.Pow(10, massLog)
		h := halo.New(fTh, simPpt, cFunc, halo.Biased, mass, 0.0)

		outTable.AddRow(mass,
			h.C500.M/h.M500cBias,
			1.0/h.FThermal(h.C500.R),
			1.0/h.FThermal(h.R500cBias),
			h.BFrac(h.C500.R),
			h.BFrac(h.R500cBias))
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "mass-false-bias.table"))
}
コード例 #8
0
ファイル: mass-bias.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("Must provite a target directory.")
	}

	outDir := os.Args[1]
	outTable := table.NewOutTable(colNames...)

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		mass := math.Pow(10, massLog)

		h0 := halo.New(fTh, simPpt, cFunc0, halo.Biased, mass, 0.0)
		h0p := halo.New(fThP, simPpt, cFunc0, halo.Biased, mass, 0.0)
		h0m := halo.New(fThM, simPpt, cFunc0, halo.Biased, mass, 0.0)

		h2 := halo.New(fTh, simPpt, cFunc2, halo.Biased, mass, 0.2)
		h2p := halo.New(fThP, simPpt, cFunc2, halo.Biased, mass, 0.2)
		h2m := halo.New(fThM, simPpt, cFunc2, halo.Biased, mass, 0.2)

		outTable.AddRow(mass,
			h0.C500.M/h0.M500cBias,
			h0p.C500.M/h0p.M500cBias,
			h0m.C500.M/h0m.M500cBias,
			h2.C500.M/h2.M500cBias,
			h2p.C500.M/h2p.M500cBias,
			h2m.C500.M/h2m.M500cBias)
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "mass-bias.table"))
}
コード例 #9
0
func main() {
	t := table.NewOutTable("Time Step", "C Correlation", "X Correlation")

	info := &ising.SweepInfo{
		ising.New(ising.Grid2DType, widthPow),
		ising.RandomSweep,
		mcrand.New(mcrand.GoCrypto, int64(time.Now().UnixNano())),
		temp,
	}

	stats := ising.SweepStatistics(info, initialSweeps, trials)

	fCs, _ := ising.Tau(stats.EHistory)
	fMags, _ := ising.Tau(stats.MagHistory)

	if len(fCs) < len(fMags) {
		for 0 < len(fMags)-len(fCs) {
			fCs = append(fCs, 0.0)
		}
	} else {
		for 0 < len(fCs)-len(fMags) {
			fMags = append(fMags, 0.0)
		}
	}

	info.Im.Print()

	println("Total steps:", len(fMags))

	for i := 0; i < len(fMags); i++ {
		t.AddRow(float64(i), fCs[i], fMags[i])
	}

	t.Write(table.KeepHeader, "tau.table")
}
コード例 #10
0
ファイル: plot-type-comp.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]
	outTable := table.NewOutTable(colNames...)

	minMassLog, maxMassLog := math.Log10(1e13), math.Log10(1e15)
	logWidth := (maxMassLog - minMassLog) / steps

	for massLog := minMassLog; massLog <= maxMassLog; massLog += logWidth {
		mass := math.Pow(10, massLog)
		
		h := halo.New(fTh, simPpt, cFunc0, halo.Corrected, mass, 0.0)

		mGas500Corrected := h.GasEnclosed(halo.Biased,
			halo.EffectivePressure, valPpt, h.C500.R)
		mGas500ThCorrected := h.GasEnclosed(halo.Biased,
			halo.EffectivePressure, valPpt, h.R500cBias)
		mGas500ThNaive := h.GasEnclosed(halo.Biased,
			halo.ThermalPressure, valPpt, h.R500cBias)

		outTable.AddRow(mass, h.M500cBias, mGas500Corrected,
			mGas500ThCorrected, mGas500ThNaive)
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "plot-type-comp.table"))
}
コード例 #11
0
func main() {
	if len(os.Args) != 3 {
		fmt.Fprintf(os.Stderr, "Usage: %s <grid width> <out-file>\n")
		os.Exit(1)
	}

	width, err := strconv.ParseInt(os.Args[1], 10, 64)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error with first argument: %s", err.Error())
		os.Exit(1)
	}

	timeTable := table.NewOutTable("Generate Edges", "Create Graph", "Union")
	dataTable := table.NewOutTable("Edge Frequency", "Largest Group Frac")
	dataTable.SetHeader(fmt.Sprintf(
		"Grid has continuous boundary conditions and %d x %d nodes.",
		width, width))

	for step := 0; step <= steps; step++ {
		prob := float64(step) / float64(steps)

		t0 := time.Now()
		us, vs := potts.GenerateEdges(potts.Grid2D, prob, int(width))

		t1 := time.Now()
		g := graph.New(uint32(width*width), us, vs)

		t2 := time.Now()
		g.Union()

		t3 := time.Now()

		largestGroup := g.Query(graph.Size, g.LargestGroup())
		dataTable.AddRow(prob, float64(largestGroup)/float64(width*width))
		timeTable.AddRow(sec(t0, t1), sec(t1, t2), sec(t2, t3))
	}

	timeTable.Print(table.KeepHeader)
	if err := dataTable.Write(table.KeepHeader, os.Args[2]); err != nil {
		fmt.Fprintf(os.Stderr, "I/O Error: %s\n", err.Error())
		os.Exit(1)
	}
}
コード例 #12
0
func main() {
	fmt.Println("Run statistics:")
	fmt.Printf("  %15s %5d\n", "Grid Width", 1<<widthPow)
	fmt.Printf("  %15s %5d\n", "Initial Sweeps", initialSweeps)
	fmt.Printf("  %15s %5d\n", "Trial Sweeps", trials)
	fmt.Printf("  %15s %5d\n", "Runs", runs)
	fmt.Printf("  %15s %5d\n", "Plot Points", int(points))

	t0 := float64(time.Now().UnixNano())

	infos := make([]*ising.SweepInfo, runs)
	for i := 0; i < runs; i++ {
		infos[i] = &ising.SweepInfo{
			ising.New(ising.Grid2DType, widthPow),
			ising.RandomSweep,
			mcrand.New(mcrand.Xorshift, int64(time.Now().Nanosecond())),
			minTemp,
		}
	}

	t := table.NewOutTable("Temp", "Energy", "Mag", "S. Heat", "Chi")
	stats := make([]*ising.SweepStats, runs)

	print("Running simulation")
	for point := 0.0; point < points; point++ {
		print(".")

		for i, info := range infos {
			info.Temp = minTemp + (maxTemp-minTemp)*point/points
			stats[i] = ising.SweepStatistics(info, initialSweeps, trials)
		}

		stat := ising.AvgSweepStats(stats)

		t.AddRow(infos[0].Temp, stat.E, stat.Mag, stat.C, stat.X)
	}
	println()

	t.Write(table.KeepHeader, fmt.Sprintf("temp%d.table", 1<<widthPow))

	t1 := float64(time.Now().UnixNano())
	fmt.Printf("Run time: %.3gs\n", (t1-t0)/1e9)
}
コード例 #13
0
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]
	outFile := path.Join(outDir, "radial-pressure.table")
	t := table.NewOutTable(colNames...)

	h014 := halo.New(fTh, halo.BattagliaAGN2012,
		cFunc, halo.Corrected, 1e14, 0)
	h015 := halo.New(fTh, halo.BattagliaAGN2012,
		cFunc, halo.Corrected, 5e14, 0)
	h214 := halo.New(fTh, halo.BattagliaAGN2012,
		cFunc, halo.Corrected, 1e14, 0.2)
	h215 := halo.New(fTh, halo.BattagliaAGN2012,
		cFunc, halo.Corrected, 5e14, 0.2)

	minFracLog, maxFracLog := math.Log10(0.01), math.Log10(10)
	logWidth := (maxFracLog - minFracLog) / steps
	for fracLog := minFracLog; fracLog <= maxFracLog; fracLog += logWidth {
		frac := math.Pow(10, fracLog)

		r014 := h014.C500.R * frac
		r015 := h015.C500.R * frac
		r214 := h214.C500.R * frac
		r215 := h215.C500.R * frac

		t.AddRow(frac,
			h014.Pressure(halo.ThermalPressure, halo.BattagliaAGN2012,
				halo.ElectronPressure, r014),
			h015.Pressure(halo.ThermalPressure, halo.BattagliaAGN2012,
				halo.ElectronPressure, r015),
			h214.Pressure(halo.ThermalPressure, halo.BattagliaAGN2012,
				halo.ElectronPressure, r214),
			h215.Pressure(halo.ThermalPressure, halo.BattagliaAGN2012,
				halo.ElectronPressure, r215))
	}

	t.Write(table.KeepHeader, outFile)
}
コード例 #14
0
ファイル: radial-temp.go プロジェクト: phil-mansfield/halo
func main() {
	if len(os.Args) != 2 {
		panic("You must give exactly one argument.")
	}
	outDir := os.Args[1]

	outTable := table.NewOutTable(colNames...)

	cFunc0 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0.0)
	cFunc5 := halo.ConcentrationFunc(halo.Bhattacharya2013, 0.5)

	h014 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 1e14, 0.0)
	h015 := halo.New(fTh, simPpt, cFunc0, halo.Corrected, 5e14, 0.0)
	h514 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 1e14, 0.5)
	h515 := halo.New(fTh, simPpt, cFunc5, halo.Corrected, 5e14, 0.5)

	minFracLog, maxFracLog := math.Log10(0.01), math.Log10(10)
	logWidth := (maxFracLog - minFracLog) / steps
	for fracLog := minFracLog; fracLog <= maxFracLog; fracLog += logWidth {
		frac := math.Pow(10, fracLog)

		println(
			h014.EWTemperature(halo.Corrected, valPpt, h015.C500.R*frac),
			h015.EWTemperature(halo.Corrected, valPpt, h015.C500.R*frac),
			h514.EWTemperature(halo.Corrected, valPpt, h514.C500.R*frac),
			h515.EWTemperature(halo.Corrected, valPpt, h515.C500.R*frac))

		outTable.AddRow(frac,
			h014.EWTemperature(halo.Corrected, valPpt, h015.C500.R*frac),
			h015.EWTemperature(halo.Corrected, valPpt, h015.C500.R*frac),
			h514.EWTemperature(halo.Corrected, valPpt, h514.C500.R*frac),
			h515.EWTemperature(halo.Corrected, valPpt, h515.C500.R*frac))
	}

	outTable.Write(table.KeepHeader, path.Join(outDir, "radial-temp.table"))
}
コード例 #15
0
// This is too monolithic and should be pruned.
func main() {
	sampleTemp := minSampleTemp

	maximumTable := table.NewOutTable("L", "1/L",
		"Critical Temperature", "Max Specific Heat", "Max Specific Heat Per Site")
	maximumTable.SetHeader(fmt.Sprintf("Created with %g trials per grid.",
		math.Pow(10, maxTrialsPow)))

	for widthPow := minPow; widthPow <= maxPow; widthPow++ {
		cols := make([]string, 1+2*(maxTrialsPow-minTrialsPow+1))
		cols[0] = "Temperature"

		fcols := make([][]float64, int((maxTemp-minTemp)/tempStep))
		for i := 0; i < len(fcols); i++ {
			fcols[i] = make([]float64, 1+2*(maxTrialsPow-minTrialsPow+1))
		}

		secs1 := 0.0
		secs2 := 0.0

		fmt.Printf("\n%d-Width Grid:\n", 1<<widthPow)
		for i := 0; i <= maxTrialsPow-minTrialsPow; i++ {
			trials := int(math.Pow(10, float64(minTrialsPow+i)))
			fmt.Printf("  Running %d trial suite\n", trials)

			cols[2*i+1] = fmt.Sprintf("E (%d)", trials)
			cols[2*i+2] = fmt.Sprintf("C (%d)", trials)

			info := &ising.SweepInfo{
				ising.New(ising.Grid2DType, uint32(widthPow)),
				ising.IterSweep,
				mcrand.New(mcrand.Xorshift, int64(time.Now().UnixNano())),
				sampleTemp,
			}

			t0 := time.Now().UnixNano()
			ising.SweepStatistics(info, initialSweeps, trials)
			t1 := time.Now().UnixNano()
			secs1 += float64(t1-t0) / 1e9

			h := info.Im.EnergyHistogram()

			minValidTemp, maxValidTemp := maxTemp, minTemp
			for j := 0; j < len(fcols); j++ {
				temp := minTemp + float64(j)*tempStep

				E := h.Energy(sampleTemp, temp)
				C := h.SpecificHeat(sampleTemp, temp)

				if !math.IsNaN(C) && !math.IsInf(C, 0) {
					if temp > maxValidTemp {
						maxValidTemp = temp
					}
					if temp < minValidTemp {
						minValidTemp = temp
					}
				}

				fcols[j][2*i+1] = E / float64(info.Im.Sites())
				fcols[j][2*i+2] = C / float64(info.Im.Sites())
			}

			if i+minTrialsPow == maxTrialsPow {
				tCrit := h.CriticalTemp(sampleTemp, minValidTemp, maxValidTemp)
				cCrit := h.SpecificHeat(sampleTemp, tCrit)
				maximumTable.AddRow(float64(int(1<<widthPow)),
					1.0/float64(int(1<<widthPow)), tCrit,
					cCrit, cCrit/float64(info.Im.Sites()))

				sampleTemp = tCrit
			}

			t2 := time.Now().UnixNano()
			secs2 += float64(t2-t1) / 1e9
		}

		headerString := fmt.Sprintf(
			"%16s: %g\n%16s: %d\n%16s: %d\n"+
				"%16s: %s\n%16s: %s\n%16s: %g\n%20s: %g",
			"Sample Temperature", sampleTemp,
			"Initial Sweeps", initialSweeps,
			"Width", 1<<widthPow,
			"Generator", "Xorshift",
			"Sweep Pattern", "IterSweep",
			"Total Sweep Time", secs1,
			"Total Histogram Time", secs2)

		t := table.NewOutTable(cols...)

		t.SetHeader(headerString)

		for i := 0; i < len(fcols); i++ {
			if !math.IsNaN(fcols[i][1]) {
				fcols[i][0] = minTemp + tempStep*float64(i)
				t.AddRow(fcols[i]...)
			}
		}

		t.Write(table.KeepHeader,
			fmt.Sprintf("tables/iter/hist-temp%d.table", 1<<widthPow))
	}

	maximumTable.Write(table.KeepHeader, "tables/iter/hist-maximum.table")
}