If you have a set of pre-made detrend images that you want to register into a new database, you can do this with the dettool. The basic steps are:

  • create a new detRun dettool -register_detrend -dbname MD09 -det_type DARK -filelevel fpa -inst GPC1 -telescope PS1
  • register each imfile : dettool -register_detrend_imfile -dbname MD09 -det_id 2 -class_id XY01 -uri /data/ipp003.0/rodney/DETREND/DARK/GPC1.DARK_PREMASK.norm.6.1.XY01.fits (repeat 60 times)
  • update the detrend state to 'stop' dettool -updatedetrun -dbname MD09 -det_id 2 -state stop

The following script, from Gene via Steve, will register a set of detrend images. Be sure to adjust the database name and directories as appropriate.

<pre> #!/bin/csh -f

set dbname = MDfakesn set dir = "/data/ipp003.0/MDfakesn"

# mask echo "------------------------------------------------------------" echo "Registering MASKS..." set subdir = "MASK" echo " Running dettool -dbname $dbname -register_detrend -det_type mask -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat" dettool -dbname $dbname -register_detrend -det_type mask -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat set detid = grep " det_id" tmp.dat | awk '{print $3}' if ("$detid" == "") then

echo "failed to register detrend" exit 1

endif foreach f ($dir/$subdir/*.XY??.fits)

set class = echo $f | awk -F. '{print $(NF-1)}' echo " Running: dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f" dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f

end dettool -dbname $dbname -updatedetrun -det_id $detid -state stop

# dark echo "------------------------------------------------------------" echo "Registering DARKS..." set subdir = "DARK" echo " Running : dettool -dbname $dbname -register_detrend -det_type dark -filelevel CHIP -inst GPC1 -telescope PS1 -exp_time_min 0.0 -exp_time_max 100000.0 > tmp.dat" dettool -dbname $dbname -register_detrend -det_type dark -filelevel CHIP -inst GPC1 -telescope PS1 -exp_time_min 0.0 -exp_time_max 100000.0 > tmp.dat set detid = grep " det_id" tmp.dat | awk '{print $3}' if ("$detid" == "") then

echo "failed to register detrend" exit 1

endif foreach f ($dir/$subdir/*.norm.*.XY??.fits)

set class = echo $f | awk -F. '{print $(NF-1)}' echo " Running: dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f" dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f

end dettool -dbname $dbname -updatedetrun -det_id $detid -state stop

# flat (r) echo "------------------------------------------------------------" echo "Registering rFLATS..." set subdir = "rFLAT" echo " Running : dettool -dbname $dbname -register_detrend -det_type flat -filter r -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat" dettool -dbname $dbname -register_detrend -det_type flat -filter r -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat set detid = grep " det_id" tmp.dat | awk '{print $3}' if ("$detid" == "") then

echo "failed to register detrend" exit 1

endif foreach f ($dir/$subdir/*.norm.*.XY??.fits)

set class = echo $f | awk -F. '{print $(NF-1)}' echo " Running: dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f" dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f

end dettool -dbname $dbname -updatedetrun -det_id $detid -state stop

# flat (i) echo "------------------------------------------------------------" echo "Registering iFLATS..." set subdir = "iFLAT" echo " Running : dettool -dbname $dbname -register_detrend -det_type flat -filter i -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat" dettool -dbname $dbname -register_detrend -det_type flat -filter i -filelevel CHIP -inst GPC1 -telescope PS1 > tmp.dat set detid = grep " det_id" tmp.dat | awk '{print $3}' if ("$detid" == "") then

echo "failed to register detrend" exit 1

endif foreach f ($dir/$subdir/*.norm.*.XY??.fits)

set class = echo $f | awk -F. '{print $(NF-1)}' echo " Running: dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f" dettool -dbname $dbname -register_detrend_imfile -det_id $detid -class_id $class -uri $f

end dettool -dbname $dbname -updatedetrun -det_id $detid -state stop

exit </pre>

NOTES

  • You must leave the detRun.mode as 'register' instead of 'master', so that the system will know that this is a detrend that is registered from the outside, not built from within by the standard tools.
  • For the DARK, you must include the exp_time_max parameter, because it is required to be non-NULL by the chip processing.