Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

start monster quantal analysis

  • Loading branch information...
commit cdf0a264e74626f7fe5ced77a938c967a9fd0b2b 1 parent 1f928ea
@glutamate authored
View
2  BugAnal.hs
@@ -33,6 +33,7 @@ tellEndCode = tell $ "io $ putStrLn $ \"\\\\end{code}\\n\""
tellPrintSessionName = do
tell "sessionIdentifier <- getSessionName"
+ tell "sessionStart <- getSessionStart"
tellBeginCode
tell "io $ putStrLn $ \"openSession \"++sessionIdentifier"
tellEndCode
@@ -239,6 +240,7 @@ procTable qs tablines = do
indent 3
--tellPrint "<tr>"
tell "sessionIdentifier <- getSessionName"
+ tell "sessionStart <- getSessionStart"
tell "io $ putStrLn $ take 6 sessionIdentifier"
forM_ (tablines ) $ \ln -> do
tellPrintNoLn " & "
View
6 DisplacedLoom.bug
@@ -5,7 +5,7 @@ use Prelude
lov = 4.0000e-2
l = 0.2980
v = l/(lov*2)
-angle = 0.01
+angle = 0.0
stopDist = -0.17
@@ -45,6 +45,6 @@ _tmax=6
--_dt=0.5
--pos *> "print"
-ecVoltage <* adc (0,20000,6)
+--ecVoltage <* adc (0,20000,6)
-ecVoltage *> store ""
+--ecVoltage *> store ""
View
125 FETi/FETi.banal
@@ -1,117 +1,26 @@
->> everywhere aroundSpike = baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ around (spike) $ vm
+>> everywhere aroundSpike = baseline (-0.003) 0.003 $ limitSigs' (-0.05) 0.05 $ around (spike) $ vm
+>> everywhere ampPeak = snd $ head $ peak $ take 1 $ averageSigs $ take 100 $ aroundSpike
>> everywhere tpeak = fst $ head $ peak $ take 1 $ averageSigs $ aroundSpike
+>> everywhere bgNoiseDurs = measureBl (-0.003, 0.003) (-tpeak-0.015,0.015-tpeak) vm spike
+>> everywhere bgAmp = runStat meanF $ map snd bgNoiseDurs
+>> everywhere bgSD = runStat stdDevF $ map snd bgNoiseDurs
+>> everywhere sigNoise = ampPeak/bgSD
-> table where ((("washin" `isPrefixOf`)//note) & notD crap)
+> table where (notD crap & spike & notD continues)
> nspikes ~ show $ length spike
-> lastSpkTime ~ (accushow $ (fst $ last spike)/60) ++ " mins"
-> tpeak ~ tpeak
+> ampPeak ~ accushow ampPeak
+> morph
+> sessionStart
+> sigNoise ~ accushow sigNoise
-> break
+>> openSession 00c9
-> inSessionsWhere ((("washin" `isPrefixOf`)//note) & notD crap)
+> plot $ XRange (-0.02) 0.02 $ averageSigs $ aroundSpike
-%>> beforeES = \((t,_):_) sig -> sigT1 sig < t
-%>> afterES = \((t,_):_) sig -> sigT1 sig > t
-%>> beforeEE = \((t,_):_) (t1,_) -> t1 < t
+> ampPeak
->> washin = ("washin" `isPrefixOf`)//note
-
-%>> blDur = sigStat meanF $ during (inout (later (-0.002) spike) (later 0.002 spike)) vm
-%>> spikeWin = inout (later (-0.01) $ beforeE washin spike) (later (0.05) $ beforeE washin spike)
-%>> swSigs = measure blDur (sigStat minF $ during spikeWin vm)
-%>> swings = (\(lo,hi) -> hi-lo) <$$> sigStat (minF `both` maxF) vm
-%>> noGood = case take 3 sessionIdentifier of "fcb" -> contains ((<(-6))//swSigs) running; "6e8" -> during ((>1.0)//swings) running ++ afterE [(1282.0::Double,())] running ; _ -> []
-
->> plotSigs = \ss -> plot $ XRange (-0.01) 0.05 $ baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ ss
->> base = \ss -> baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ ss
-%>> plotInRange = \ss -> plot $ XRange (-0.01) 0.05 $ ss
-
-%> plot $ Points [PointType 7, PointSize 1] swSigs
-
-%> show $ length noGood
-
-%> show $ washin
-
-%>> vmOk = map (sigCutLast 0.005) $ notDuring noGood vm
-
->> aroundSpike = baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ around (spike) $ vm
-%>> aroundSpike50 = baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ around (minInterval 0.05 $ beforeE washin spike) $ vmOk
-%>> aroundSpike100 = baseline (-0.01) 0.005 $ limitSigs' (-0.05) 0.05 $ around (minInterval 0.1 $ beforeE washin spike) $ vmOk
-
-%>> av1 = \sigs -> take 1 $ averageSigs sigs
-
->> winHalfSize = 0.001
->> blHalfSize = 0.002
->> showMeasDur = map (\ts-> (ts,0.1)) $ [(negate $ tpeak+winHalfSize,negate $ tpeak-winHalfSize),(-blHalfSize, blHalfSize),(tpeak-winHalfSize,tpeak+winHalfSize)]
-
->> plot $ XRange (-0.02) 0.04 $ (sessionIdentifier, averageSigs $ aroundSpike) :+: showMeasDur
-
-%> note
-
->> peakDur = inout (later (tpeak-winHalfSize) spike) (later (tpeak+winHalfSize) spike)
->> peakMeas = sigStat meanF $ during peakDur vm
->> measDur = measureBl (-blHalfSize, blHalfSize) (tpeak-winHalfSize,tpeak+winHalfSize) vm spike
->> noiseDur = measureBl (-blHalfSize, blHalfSize) (negate $ tpeak+winHalfSize,negate $ tpeak-winHalfSize) vm spike
-
->> snm = take 4 $ sessionIdentifier
-
->> SaveArray (snm++"_epsps.dat") $ map (\((t1,_), v) -> (t1,v)) $ sortBy ( comparing fst) measDur
-
-%> show $ length $ measDur
-%> show $ length $ map snd noiseDur
-> bgVar = runStat varF (map snd noiseDur)
-%> show $ runStat varF (map snd measDur)
-
-> meanVars = map (runStat (meanF `both` varF)) $ inGroupsOf 20 $ map snd measDur
-
-%> subBg = map $ \(mn,var) -> (mn, varbgVar))
-
-> plot meanVars
-
->> pts = \c ty sz -> Points [PointType ty, PointSize sz, LineColor c]
-
-> plot $ pts "red" 4 2 measDur
-
-> break
-
-%> plot $ XRange (-0.02) 0.05 $ take 200 aroundSpike
-
-%> show $ length aroundSpike
-
-%> plot $ XRange (-0.01) 0.05 $ varianceSigs $ aroundSpike
-
-%> plot swings
-
-%> plot $ XRange (-0.01) 0.05 $ ("evens", av1 $ evens aroundSpike) :+: ("odds", av1 $ odds aroundSpike)
-
-%> plot $ XRange (-0.01) 0.05 $ ("No refraction", av1 aroundSpike) :+: ("50ms", av1 aroundSpike50) :+: ("100ms", av1 aroundSpike100)
-
-
-%> plot $ XRange (-0.01) 0.05 $ baseline (-0.01) 0.005 $ take 50 $ limitSigs' (-0.05) 0.05 $ around (beforeE washin spike) $ vmOk
-
-%> plotInRange $ ("after 4 mins", av1 $ base $ around (afterE (later 240 washin) spike) $ vmOk) :+: ("before", av1 $ base $ around (beforeE washin spike) $ vmOk) :+: ("after 8 mins", av1 $ base $ around (afterE (later 480 washin) spike) $ vmOk)
-
-
-%> plot $ XRange (-0.01) 0.05 $ YRange (-0.5) 1 $ take 20 $ smoothN 10 $ baseline 0.04 0.05 $ limitSigs' (-0.05) 0.05 $ around spike vmOk
-
-%> plot $ XRange (-0.005) 0.005 $ take 20 $ smoothN 10 $ baseline 0.04 0.05 $ limitSigs' (-0.05) 0.05 $ around spike ec
-
-%> plot $ XRange (0) 0.05 $ take 20 $alignBy sigStart $ during stimLeg vmOk
-
-%> plot $ XRange (0) 0.09 $ YRange (-0.2) 1.5 $ baseline 0 0.029 $ averageSigs $alignBy sigStart $ beforeE washin $ during stimNerve vmOk
-
-%> plot $ XRange (0) 0.09 $ YRange (-0.2) 0.5 $ baseline 0 0.09 $ noConst $ averageSigs $alignBy sigStart $ afterE washin $ during stimNerve vmOk
-
-%> plot $ Points [PointType 7, PointSize 1] measDur
-
-%> show $ length measDur
-
-%> show $ length (beforeE washin spike)
-
-%> show $ length (minInterval 0.05 $ beforeE washin spike)
-
-%> show $ length (minInterval 0.1 $ beforeE washin spike)
-
-%> break
+> tpeak
+> bgAmp
+> bgSD
View
7 FETi/Quantal.hs
@@ -0,0 +1,7 @@
+module Main where
+
+
+
+
+main = do
+ return ()
View
8 Query.hs
@@ -133,9 +133,9 @@ events :: (MonadIO m, Reify (Event a)) => String -> a-> StateT QState m [Event a
events nm _ = do
Session bdir t0 <- getSession
tshift <- loadShift `liftM` get
- ifM (liftIO (doesDirectoryExist (bdir++"/events/"++nm)))
+ liftIO $ unsafeInterleaveIO $ ifM (doesDirectoryExist (bdir++"/events/"++nm))
(do fnms <- getSortedDirContents $ bdir++"/events/"++nm
- utevs <- forM fnms $ \fn-> liftIO $ loadVs $ bdir++"/events/"++nm++"/"++fn
+ utevs <- forM fnms $ \fn-> loadVs $ bdir++"/events/"++nm++"/"++fn
return . shift tshift $ catMaybes $ map reify $ concat utevs)
(return [])
@@ -154,9 +154,9 @@ durations :: (MonadIO m, Reify (Duration a)) => String -> a-> StateT QState m [D
durations nm _ = do
Session bdir t0 <- getSession
tshift <- loadShift `liftM` get
- ifM (liftIO (doesDirectoryExist (bdir++"/durations/"++nm)))
+ liftIO $ unsafeInterleaveIO $ ifM (doesDirectoryExist (bdir++"/durations/"++nm))
(do fnms <- getSortedDirContents $ bdir++"/durations/"++nm
- eps <- forM fnms $ \fn-> liftIO $ loadVs $ bdir++"/durations/"++nm++"/"++fn
+ eps <- forM fnms $ \fn-> loadVs $ bdir++"/durations/"++nm++"/"++fn
return . shift tshift $ catMaybes $ map reify $ concat eps)
(return [])
View
9 QueryTypes.hs
@@ -95,6 +95,13 @@ getSession = qsSess `liftM` get
getSessionName = do Session bdir _ <- getSession
return $ last $ splitBy '/' bdir
+getSessionStart = do
+ Session bdir _ <- getSession
+ (t1,t2) <- liftIO $ read `fmap` readFile (bdir++"/tStart")
+ return $ TOD t1 t2
+
+
+
openReplies = modify (\s-> s { shArgs = "-o" : shArgs s })
plotSize w h = modify (\s-> s { shArgs = ("-h"++show h) : ("-w"++show w): shArgs s })
fontSize f= modify (\s-> s { shArgs = ("-f"++show f) : shArgs s })
@@ -382,6 +389,8 @@ putSig (Signal t1 t2 dt arr Eq) = do
forM_ (SV.unpack arr) $ B.put
return()
+instance QueryResult ClockTime where
+ qReply tod _ = return $ show tod
instance QueryResult SaveSignals where
qReply s@(SaveSignals nm xs) _ = do
View
14 SpikeGui.hs
@@ -30,7 +30,7 @@ import System.Environment
import EvalM
import Numeric.LinearAlgebra hiding (flatten)
import Foreign.Storable
-import Math.Probably.KMeans
+--import Math.Probably.KMeans
import Control.Monad
import Debug.Trace
import Data.Maybe
@@ -260,15 +260,17 @@ promptForSess = do
spikeDetectIO = do
initGUI
(args) <-getArgs
- snm <- case args of
- s:_ -> return s
- _ -> promptForSess
- inApproxSession snm $ do
+ (sessnm, signm) <- case args of
+ sess:sig:_ -> return (sess,sig)
+ sess:_ -> return (sess, "ec")
+ _ -> do sess <- promptForSess
+ return (sess, "ec")
+ inApproxSession sessnm $ do
--openReplies
--initUserInput
--plotSize 490 329
--overDur <- unitDurations overDurNm
- autoSpikes "ec"
+ autoSpikes signm
return ()
--normV <- signalsDirect "normV"
--spikeDetect [overDur] normV []
Please sign in to comment.
Something went wrong with that request. Please try again.