Skip to content

Commit

Permalink
nicer formatting, removing some prints
Browse files Browse the repository at this point in the history
  • Loading branch information
cspollard committed Jul 12, 2020
1 parent 811bb41 commit 4b027f8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
22 changes: 12 additions & 10 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,21 @@ main = do
Right (dataH, model, modelparams)
-> runModel hamiltonian nsamps outfile dataH model (const 0) modelparams

let uncerts = posteriorMatrices params covariances
return ()

withFile tablesfile WriteMode $ \h -> do
hPutStrLn h "absolute uncertainties:"
hPutStrLn h . latextable $ view _1 <$> uncerts
-- let uncerts = posteriorMatrices params covariances

hPutStrLn h ""
hPutStrLn h "relative uncertainties:"
hPutStrLn h . latextable $ view _2 <$> uncerts
-- withFile tablesfile WriteMode $ \h -> do
-- hPutStrLn h "absolute uncertainties:"
-- hPutStrLn h . latextable $ view _1 <$> uncerts

hPutStrLn h ""
hPutStrLn h "correlations:"
hPutStrLn h . latextable $ view _3 <$> uncerts
-- hPutStrLn h ""
-- hPutStrLn h "relative uncertainties:"
-- hPutStrLn h . latextable $ view _2 <$> uncerts

-- hPutStrLn h ""
-- hPutStrLn h "correlations:"
-- hPutStrLn h . latextable $ view _3 <$> uncerts



Expand Down
1 change: 0 additions & 1 deletion ext/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
plt.close()



if name.startswith("recobin"):
recobinx.append(float(name[7:]))
recobiny.append(best)
Expand Down
19 changes: 11 additions & 8 deletions src/RunModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ toError = either error id

type HMT = M.HashMap T.Text


runModel
:: (Maybe (Int, Double))
-> Int
Expand Down Expand Up @@ -178,14 +179,14 @@ runModel hamParams nsamps outfile dataH model' logReg modelparams = do
putStrLn "covariance matrix:"
print . fst $ toMatrix cov
putStrLn ""
putStr . T.unpack $ matToTable covlist
putStrLn ""
putStrLn "absolute uncertainties:"
putStr . T.unpack $ matToTable absuncerts
putStrLn ""
putStrLn "relative uncertainties:"
putStr . T.unpack $ matToTable reluncerts
putStrLn ""
-- putStr . T.unpack $ matToTable covlist
-- putStrLn ""
-- putStrLn "absolute uncertainties:"
-- putStr . T.unpack $ matToTable absuncerts
-- putStrLn ""
-- putStrLn "relative uncertainties:"
-- putStr . T.unpack $ matToTable reluncerts
-- putStrLn ""
putStrLn "transformation matrix:"
print . fst $ toMatrix t

Expand Down Expand Up @@ -373,10 +374,12 @@ posteriorMatrices params covariances =
eitherA :: (a -> Bool) -> a -> Either a a
eitherA f x = if f x then Left x else Right x


collapseEither :: Either a a -> a
collapseEither (Left x) = x
collapseEither (Right x) = x


latextable :: PrintfArg a => M.HashMap (T.Text, T.Text) a -> String
latextable m =
let ks = M.keys m
Expand Down

0 comments on commit 4b027f8

Please sign in to comment.