From f30219c47c49cb091a24da3a2e4112eeb6fe091d Mon Sep 17 00:00:00 2001 From: Cees Bassa Date: Sat, 2 Nov 2019 09:09:10 +0100 Subject: [PATCH] Remove unused scripts --- scripts/st_calbulk.sh | 31 ------ scripts/st_capture.sh | 19 ---- scripts/st_compress.sh | 48 ---------- scripts/st_compress_and_relaunch.sh | 144 ---------------------------- scripts/st_eog.sh | 7 -- scripts/st_process_bulk.sh | 18 ---- scripts/st_process_offline.sh | 23 ----- scripts/st_process_online.sh | 30 ------ scripts/st_reduce.sh | 1 - scripts/st_ristretto.sh | 1 - scripts/st_runsched.sh | 7 -- 11 files changed, 329 deletions(-) delete mode 100755 scripts/st_calbulk.sh delete mode 100755 scripts/st_capture.sh delete mode 100755 scripts/st_compress.sh delete mode 100755 scripts/st_compress_and_relaunch.sh delete mode 100755 scripts/st_eog.sh delete mode 100755 scripts/st_process_bulk.sh delete mode 100755 scripts/st_process_offline.sh delete mode 100755 scripts/st_process_online.sh delete mode 100755 scripts/st_reduce.sh delete mode 100755 scripts/st_ristretto.sh delete mode 100755 scripts/st_runsched.sh diff --git a/scripts/st_calbulk.sh b/scripts/st_calbulk.sh deleted file mode 100755 index 909bf38..0000000 --- a/scripts/st_calbulk.sh +++ /dev/null @@ -1,31 +0,0 @@ -#./bin/bash - -# Loop into every directory -for obsdir in *; do - if [ -d $obsdir ]; then - echo $obsdir - cd $obsdir - # check if observation is calibrated - if [ ! -e "out.dat" ]; then - CALFRAME=1 - while true; do - # calibrate Nth image captured - st_calibrate.sh $CALFRAME - # check if no calibration data was output - if [ ! -e "out.dat" ]; then - read -p "Delete observation?" yn - case $yn in - [Yy]* ) cd ..; rm -rf $obsdir; break;; - [Nn]* ) CALFRAME=$(($CALFRAME+1)); continue;; - * ) echo "Please answer y or n.";; - esac - else - cd .. - break - fi - done - else - cd .. - fi - fi -done diff --git a/scripts/st_capture.sh b/scripts/st_capture.sh deleted file mode 100755 index 318dfb3..0000000 --- a/scripts/st_capture.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Test for device -if [ -z $1 ]; then - device=/dev/video0 -else - device=$1 -fi - -# Go to shared memory -mkdir -p /dev/shm -cd /dev/shm - -# Remove old files -rm img*.pgm - -# Start capture -ffmpeg -f video4linux2 -i $device -s 720x576 -r 25 img%06d.pgm - diff --git a/scripts/st_compress.sh b/scripts/st_compress.sh deleted file mode 100755 index d85a5b6..0000000 --- a/scripts/st_compress.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Settings -PGMDIR=/dev/shm -N=250 - -# Force a restart -echo "restart" >$ST_OBSDIR/control/state.txt - -# For ever loop -while true; do - # Get number of files - NFILES=`ls -1 $PGMDIR/img*.pgm 2>/dev/null | wc -l` - - # If enough, process - if [ $NFILES -ge $N ]; then - # Get state - export STATE=`cat $ST_OBSDIR/control/state.txt` - - # Create new directory - if [ $STATE == "restart" ]; then - export DIR=`date -u +%FT%T | sed -e "s/-//g" -e "s/\://g" -e "s|T|/|g"` - mkdir -p $ST_OBSDIR/$DIR - cd $ST_OBSDIR/$DIR - echo "Moving to $ST_OBSDIR/$DIR" - echo "observing" >$ST_OBSDIR/control/state.txt - cp $ST_OBSDIR/control/position.txt . - cp $ST_OBSDIR/control/camera.txt . - fi - - # Start point - M=`ls -1 $PGMDIR/img*.pgm | head -n1 | sed -e "s/[^0-9]*//g"` - - # Run pgm2fits - pgm2fits -p $PGMDIR/img -w 720 -h 576 -s $M -n $N - - # Remove files - ls -1 $PGMDIR/img*.pgm | head -n$N | awk '{printf("rm -rf %s\n",$1)}' | sh - - # Run stviewer - stviewer `ls -1 2*.fits | tail -n1` - cp avg.pgm $ST_OBSDIR - echo "Finished" - fi - - # Sleep - sleep 1 -done diff --git a/scripts/st_compress_and_relaunch.sh b/scripts/st_compress_and_relaunch.sh deleted file mode 100755 index e4f7a11..0000000 --- a/scripts/st_compress_and_relaunch.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash - -source ~/.bashrc - -# Settings -PGMDIR=/dev/shm -N=250 -# If no images are found during this period (seconds), relaunch capture process -WAIT=20 -COUNT=0 -# Start automatically capture process or not -AUTOSTART=1 - -# Default camera to start imaging if no schedule is available -CAMERADEV="/dev/video1" -CAPTUREPID=0 - -# Check obsdir exists -if [ ! -d $ST_OBSDIR ]; then - mkdir $ST_OBSDIR -fi -if [ ! -d $ST_OBSDIR/control ]; then - mkdir $ST_OBSDIR/control -fi - - -# if autostart force a restart -if [ $AUTOSTART == 1 ]; then - echo "restart" >$ST_OBSDIR/control/state.txt - STATE="restart" -else - echo "stop" >$ST_OBSDIR/control/state.txt - STATE="stop" -fi - -export CAMERADEV=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((7))}'` - -echo "Status: "$STATE - -# For ever loop -while true; do - - # Get state - export STATE=`cat $ST_OBSDIR/control/state.txt` - - # Create new directory - if [ $STATE == "restart" ]; then - export DIR=`date -u +%FT%T | sed -e "s/-//g" -e "s/\://g" -e "s|T|/|g"` - mkdir -p $ST_OBSDIR/$DIR - cd $ST_OBSDIR/$DIR - echo "Moving to $ST_OBSDIR/$DIR" - echo "observing" >$ST_OBSDIR/control/state.txt - cp $ST_OBSDIR/control/position.txt . - # cp $ST_OBSDIR/control/scale.txt . - cp $ST_OBSDIR/control/camera.txt . - # Register time offset against NTP server - ntpdate -q uy.pool.ntp.org > ntpresult.txt & - export CAMERADEV=`cat $ST_OBSDIR/control/camera.txt | awk '{print $((7))}'` - # Remove old captured frames - echo "Removing all captured frames" - # ls -1 $PGMDIR/img*.pgm | awk '{printf("sudo rm -rf %s\n",$1)}' | sh - #ls -1 $PGMDIR/img*.pgm | awk '{printf("rm -rf %s\n",$1)}' | sh - find $PGMDIR -type f -name './img*.pgm' | awk '{printf("rm -rf %s\n",$1)}' | sh - fi - - # kill capture process just when scheduler sends stop signal - if [ $STATE == "stop" ]; then - if [ $(($CAPTUREPID)) != 0 ]; then - echo "" - echo "Stopping capture process" - kill -9 $CAPTUREPID - CAPTUREPID=0 - fi - fi - - # Get number of captured frames - NFILES=`ls -1 $PGMDIR/img*.pgm 2>/dev/null | wc -l` - #NFILES=`find $PGMDIR -type f -name 'img*.pgm' |wc -l` - # If enough, process - if [ $NFILES -ge $N ]; then - COUNT=0 - echo "" - echo "Compressing $N captured frames" - - # Start point - M=`ls -1 $PGMDIR/img*.pgm | head -n1 | sed -e "s/[^0-9]*//g"` - - # Run pgm2fits -# pgm2fits -p $PGMDIR/img -w 720 -h 576 -s $M -n $N - pgm2fits -p $PGMDIR/img -w 720 -h 576 -s $M -n $N >/dev/null - - # Run stviewer - stviewer `ls -1 2*.fits | tail -n1` - cp avg.pgm $ST_OBSDIR - - # Remove files - echo "" - echo "Removing $N captured frames" -# ls -1 $PGMDIR/img*.pgm | head -n$N | awk '{printf("sudo rm -rf %s\n",$1)}' | sh - ls -1 $PGMDIR/img*.pgm | head -n$N | awk '{printf("rm -rf %s\n",$1)}' | sh - #find $PGMDIR -type f -name 'img*.pgm' | head -n$N | awk '{printf("rm -rf %s\n",$1)}' | sh - -# echo "Finished" - else - # There are not enough captured frames - # Launch capture process if state is not stop - # if time passes with still no images re-launch capture process - if [ $STATE != "stop" ]; then - echo "" - echo "Waiting for frames. Status: "$STATE - COUNT=$(($COUNT+1)) - if [ $COUNT -ge $WAIT ]; then - COUNT=0 - echo "" - echo "No frames found, restarting capture script" -# sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA & - sh $ST_DATADIR/scripts/st_capture.sh $CAMERADEV & - sleep 1 - CAPTUREPID=`pgrep -o -x ffmpeg` - fi - # if restarting then relaunch capture script now - if [ $STATE == "restart" ]; then - if [ $(($CAPTUREPID)) == 0 ]; then - echo "Restarting capture script" -# sh $ST_DATADIR/scripts/st_capture.sh /dev/video-$CAMERA & - sh $ST_DATADIR/scripts/st_capture.sh $CAMERADEV & - sleep 1 - CAPTUREPID=`pgrep -o -x ffmpeg` - COUNT=0 - fi - fi - else - # we are stopped, check for bogus capture process -# echo "Status: "$STATE - if [ $(($CAPTUREPID)) != 0 ]; then - echo "Stopping capture process" - kill -9 $CAPTUREPID - CAPTUREPID=0 - fi - fi - fi - # Sleep - sleep 1 -done diff --git a/scripts/st_eog.sh b/scripts/st_eog.sh deleted file mode 100755 index cd5af9c..0000000 --- a/scripts/st_eog.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -source ~/.bashrc - -cd $ST_OBSDIR - -eog avg.pgm diff --git a/scripts/st_process_bulk.sh b/scripts/st_process_bulk.sh deleted file mode 100755 index e690e68..0000000 --- a/scripts/st_process_bulk.sh +++ /dev/null @@ -1,18 +0,0 @@ -#./bin/bash - -# Loop into every directory -for obsdir in *; do - if [ -d $obsdir ]; then - echo $obsdir - cd $obsdir - # check if observation is not already processed - N=`ls -1 ./2*.fits 2>/dev/null | wc -l` - if [ $N -ge 1 ]; then - # process observation frames in directory - st_process_offline.sh $1 - fi - cd .. - fi -done - - diff --git a/scripts/st_process_offline.sh b/scripts/st_process_offline.sh deleted file mode 100755 index a9fcc8b..0000000 --- a/scripts/st_process_offline.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Loop over files -for file in 2*.fits; do - # Run sextractor - sextractor $file -c $ST_DATADIR/sextractor/default.sex 2>/dev/null - mv test.cat $file.cat - - # Run addwcs - if [ -z $1 ]; then - addwcs -f $file -r test.fits - else - echo "Limiting magnitude of star catalog to $1" - addwcs -f $file -r test.fits -m $1 - fi - - # Run satid - satid $file $file.png/png 2>/dev/null - - # Move calibrated file - mv $file.cat $file.cal $file.id $file $file.png png/ -done - diff --git a/scripts/st_process_online.sh b/scripts/st_process_online.sh deleted file mode 100755 index e9389b8..0000000 --- a/scripts/st_process_online.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# For ever loop -while true; do - # Get number of files - NFILES=`ls -1 2*.fits 2>/dev/null | wc -l` - - # If enough, process - if [ $NFILES -gt 0 ]; then - - # Get file name - FILE=`ls -1 2*.fits | head -n1` - sleep 1 - - # Run sextractor - sextractor $FILE -c $ST_DATADIR/sextractor/default.sex 2>/dev/null - mv test.cat $FILE.cat - - # Run addwcs - addwcs -f $FILE -r test.fits - - # Run satid - satid $FILE $FILE.png/png 2>/dev/null - - - # Move calibrated file - mv $FILE $FILE.cat $FILE.cal $FILE.png $FILE.id $FILE.det png/ 2>/dev/null - fi - sleep 1 -done diff --git a/scripts/st_reduce.sh b/scripts/st_reduce.sh deleted file mode 100755 index e029003..0000000 --- a/scripts/st_reduce.sh +++ /dev/null @@ -1 +0,0 @@ -for file in png/2*.fits; do reduce $file;done diff --git a/scripts/st_ristretto.sh b/scripts/st_ristretto.sh deleted file mode 100755 index 4f6a882..0000000 --- a/scripts/st_ristretto.sh +++ /dev/null @@ -1 +0,0 @@ -ristretto png/*.png diff --git a/scripts/st_runsched.sh b/scripts/st_runsched.sh deleted file mode 100755 index a1b7ac5..0000000 --- a/scripts/st_runsched.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -source ~/.bashrc - -cd $ST_DATADIR - -runsched