#!/bin/csh -f #+ # OSIRIS library of scripts # # NAME # osirisSampmode - set the detector readout/sampling mode. # # SYNOPSIS # osirisSampmode spec|imag [type [Nsamp [Groups] ] ] # # DESCRIPTION # # sets the readout mode to one of three types: # 1 = single single sampling # 2 = CDS correlated double sampling # 3 = MCDS multiple correlated double sampling # 3 = UTR Up the ramp sampling # # If MCDS is chosen, a second parameter can be used to set the number # of samples. The "nsamp" command will do this as well. # # If UTR is chosen a third parameter can be used to set the number # of groups. The "ngroups" command will do this as well. # # If no arguments are given, the current value is displayed. # # Will reset itime to minimum if needed. # # ARGUMENTS # type - type of sampling # 1 - single # 2 - CDS # 3 - MCDS # 4 - UTR # Nsamp - number of reads # Groups - number of groups # # OPTIONS # # EXAMPLES # single => osirisSampmode spec 1 # CDS => osirisSampmode imag 2 # mcds => osirisSampmode imag 3 8 # utr => osirisSampmode spec 4 8 4 # # ENVIRONMENT VARIABLES # # FILES # # SERVERS & KEYWORDS # # SCRIPTS CALLED # # EXIT STATUS # 0 - normal exit, no error # 1 - script aborted by an interrupt # 2 - syncheck error # 3 - error parsing command line input # other errors... # # # # Modification History: # 2016jun16 - MK: Adapted for OSIRIS from MOSFIRE # Made generic for use with both img and spec # 2018jul03 - jlyke: Note that due to syncheck, script only accepts # numeric entries after spec|imag (no mcds, fowler) #------------------------------------------------------ # Boiler plate for "-h" support for command autohelp. if ("$1" == "-h") then help $0 exit $status endif # Boilerplate for syncheck. # Note that the boiler plate should be transparent for all usages, # but to make correct use of syncheck you will need to specify the # correct pattern. set noglob set CheckStatus = `syncheck -command $0 $* -pattern {text {text {int:1,1000}}}` unset noglob if ("$CheckStatus" != "OK") then help $0 exit 1 endif # End of help/syncheck boiler plate. set mode = $1 switch ($mode) case S*: case s*: set M = "s" set det = "spec" breaksw case I*: case i*: set M = "i" set det = "imag" breaksw default: osirisScriptMsg -T "${cmd} ${det}: Specified detector must be SPEC or IMAG - aborting." exit 1 breaksw endsw shift # $argv now shorter by one # print out sampmode if no other args if ($#argv == 0) then set mode = `show -s o${M}ds -terse sampmode` switch ($mode) case 1: echo "sampling mode = 1 (Single)" breaksw case 2: echo "sampling mode = 2 (CDS)" breaksw case 3: echo "sampling mode = 3 (MCDS)" breaksw case 4: echo "sampling mode = 4 (UTR)" breaksw default: echo Do not understand sampling mode $mode exit 1 endsw exit endif set mode = $1 switch ($mode) case 1: case s*: case S*: modify -s o${M}ds sampmode = 1 breaksw case 2: case C*: case c*: modify -s o${M}ds sampmode = 2 breaksw case 3: case M*: case m*: case F*: case f*: modify -s o${M}ds sampmode=3 if ($2 =~ [1-9]*) then modify -s o${M}ds numreads=$2 # endif breaksw case 4: case U*: case u*: modify -s o${M}ds sampmode = 4 if ($2 =~ [1-9]*) then if ($3 =~ [1-9]*) then modify -s o${M}ds groups=$3 endif modify -s o${M}ds numreads=$2 endif breaksw default: cat <