Example #1
0
func main() {
	flag.Parse()
	data, logicSize := loadData()
	list := reshape.ContiguousR4(data)
	fft := fftwf.PlanDFTR2C(logicSize[:], list, reshape.RtoC(list), fftwf.ESTIMATE)
	say("windowing...")
	window(data)
	say("FFT...")
	fft.Execute()
	fSpectrum(data)
	rmDC(data)
	dispersionX(data)
	dispersionY(data)
	dispersionZ(data)
	dispersion(data)
}
Example #2
0
func fSpectrum(data [][][][]float32) {
	say("frequencyspectrum")
	out, err := os.OpenFile("frequencyspectrum", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
	core.Fatal(err)
	defer out.Close()

	for i := 1; i < len(data); i++ {
		k := data[i]
		power := 0.
		K := reshape.RtoC(reshape.ContiguousR3(k))
		for _, s := range K {
			power += float64(real(s)*real(s) + imag(s)*imag(s))
		}
		f := float64(i) / totaltime
		fmt.Fprintln(out, f, "\t", power)
	}
}