Remove unused scripts
parent
247c13552c
commit
f30219c47c
|
@ -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
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source ~/.bashrc
|
||||
|
||||
cd $ST_OBSDIR
|
||||
|
||||
eog avg.pgm
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -1 +0,0 @@
|
|||
for file in png/2*.fits; do reduce $file;done
|
|
@ -1 +0,0 @@
|
|||
ristretto png/*.png
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source ~/.bashrc
|
||||
|
||||
cd $ST_DATADIR
|
||||
|
||||
runsched
|
Loading…
Reference in New Issue