From d0f19b8bc7ab11449cea028106504cacecd94f66 Mon Sep 17 00:00:00 2001 From: hanemile Date: Mon, 19 Mar 2018 20:47:13 +0100 Subject: cleaned up --- src/go/coords.go | 18 ++++++++++++++++++ src/go/data/100.csv | 5 +++++ src/go/go | Bin 0 -> 2025101 bytes src/go/lookup | Bin 0 -> 2025566 bytes src/go/lookup.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 src/go/coords.go create mode 100644 src/go/data/100.csv create mode 100755 src/go/go create mode 100755 src/go/lookup create mode 100644 src/go/lookup.go (limited to 'src/go') diff --git a/src/go/coords.go b/src/go/coords.go new file mode 100644 index 0000000..819f36f --- /dev/null +++ b/src/go/coords.go @@ -0,0 +1,18 @@ +// Generate Star coordinates using a custom function + +// arg1 = number of stars +// arg2 = save path + +package main + +import ( + "fmt" + "os" +) + +func main(){ + + arguments := os.Args[1:] + + fmt.Println(arguments) +} diff --git a/src/go/data/100.csv b/src/go/data/100.csv new file mode 100644 index 0000000..eea675d --- /dev/null +++ b/src/go/data/100.csv @@ -0,0 +1,5 @@ +This is test content +If this is displayed, the software is working! +\o/ + | +/ \ diff --git a/src/go/go b/src/go/go new file mode 100755 index 0000000..43dbd99 Binary files /dev/null and b/src/go/go differ diff --git a/src/go/lookup b/src/go/lookup new file mode 100755 index 0000000..03c8927 Binary files /dev/null and b/src/go/lookup differ diff --git a/src/go/lookup.go b/src/go/lookup.go new file mode 100644 index 0000000..c222de5 --- /dev/null +++ b/src/go/lookup.go @@ -0,0 +1,54 @@ +// ./lookup.py + +package main + +import ( + "fmt" // printing + // "os" // system arguments + "math" +) + +const sigma = 200 +const f_0 = 0.1 +const R_s = 1e4 +const pi = 3.141592 +// e = math.e +const G = 4.302e-3 + +func rho(r int) float64 { + var a float64 = (1000) / (math.Sqrt( 2 * pi ) * sigma ) + var b float64 = r / sigma * sigma + var c float64 = math.Exp(float64(b)) + var d float64 = float64(a) * float64(c) + return d +} + +// # rho function +// def rho(r): +// a = (1) / (math.sqrt( 2 * pi ) * sigma ) +// b = math.exp( - (phi(r) / sigma ** 2 ) ) +// return a * b + +// func phi(x int) float64 { +// // if x == 0{ +// // return -4 * pi * f_0 * G * (R_s * R_s) +// // } else { +// // a := - ( 4 * pi * G * f_0 * (R_s * R_s * R_s) ) / x +// // b := 1 + (x / R_s) +// // c := math.Log(b) +// // d := a * b +// // return d +// // } +// } + +func main(){ + // nos := os.Args[1] + // save := "/data/" + string(os.Args[2]) + ".csv" + + fmt.Println(float64(rho(1e6))) + fmt.Println(float64(rho(3e6))) + fmt.Println(float64(rho(5e6))) + fmt.Println(float64(rho(7e6))) + fmt.Println(float64(rho(9e6))) + +} -- cgit 1.4.1