Name: nirpsec_init
Directory: /kroot/kss/nirspec/ui/run_ui
Purpose: Initialize NIRSPEC motorized stages.
#!/bin/csh
#
# Script to check NIRSPEC stages for initialization state, and prompt to
# init them if false (0).
#
# Author: TAB 1dec99
#
set stagelist = (irot slit echl disp calm calp calc)
set filters = (fil1 fil2)
# Check each stage (except filters) to see if its initialized.
set init = init
set initstat = initstat
set stageinit = 0
set filinit = 0
foreach istage ($stagelist)
set state = `show -terse -s nirspec $istage$initstat`
if ( $state != 1) then
echo ""
echo " $istage NOT initialized ($state)."
set stageinit = 1
else
echo ""
echo " $istage initialized ($state)."
endif
end
# Check filters.
foreach istage ($filters)
set state = `show -terse -s nirspec $istage$initstat`
if ( $state != 1) then
echo ""
echo " $istage NOT initialized ($state)."
set filinit = 1
else
echo ""
echo " $istage initialized ($state)."
endif
end
# Prompt to init the stages.
if ($stageinit == 1 || $filinit == 1) then
echo ""
echo -n "Enter to initialize stages, or anything else to exit:"
set continue = $<
if ($continue != 'y') then
goto skiphome
endif
else
goto skiphome
endif
echo ""
foreach istage ($stagelist)
set state = `show -terse -s nirspec $istage$initstat`
if ( $state != 1) then
modify -s nirspec $istage$init=1 wait
sleep 1
endif
end
echo ""
if ($filinit == 1) then
/kroot/kss/nirspec/ui/csh/init_filters
endif
# Check all stages and wait for completion.
foreach istage ($stagelist)
set state = `show -terse -s nirspec $istage$initstat`
if ( $state != 1) then
/kroot/kss/nirspec/ui/csh/wf$istage
endif
end
# Check again; report errors.
foreach istage ($stagelist)
set state = `show -terse -s nirspec $istage$initstat`
if ( $state != 1) then
echo ""
echo " $istage initialization FAILED\!"
if ($istage == 'calp') then
echo " ... forcing pinhole out."
modify -s nirspec calpstep=-2500
sleep 5
modify -s nirspec calpinitloc=0
endif
endif
end
skiphome:
echo ""
echo "NIRSPEC stage initialization complete."
echo ""