diff --git a/Auxiliary_utils/bash_scripts/allsky_sixel.sh b/Auxiliary_utils/bash_scripts/allsky_sixel.sh new file mode 100755 index 0000000..09bf2bc --- /dev/null +++ b/Auxiliary_utils/bash_scripts/allsky_sixel.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# +# $1 - scaling factor (in percents) of the image +# + +scale=50 +if [ $# -gt 0 ]; then + scale=$1 +fi + +unset http_proxy + +clear +while [[ 1 ]]; do + tput cup 0 0 + curl -s http://zarch.sao.ru/webcam/mirat_allsky.cgi | magick - -colors 256 +dither -normalize -resize $scale% sixel:- +# sleep 30s + sleep 5s +done diff --git a/Auxiliary_utils/bash_scripts/allsky_sixel_weather.sh b/Auxiliary_utils/bash_scripts/allsky_sixel_weather.sh new file mode 100755 index 0000000..01b3cb5 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/allsky_sixel_weather.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# +# $1 - scaling factor (in percents) of the image +# + +function get_val { + echo $(echo $1 | cut -d "=" -f 2 | cut -d "." -f 1) +} + +white_col="\e[97m" +red_col="\e[1m\e[31m" +end_col="\e[0m" +last_row=0 + +scale=50 +if [ $# -gt 0 ]; then + scale=$1 +fi + +unset http_proxy + +im_sleep=20 # in secs +info_sleep=180 # in secs + +n_info=$((info_sleep/im_sleep)) + + + +clear +while [[ 1 ]]; do + # weather info + m_old=($(curl 192.168.70.33:12345 2>/dev/null)// / ) + rain=${m_old[0]} + clouds=${m_old[1]} + temp=${m_old[2]} + + m_new=($(curl localhost:3333/stat3600 2>/dev/null | sed 's/[\x01-\x1F\x7F]//g')// / ) + windmax=${m_new[0]} + m_new=($(curl localhost:3333 2>/dev/null | sed 's/[\x01-\x1F\x7F]//g')// / ) + wind=${m_new[0]} + humi=${m_new[4]} + + rain_col=$white_col + clouds_col=$white_col + humi_col=$white_col + wind_col=$white_col + wind_max_col=$white_col + + let rain_flag=$(get_val $rain) + if [[ $rain_flag -eq 1 ]]; then + rain_col=$red_col + fi + + let clouds_val=$(get_val $clouds) + if [[ $clouds_val -le 1500 ]]; then + clouds_col=$red_col + + fi + + let humi_val=$(get_val $humi) + if [[ $humi_val -ge 90 ]]; then + humi_col=$red_col + fi + + let wind_val=$(get_val $wind) + if [[ $wind_val -ge 10 ]]; then + wind_col=$red_col + fi + + let wind_max_val=$(get_val $windmax) + if [[ $wind_max_val -ge 10 ]]; then + wind_max_col=$red_col + fi + + ncols=`tput cols` + start_col=$((ncols-25)) + + tput cup $last_row $start_col +# echo -e "\e[4m`date`:\e[0m" + echo -e "\e[4m`date +'%F %T'`:\e[0m" + + ((++last_row)) + + tput cup $last_row $start_col + echo -e "$clouds_col$clouds $rain_col($rain)$end_col" + + ((++last_row)) + + tput cup $last_row $start_col +# echo -e "$temp $humi_col($humi)$end_col" + temp_val=`printf "%.1f" ${temp#*=}` + echo -e "Temp=$temp_val, ${humi_col}Hum=$humi_val%$end_col" + + ((++last_row)) + + tput cup $last_row $start_col +# echo -e "$wind_col$wind $wind_max_col($windmax @hour)$end_col\n" + wind_max_val=`printf "%.1f" ${windmax#*=}` + echo -e "$wind_col$wind $wind_max_col(Max=$wind_max_val/hour)$end_col\n" + + IFS='[;' read -p $'\e[6n' -d R -rs _ last_row col _ + + # allsky image + + for i in `seq $n_info`; do + tput cup 0 0 + curl -s http://zarch.sao.ru/webcam/omea_allsky.cgi | magick - -colors 256 -normalize +dither -resize $scale% sixel:- +# curl -s http://zarch.sao.ru/webcam/mirat_allsky.cgi | magick - -colors 256 -resize $scale% sixel:- + sleep ${im_sleep}s + done + + +done diff --git a/Auxiliary_utils/bash_scripts/copy_and_xz.sh b/Auxiliary_utils/bash_scripts/copy_and_xz.sh new file mode 100755 index 0000000..9399230 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/copy_and_xz.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# +# $1 - directory to be copied +# + +RDIR="/home/obs/robotel1_2025" + +# copy non-FITS files +tar c --exclude='*.fit' --exclude='*shit*' $1 | ssh obs@roboserv "tar x -C $RDIR" +#tar c --exclude='*.fit' --exclude='*shit*' $1 | ssh obs@roboserv "tar x -C /home/obs/robotel1_2023" + +# copy FITS files and XZ-ing it on remote server +CMD='sh -c "xz -6e -T0 - > $TAR_FILENAME.xz"' +tar c $1/*.fit | ssh obs@roboserv "cd $RDIR; tar x --to-command='$CMD'" +#tar c $1/*.fit | ssh obs@roboserv "cd /home/obs/robotel1_2023; tar x --to-command='$CMD'" + +ssh obs@roboserv "cd $RDIR; tar c $1 | ssh data@robostorage 'tar x -C /mnt/ARCHIVE/ROBOTEL1/'" diff --git a/Auxiliary_utils/bash_scripts/run_full.new_foc b/Auxiliary_utils/bash_scripts/run_full.new_foc new file mode 100755 index 0000000..e95398a --- /dev/null +++ b/Auxiliary_utils/bash_scripts/run_full.new_foc @@ -0,0 +1,165 @@ +#!/bin/bash +RA="17:17:08.86" +DEC="+67:57:11.4" +OBJ="GALEX171708.5" +EXPTIME=31000 +FLATTIME=40000 +OBS="Fatkhullin T.A." +BADWEATHER=1300 +DATEEND=$(sunrise 14) +# focus each N seconds +FOCUST=7200 + +FNO=1 +FDATE=0 + +# +# NOTE: THIS IS A NEW VERSION OF THE OBSERVATION SCRIPT! +# CHAGLELOG: +# Oct 2024: replace focussing algorithm (T. Fatkhullin) +# At the night start the first focussing run +# uses of two-step algorithm: +# 1) rough focus astimation along full season-to-season +# focus range (as it was implemented in the old obs. script) +# 2) precise focussing along narrow range computed from +# previous rough estimation +# Next focussing runs compute range from the current focus value. +# (new function 'focustel_new') +# +# May 2025: rewrite detection of running this script process (T. Fatkhullin) +# (use of '-c' commandline option for 'pgrep' command) + +function focustel_new(){ + rm focus*.fit 2>/dev/null + echo "Focussing..." + + let fno=$1 + if [[ $fno -gt 1 ]]; then + let curr_foc=`fli_control | tail -n 5 | head -n 1 | cut -d "=" -f 2` + let lowf=$curr_foc-1500 + let highf=$curr_foc+1500 + focus_seq_FLI.py -v -c focus$(printf "%02d" $1).jpg $lowf $highf 500 + + if [[ $? -ne 0 ]]; then + echo -e "\nFOCUSSING SCRIPT RETURNED: $?" + echo -e "SOMETHING WAS WRONG IN FOCUSSING SEQUENCE!!! SET FOCUS TO PREVIOUS VALUE!!\n" + fli_control -g $curr_foc + fi + else + focus_seq_FLI.py --guess -v -N 7 -c focus$(printf "%02d" $1).jpg 47000 60000 500 + fi + + FDATE=$(date +%s) +} + +function sendcmd(){ + echo $1 | nc 192.168.70.33 10001 -q10 +} + +function point_tel(){ + touch lastpointing + send_coords -r $1 -d $2 +} + +#c=$(pgrep run_full | wc -l) +# $ will run another run_full, so c=2 for single run +#if [[ $c -gt 1 ]]; then +# echo "Another process is running; exiting" +# exit 1 +#fi + +if [[ $(pgrep -c run_full) -gt 1 ]]; then + echo "Another process is running! Exit!" + exit 1 +fi + +export http_proxy="" + +# set lower limit to 5degr +send_command2mount ":So5#" + +echo "Time diff: $(($DATEEND-$(date +%s)))" +if [ $(($DATEEND-$(date +%s))) -lt 3600 ]; then + echo "There's less an hour for observation!" + exit 2 +fi + +if [ $(($DATEEND-$(date +%s))) -gt 53200 ]; then + echo "There's more than 12 hours till closing, check script data!" + exit 3 +fi + +#STARTobs + +#send_coords +#echo "Wait a little" +#sleep 10 + +echo "GoTo object: ${RA} ${DEC}" +send_coords -r${RA} -d${DEC} + +echo "Start taking object" + +badweather=0 +while true; do + now=$(date +%s) + ANS=$(curl localhost:55555/status 2>/dev/null) + echo "Dome status: $ANS" + if [ $ANS != "opened" ]; then + echo "Closed" + curl localhost:55555/weather 2>/dev/null > DomeClosed + break; + fi + chkweather ${BADWEATHER} > lastweather && badweather=0 || badweather=$((badweather+1)) + [ $badweather -gt 5 ] && break + [ -f stopobs ] && break + [ -f exitjob ] && exit 0 + if [ "$now" -lt "$DATEEND" ]; then + est=$(sendcmd ":Gmte#"|sed -e 's/^0*//' -e 's/#//') + echo -e "\n\n\n\n\nEstimated time to flip: $est minutes" + if [[ ("x$est" == "x") || ($est -lt 3) ]]; then + point_tel "${RA}" "${DEC}" + continue + fi + ST=$(send_coords | awk '{print $4}') + [ "x$ST" == "x" ] && break + if [ $ST -ne "0" ]; then + point_tel "${RA}" "${DEC}" + continue + else + [ $(($(date +%s) - $FDATE)) -gt $FOCUST ] && focustel_new $((FNO++)) +# [ $(($(date +%s) - $FDATE)) -gt $FOCUST ] && focustel $((FNO++)) + preflash + fli_control -r /tmp/10micron.fitsheader -x $EXPTIME -N "${OBS}" -O "${OBJ}" "$OBJ" + fi + else + break + fi +done + +echo "Dome closed @ $(date)" >> closed +curl localhost:55555/close + +relay_manage -s1 +park_telescope + +for x in $(seq 1 10); do + preflash + fli_control -r /tmp/10micron.fitsheader -x1 -N "${OBS}" -O "bias" -d bias + preflash + fli_control -r /tmp/10micron.fitsheader -x $EXPTIME -N "${OBS}" -O "dark" -d dark + preflash + fli_control -r /tmp/10micron.fitsheader -n3 -x $FLATTIME -N "${OBS}" -O "flat" flat +done + +relay_manage -r1 +echo "Closed @ $(date)" >> closed + +STOPobs || true + +DIR=$(basename $PWD) +echo "TAR: $DIR" +cd .. +./copy_and_xz.sh $DIR +echo "Archived, end" +echo "$DIR archived @ $(date)" >> archived diff --git a/Auxiliary_utils/bash_scripts/setup_obs.sh b/Auxiliary_utils/bash_scripts/setup_obs.sh new file mode 100755 index 0000000..fc4a6a6 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/setup_obs.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# +# The script creates working directory, +# copies 'run' script into it and +# edits observer name according to +# the its argument +# +# Working directory name is formed from +# date of the script running and is computed +# as follows: +# now - 12hours +# i.e. the day starts from 12h not from 0h! +# +# $1 - observer name +# + +if [[ $# -eq 0 ]]; then + obs_name="Fatkhullin T.A." +else + obs_name=$1 +fi + +# now - 12h +let now12=`date +%s`-12*3600 + +# working directory +wdir=/DATA/FITS/`date -d @$now12 +%y.%m.%d` + +echo -n "Creating working directory: $wdir ..." +if [[ -d $wdir ]]; then + echo -e "\tFAILED! The directory already exists! Exit!" + exit 1 +else + echo -e "\tOK!" + mkdir $wdir + cd $wdir +fi + +cp ../run_full.new_foc . + +# replace observer name +sed -i "0,/^OBS=\".*\"/ s//OBS=\"${obs_name}\"/" run_full.new_foc +#sed -i "0,/^OBS=\"[a-zA-Z \.]*\"/ s//OBS=\"${obs_name}\"/" run_full.new_foc diff --git a/Auxiliary_utils/bash_scripts/video2dome1-2.sh b/Auxiliary_utils/bash_scripts/video2dome1-2.sh new file mode 100755 index 0000000..7de9761 --- /dev/null +++ b/Auxiliary_utils/bash_scripts/video2dome1-2.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +mpv -vo sixel --really-quiet=yes "rtsp://viewer:view25@192.168.70.25:554/axis-media/media.amp?videocodec=h264&resolution=640x480"