packages feed

hirt-0.0.1.0: Args.hs

{-# LANGUAGE DeriveDataTypeable #-}

module Args
    ( HIrt(..)
    , getArgs
    ) where

import Types

import System.Console.CmdArgs

data HIrt = Convert
          | Estimate
    { responses      :: FilePath
    , iTaskParams    :: Maybe FilePath
    , iThetas        :: Maybe FilePath
    , algorithm      :: Algorithm
    , maxRounds      :: Int
    , precision      :: Double
    , intPrec        :: Double
    , thetaStats     :: [StatisticType]
    , taskStats      :: [StatisticType]
    , oResponses     :: Maybe FilePath
    , oRespFormat    :: RespFormat
    , oTaskParams    :: Maybe FilePath
    , oTheta         :: Maybe FilePath
    , oBayesPlot     :: Maybe FilePath
    , oAllTaskParams :: Maybe String
    , oAllTheta      :: Maybe String
    }    deriving (Show, Data, Typeable)

convert :: HIrt
convert = Convert {}

estimate :: HIrt
estimate = Estimate
    { responses = def &= argPos 0 &= typ "RESPONSES"
    , iTaskParams = def &= typFile &= help "initial task params"
    , iThetas = def &= typFile &= help "initial contestant abilities"
    , algorithm = JML &= help "estimation algorithm"
    , maxRounds = 40 &= name "n" &= help "stop if more than <n> rounds (defaults to 40)"
    , precision = 1e-8 &= help "stop if change is less than <precision> (defaults to 1e-8)"
    , intPrec = 1e-9 &= help "calculating precision of algorithms (default 1e-9)"
    , thetaStats = def &= help "statistics for contestants"
    , taskStats = def &= help "statistics for tasks"
    , oResponses = def &= typFile &= help "output parsed responses"
    , oRespFormat = List &= help "output response format"
    , oTaskParams = def &= typFile &= help "output file for final task param estimate"
    , oTheta = def &= typFile &= help "output file for final contestant ability estimate"
    , oBayesPlot = def &= typFile &= help "output coordinate list for aposteriori bayes probability"
    , oAllTaskParams = def &= typ "TEMPLATE"
        &= help "template for output of all round task parameters (params -> params000)"
    , oAllTheta = def &= typ "TEMPLATE"
        &= help "template for output of all round thetas (thetas -> thetas000)"
    } &= auto

getArgs :: IO HIrt
getArgs = cmdArgs $ modes [estimate, convert]