1 {-# LANGUAGE ScopedTypeVariables #-}
2 {-# LANGUAGE UndecidableInstances #-}
4 Copyright : Copyright (C) 2014-2016 Synchrotron Soleil
7 Maintainer : picca@synchrotron-soleil.fr
8 Stability : Experimental
12 import Numeric
.LinearAlgebra
(Vector
, Matrix
,
16 import Numeric
.Units
.Dimensional
.Prelude
(nano
, meter
, degree
,
20 import Options
.Applicative
hiding ((<>))
23 import Hkl
.Diffractometer
25 dispv
:: Vector
Double -> IO ()
26 dispv
= putStr . vecdisp
(disps
2)
28 disp
:: Matrix
Double -> IO ()
29 disp
= putStr . dispf
3
33 = Ca
Double Double Double -- ca command
38 withInfo
:: Parser a
-> String -> ParserInfo a
39 withInfo opts desc
= info
(helper
<*> opts
) $ progDesc desc
41 parseCa
:: Parser Command
43 <$> argument auto
(metavar
"H")
44 <*> argument auto
(metavar
"K")
45 <*> argument auto
(metavar
"L")
47 parseCommand
:: Parser Command
48 parseCommand
= subparser
$
49 command
"ca" (parseCa `withInfo`
"compute angles for the given hkl")
51 parseOptions
:: Parser Options
52 parseOptions
= Options
<$> parseCommand
54 -- Actual program logic
55 run
:: Options
-> IO ()
59 print (solution
/~~ degree
)
60 dispv
(computeHkl e4c solution lattice
)
63 (sol
, path
) = computeAngles e4c angles lattice mode
[h
, k
, l
]
64 s
= [30.0, 0.0, 0.0, 0.0, 10.0, 0.0]
66 angles
= (s
++ d
) *~~ degree
67 solution
= fromMode mode sol angles
68 lattice
= Cubic
(1.54 *~ nano meter
)
69 mode
= ModeHklE4CConstantPhi
72 main
= run
=<< execParser
73 (parseOptions `withInfo`
"Interact with hkl API")