I created a file with the distances (from left to right) to the nearest particle to attempt to determine what the distribution of distances are as the distances appear larger toward the ends ..
:opt no-lint
import qualified Data.ByteString as B
import Text.Printf
import System.Process (createProcess,callCommand,std_out,StdStream( CreatePipe ),shell)
import IHaskell.Display
import qualified Data.ByteString as B
findDeltas :: [Float] -> [Float]
findDeltas fs =
let fs' = drop 1 fs
in map (\(f1,f2) -> (f1-f2)) (zip fs fs')
runGNUPlot :: String -> String -> String -> String -> String -> IO B.ByteString
runGNUPlot dataIn title xLabel yLabel fileNameOut = do
let gnuStr = unlines commands
let pltFile = "cmds.plt"
writeFile pltFile gnuStr
callCommand ("gnuplot " ++ pltFile)
B.readFile fileNameOut
where
commands :: [String]
commands = [
-- "set terminal pngcairo transparent enhanced font \
-- \ \"arial,10\" fontscale 1.1 size 600, 400 "
"set terminal png \
\ fontscale 1.1 size 600, 400 "
, "set output " ++ "\"" ++ fileNameOut ++ "\""
, "set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb 'white' fillstyle solid noborder"
, "set grid"
, "unset key"
, "set lmargin 15"
--, "set grid"
--, "show grid"
, "set title " ++ "\"" ++ title ++ "\"" ++ " textcolor lt -1 "
, "set xlabel " ++ "\"" ++ xLabel ++ "\"" ++ " off 0,0"
, "set ylabel " ++ "\"" ++ yLabel ++ "\"" ++ " off 0,0"
, "set yrange [-70:70]"
, "set grid"
--, "set label 1 at 5,-13 \"55 + 55 * e^{x/5}\" center rotate by 20 front"
--, "set label 2 at 10,5 '\\hl{\\small $t_\\textrm{Nc}$}\' center rotate by 45 front"
-- , "set arrow from graph 0,first " ++ (show hVal) ++ " to graph 1, first "
-- ++ (show hVal) ++ "nohead front lc rgb \"red\" lw 1 dashtype \"-\" "
, "plot " ++ "\"" ++ dataIn ++ "\"" ++ " with lines"
-- , "plot " ++ "\"" ++ dataIn ++ "\"" ++ " with lines"
--, "plot " ++ "\"" ++ dataIn ++ "\"" ++ " with lines, \\"
--, " (-55)+55*(1-(2.71828**(-x/5.0))) with points"
, "pause 0.1"
]
-- set label 1 at 50, 250 '\hl{\small $t_\textrm{Nc}$}' center rotate by 45 front
Input Files ..
Here's the 0.5 Jitter version .. Why the left outlier?
B.readFile "point_oh_five_jitter.png"
Here is jitter 1.0 version ..
B.readFile "one_point_oh_jitter.png"
rawPos <- readFile "pdists03.txt"
pos = map (\s -> (read s)::Float) (lines rawPos)
--putStrLn $ concatMap (\d -> show d ++ "\n") pos
deltas = findDeltas (take (truncate ((fromIntegral(length pos))/2.0)) pos)
vals = unlines $ map(\f -> show f) deltas
writeFile "deltas.txt" vals
writeFile "pos01.dat" ((concatMap (\p -> show p ++ "\n")) deltas)
runGNUPlot "pos01.dat" "Jitter 1.0 Distance Distrubution of Particles (left to right)"
"Particle No. Left to Right" "Distance" "out.png"
-- "Leaky Integrate and Fire Neuronal Model with Inputs"
-- "Time (ms)" "Activation Voltage (mV)"
-- "lifwi_solution01.png" 40