diff options
author | Stijn Buys <ingar@telenet.be> | 2025-10-04 22:10:28 +0200 |
---|---|---|
committer | Stijn Buys <ingar@telenet.be> | 2025-10-04 22:10:28 +0200 |
commit | 615be09a2630363070acefd2b47f5745c74a3813 (patch) | |
tree | d4ef5980d07bf1d3ec0d7fa998b6dae5923711d8 |
-rw-r--r-- | scripts/EKOS_Multi_Masters.ssf | 43 | ||||
-rw-r--r-- | scripts/EKOS_Multi_Session_Preprocess.ssf | 48 | ||||
-rw-r--r-- | scripts/EKOS_Multi_Session_Stack.ssf | 40 | ||||
-rw-r--r-- | scripts/EKOS_OSC_Preprocessing.ssf | 68 | ||||
-rw-r--r-- | scripts/EKOS_Preprocessing_WithDrizzle.ssf | 75 | ||||
-rwxr-xr-x | siril-cli-extractHaOIII | 105 | ||||
-rwxr-xr-x | siril-cli-multisession | 321 |
7 files changed, 700 insertions, 0 deletions
diff --git a/scripts/EKOS_Multi_Masters.ssf b/scripts/EKOS_Multi_Masters.ssf new file mode 100644 index 0000000..e3c781b --- /dev/null +++ b/scripts/EKOS_Multi_Masters.ssf @@ -0,0 +1,43 @@ +############################################ +# +# Script for Siril 1.2 +# +############################################ + +# +# Script to create a set of dark and bias masters +# for an EKOS multi-session project +# +# Required directory structure: +# +# [ Home ] +# /Bias +# /Dark +# +# Masters will be saved to +# +# /Master +# +# Temporary files will be saved to +# +# /process + +requires 1.2.0 + +# Convert Dark Frames to .fit files +cd Dark +convert dark -out=../process +cd ../process + +# Stack Dark Frames to master_dark.fit +stack dark rej 3 3 -nonorm -out=../Master/master_dark +cd .. + +# Convert Bias Frames to .fit files +cd Bias +convert bias -out=../process +cd ../process + +# Stack Bias Frames to master_bias.fit +stack bias rej 3 3 -nonorm -out=../Master/master_bias +cd .. diff --git a/scripts/EKOS_Multi_Session_Preprocess.ssf b/scripts/EKOS_Multi_Session_Preprocess.ssf new file mode 100644 index 0000000..52a57e2 --- /dev/null +++ b/scripts/EKOS_Multi_Session_Preprocess.ssf @@ -0,0 +1,48 @@ +############################################ +# +# Script for Siril 1.2 +# +############################################ + +# +# Script to create a set of dark and bias masters +# for an EKOS multi-session project +# +# Required directory structure: +# +# [ Session Home ] +# /Flat +# /Light +# +# Preprocessed files will be written to +# +# /process/session_pp_light*.fits +# +# Temporary files will be saved to +# +# /process + +requires 1.2.0 + +# Convert Flat Frames to .fit files +cd Flat +convert flat -out=../process +cd ../process + +# Pre-process Flat Frames +calibrate flat -bias=../../Master/master_bias + +# Stack Flat Frames to master_flat_session.fit +stack pp_flat rej 3 3 -norm=mul -out=master_flat_session +cd .. + +# Convert Light Frames to .fit files +cd Light +convert light -out=../process +cd ../process + +# Pre-process Light Frames +calibrate light -dark=../../Master/master_dark -flat=master_flat_session -cfa -cc=dark -equalize_cfa -debayer -prefix=session_pp_ + +cd .. +close diff --git a/scripts/EKOS_Multi_Session_Stack.ssf b/scripts/EKOS_Multi_Session_Stack.ssf new file mode 100644 index 0000000..0cfd9ba --- /dev/null +++ b/scripts/EKOS_Multi_Session_Stack.ssf @@ -0,0 +1,40 @@ +############################################ +# +# Script for Siril 1.2 +# +############################################ + +# +# Script to create a set of dark and bias masters +# for an EKOS multi-session project +# +# Required directory structure: +# +# [ Home ] +# /Preprocess +# +# Temporary files will be saved to +# +# /process + +requires 1.2.0 + +# Convert Light Frames to .fit files +cd Preprocess +convert preprocess -out=../process +cd ../process + +# Align lights +register preprocess -2pass -noout -drizzle -nostarlist +seqapplyreg preprocess -drizzle -framing=min + +# Stack calibrated lights to result.fit +stack r_preprocess rej 3 3 -norm=addscale -output_norm -rgb_equal -out=result + +# and flipping if required +load result +mirrorx -bottomup +save ../result_drizzle_$LIVETIME:%d$s + +cd .. +close diff --git a/scripts/EKOS_OSC_Preprocessing.ssf b/scripts/EKOS_OSC_Preprocessing.ssf new file mode 100644 index 0000000..991ea14 --- /dev/null +++ b/scripts/EKOS_OSC_Preprocessing.ssf @@ -0,0 +1,68 @@ +############################################ +# +# Script for Siril 1.0 +# July 2020 +# (C) Cyril Richard +# Preprocessing v1.0 +# +########### PREPROCESSING SCRIPT ########### +# +# Script for color camera preprocessing +# +# Needs 4 sets of RAW images in the working +# directory, within 4 directories: +# biases/ +# flats/ +# darks/ +# lights/ +# +############################################ + +requires 0.99.4 + +# Convert Bias Frames to .fit files +cd Bias +convert bias -out=../process +cd ../process + +# Stack Bias Frames to bias_stacked.fit +stack bias rej 3 3 -nonorm +cd .. + +# Convert Flat Frames to .fit files +cd Flat +convert flat -out=../process +cd ../process + +# Pre-process Flat Frames +preprocess flat -bias=bias_stacked + +# Stack Flat Frames to pp_flat_stacked.fit +stack pp_flat rej 3 3 -norm=mul +cd .. + +# Convert Dark Frames to .fit files +cd Dark +convert dark -out=../process +cd ../process + +# Stack Dark Frames to dark_stacked.fit +stack dark rej 3 3 -nonorm +cd .. + +# Convert Light Frames to .fit files +cd Light +convert light -out=../process +cd ../process + +# Pre-process Light Frames +preprocess light -dark=dark_stacked -flat=pp_flat_stacked -cfa -equalize_cfa -debayer + +# Align lights +register pp_light + +# Stack calibrated lights to result.fit +stack r_pp_light rej 3 3 -norm=addscale -output_norm -out=../result + +cd .. +close diff --git a/scripts/EKOS_Preprocessing_WithDrizzle.ssf b/scripts/EKOS_Preprocessing_WithDrizzle.ssf new file mode 100644 index 0000000..06a531d --- /dev/null +++ b/scripts/EKOS_Preprocessing_WithDrizzle.ssf @@ -0,0 +1,75 @@ +############################################ +# +# Script for Siril 1.2 +# February 2023 +# (C) Cyril Richard +# OSC_Preprocessing_WithDrizzle v1.3 +# +########### PREPROCESSING SCRIPT ########### +# +# Script for color camera preprocessing +# aligning using Drizzle 2x +# +# Needs 4 sets of RAW images in the working +# directory, within 4 directories: +# biases/ +# flats/ +# darks/ +# lights/ +# Saves masters to ./masters/ +# +############################################ + +requires 1.2.0 + +# Convert Bias Frames to .fit files +cd Bias +convert bias -out=../process +cd ../process + +# Stack Bias Frames to bias_stacked.fit +stack bias rej 3 3 -nonorm -out=../masters/bias_stacked +cd .. + +# Convert Flat Frames to .fit files +cd Flat +convert flat -out=../process +cd ../process + +# Calibrate Flat Frames +calibrate flat -bias=../masters/bias_stacked + +# Stack Flat Frames to pp_flat_stacked.fit +stack pp_flat rej 3 3 -norm=mul -out=../masters/pp_flat_stacked +cd .. + +# Convert Dark Frames to .fit files +cd Dark +convert dark -out=../process +cd ../process + +# Stack Dark Frames to dark_stacked.fit +stack dark rej 3 3 -nonorm -out=../masters/dark_stacked +cd .. + +# Convert Light Frames to .fit files +cd Light +convert light -out=../process +cd ../process + +# Calibrate Light Frames +calibrate light -dark=../masters/dark_stacked -flat=../masters/pp_flat_stacked -cc=dark -cfa -equalize_cfa -debayer + +# Align lights with Drizzle 2x +register pp_light -drizzle + +# Stack calibrated lights to result.fit +stack r_pp_light rej 3 3 -norm=addscale -output_norm -rgb_equal -out=result + +# and flipping if required +load result +mirrorx -bottomup +save ../result_drizzle_$LIVETIME:%d$s + +cd .. +close diff --git a/siril-cli-extractHaOIII b/siril-cli-extractHaOIII new file mode 100755 index 0000000..a370455 --- /dev/null +++ b/siril-cli-extractHaOIII @@ -0,0 +1,105 @@ +#!/bin/sh + +# Shell script to extra Ha and OIII data from smallband images + +# ------------------------------------------------------------------ +# CONFIGURATION + +# Directory names +LIGHTDIR=Light +FLATDIR=Flat +DARKDIR=Dark +BIASDIR=Bias +MASTERDIR=Master +CALIBRATEDDIR=Calibrated +PROCESSDIR=Process + +# Output file names +MASTERDARK=master_dark +MASTERBIAS=master_bias +MASTERFLAT=master_flat + +# Framing style +# --framing=[cog|max|min] +OPT_FRAMING=min + +# ------------------------------------------------------------------ +# COMMAND LINE OPTIONS + +while [ ! -z "$1" ]; do + + case "$1" in + -f | --framing) + shift + OPT_FRAMING=$1 + echo "Framing ${OPT_FRAMING}" + shift + ;; + *) + echo "Invalid option $1" + exit 1; + ;; + esac +done + +# ------------------------------------------------------------------ +# SAFETY CHECK + +if [ ! -d "${PROCESSDIR}" ]; then + echo "${PROCESSDIR} directory does not exist!" + exit 1 +fi + +# ------------------------------------------------------------------ +# EXTRACT Ha AND OIII + + +# ------------------------------------------------------------------ +# REGISTER LIGHTS + +echo "------------------------------------------------------------------" +echo "Extracting Ha and OIII" +#notify-send "${NOTIFICATIONTITLE}" "Extracting Ha and OIII" + +siril-cli -d . -s - <<ENDSIRILEXTRACT + +requires 1.3.4 + +cd ${PROCESSDIR} + +# Extract Ha and OIII +seqextract_HaOIII preprocess -resample=ha + +# Align Ha lights +register Ha_preprocess + +# Stack calibrated Ha lights to Ha_stack (temporary) +stack r_Ha_preprocess rej 3 3 -norm=addscale -output_norm -32b -out=results_00001 + +# and flip if required +mirrorx_single results_00001 + +# Align OIII lights +register OIII_preprocess + +# Stack calibrated OIII lights to OIII_stack (temporary) +stack r_OIII_preprocess rej 3 3 -norm=addscale -output_norm -32b -out=results_00002 + +# and flip if required +mirrorx_single results_00002 + +# Align the result images, small shifts and chromatic aberrations can occur +register results -transf=shift -interp=none + +# Renorm OIII to Ha using PixelMath +pm \$r_results_00002\$*mad(\$r_results_00001\$)/mad(\$r_results_00002\$)-mad(\$r_results_00001\$)/mad(\$r_results_00002\$)*median(\$r_results_00002\$)+median(\$r_results_00001\$) +save ../result_OIII_\$LIVETIME:%d\$s + +# Save Ha final result +load r_results_00001 +save ../result_Ha_\$LIVETIME:%d\$s + +ENDSIRILEXTRACT + +notify-send -a "Siril" "Extracting Ha and OIII (Finished)" + diff --git a/siril-cli-multisession b/siril-cli-multisession new file mode 100755 index 0000000..ecf0593 --- /dev/null +++ b/siril-cli-multisession @@ -0,0 +1,321 @@ +#!/bin/sh + +# Shell script to stack the data from multiple EKOS sessions. +# It is intended to be used on data from a cooled camera, +# and uses a common set of darks and biases for all sessions. +# +# It assumes dithering and uses the drizzle algorithm. +# +# Required directory structure: +# +# [Working Directory] +# +# \ Master Master dark and bias frames, if they already exists, they take precedence over dark and bias frames. +# If the masters are absent, they are created from the dark end bias frames. +# \ Dark Dark calibration frames, used for all sessions +# \ Bias Biases calibration frames, used for all sessions +# +# \ Session[name] +# \ Flat Flat frames for this sessions +# \ Light Light frames for this session +# \ Master (optional) Master dark and bias frames for this session, +# if found they take precendence over the global masters. +# +# Output: +# +# \ Process +# \ Calibrated Calibrated light frames created from all sessions +# \ Session[name] Per-session preprocessed files +# +# result_xxx.fits Stacked output + +# ------------------------------------------------------------------ +# CONFIGURATION + +# Directory names +LIGHTDIR=Light +FLATDIR=Flat +DARKDIR=Dark +BIASDIR=Bias +MASTERDIR=Master +CALIBRATEDDIR=Calibrated +PROCESSDIR=Process + +# Output file names +MASTERDARK=master_dark +MASTERBIAS=master_bias +MASTERFLAT=master_flat + +# Framing style +# --framing=[cog|max|min] +OPT_FRAMING=min + +# ------------------------------------------------------------------ +# COMMAND LINE OPTIONS + +while [ ! -z "$1" ]; do + + case "$1" in + -f | --framing) + shift + OPT_FRAMING=$1 + echo "Framing ${OPT_FRAMING}" + shift + ;; + *) + echo "Invalid option $1" + exit 1; + ;; + esac +done + +# ------------------------------------------------------------------ +# SAFETY CHECK + +if [ -d "${PROCESSDIR}" ]; then + echo "${PROCESSDIR} directory already exists!" + exit 1 +fi + +# ------------------------------------------------------------------ +# CREATE MASTER DARK + +masterdarkdir="${MASTERDIR}/${DARKDIR}" +masterdarkfile="${MASTERDIR}/${MASTERDARK}.fits" + +echo "------------------------------------------------------------------" +if [ -r "${masterdarkfile}" ]; then + echo "Using master dark ${masterdarkfile}" +else + if [ ! -d "${masterdarkdir}" ]; then + echo "Couldn't find ${masterdarkdir}"; + exit 1 + fi + + echo "Creating master dark ${masterdarkfile}" + #notify-send "${NOTIFICATIONTITLE}" "Creating master dark ${masterdarkfile}" + + siril-cli -d . -s - <<ENDSIRILDARK +requires 1.2.0 + +# Convert Dark Frames to .fit files +cd ${masterdarkdir} +convert dark -out=../../${PROCESSDIR} +cd ../../${PROCESSDIR} + +# Stack Dark Frames to master_dark.fit +stack dark rej 3 3 -nonorm -out=../${MASTERDIR}/${MASTERDARK} +cd .. + +close + +ENDSIRILDARK + +fi + +# ------------------------------------------------------------------ +# CREATE MASTER BIAS + +masterbiasdir="${MASTERDIR}/${BIASDIR}" +masterbiasfile="${MASTERDIR}/${MASTERBIAS}.fits" + +echo "------------------------------------------------------------------" +if [ -r "${masterbiasfile}" ]; then + echo "Using master bias ${masterbiasfile}" +else + if [ ! -d "${masterbiasdir}" ]; then + echo "Couldn't find ${masterbiasdir}"; + exit 1 + fi + + echo "Creating master bias ${masterbiasfile}" + #notify-send "${NOTIFICATIONTITLE}" "Creating master bias ${masterbiasfile}" + + siril-cli -d . -s - <<ENDSIRILBIAS +requires 1.2.0 + +# Convert Bias Frames to .fit files +cd ${masterbiasdir} +convert bias -out=../../${PROCESSDIR} +cd ../../${PROCESSDIR} + +# Stack Bias Frames to master_bias.fit +stack bias rej 3 3 -nonorm -out=../${MASTERDIR}/${MASTERBIAS} +cd .. + +close + +ENDSIRILBIAS + +fi + +# ------------------------------------------------------------------ +# CREATE OUTPUT DIRECTORY + +mkdir -p "${PROCESSDIR}/${CALIBRATEDDIR}" + +# ------------------------------------------------------------------ +# CREATE SESSION FLAT +# CALIBRATE SESSIONS LIGHTS + +# Create calibrated light frames for each session +for session in `find -maxdepth 1 -type d -iname "session*"`; do + + sessionname=`basename "${session}"` + + echo "------------------------------------------------------------------" + echo "Preprocessing session ${sessionname}" + #notify-send "${NOTIFICATIONTITLE}" "Preprocessing session ${sessionname}" + + sessionlightdir="${sessionname}/${LIGHTDIR}" + sessionflatdir="${sessionname}/${LIGHTDIR}" + + if [ ! -d "${sessionlightdir}" ]; then + echo "Couldn't find ${sessionlightdir}" + exit 1; + fi + + if [ ! -d "${sessionflatdir}" ]; then + echo "Couldn't find ${sessionflatdir}" + exit 1; + fi + + cd "${sessionname}" + + SESSIONDARK="${MASTERDIR}/${MASTERDARK}" + if [ -r "${SESSIONDARK}.fits" ]; then + SESSIONDARK="../../${sessionname}/${SESSIONDARK}" + echo "Using session master dark for ${sessionname}" + + else + SESSIONDARK="../../${MASTERDIR}/${MASTERDARK}" + fi + + SESSIONBIAS="${MASTERDIR}/${MASTERBIAS}" + if [ -r "${SESSIONBIAS}.fits" ]; then + SESSIONBIAS="../../${sessionname}/${SESSIONBIAS}" + echo "Using session master bias for ${sessionname}" + else + SESSIONBIAS="../../${MASTERDIR}/${MASTERBIAS}" + fi + + SESSIONFLAT="${MASTERDIR}/${MASTERFLAT}" + if [ -r "${SESSIONFLAT}.fits" ]; then + SESSIONFLAT="../../${sessionname}/${SESSIONFLAT}" + echo "Using session master flat for ${sessionname}" + else + echo "------------------------------------------------------------------" + echo "Creating master flat for session ${sessionname}" + + siril-cli -d . -s - <<ENDSIRILFLAT + +requires 1.2.0 + +# Convert Flat Frames to .fit files +cd ${FLATDIR} +convert flat -out=../../${PROCESSDIR}/${sessionname} +cd ../../${PROCESSDIR}/${sessionname} + +# Pre-process Flat Frames +calibrate flat -bias=${SESSIONBIAS} + +# Stack Flat Frames to session_flat.fits +stack pp_flat rej 3 3 -norm=mul -out=${MASTERFLAT} + +cd ../../${sessionname} +close + +ENDSIRILFLAT + + SESSIONFLAT="../../${sessionname}/${SESSIONFLAT}" + + if [ ! -d "${MASTERDIR}" ]; then + mkdir "${MASTERDIR}" + fi + + cp -v "../${PROCESSDIR}/${sessionname}/${MASTERFLAT}.fits" "${MASTERDIR}" + fi + + echo "------------------------------------------------------------------" + echo "Calibrating lights for session ${sessionname}" + + siril-cli -d . -s - <<ENDSIRILLIGHT + +requires 1.2.0 + +# Convert Light Frames to .fit files +cd ${LIGHTDIR} +convert light -out=../../${PROCESSDIR}/${sessionname} +cd ../../${PROCESSDIR}/${sessionname} + +# Calibrate light frames +calibrate light -dark=${SESSIONDARK} -flat=${SESSIONFLAT} -cfa -cc=dark -equalize_cfa -prefix=${sessionname}_pp_ + +cd ../../${sessionname} +close + +ENDSIRILLIGHT + + # move calibrated files + + echo "------------------------------------------------------------------" + cd .. + mv -v ${PROCESSDIR}/${sessionname}/${sessionname}_pp_*.fits ${PROCESSDIR}/${CALIBRATEDDIR}/ +done + +# ------------------------------------------------------------------ +# REGISTER LIGHTS + +echo "------------------------------------------------------------------" +echo "Registering calibrated lights" +#notify-send "${NOTIFICATIONTITLE}" "Registering calibrated lights" + +siril-cli -d . -s - <<ENDSIRILREGISTER + +requires 1.2.0 + +# Convert Light Frames to .fit files +cd ${PROCESSDIR}/${CALIBRATEDDIR} +convert preprocess -out=../ +cd ../ + +# Register lights + +# extra options: -2pass -nostarlist (find reference image) +register preprocess -drizzle -2pass -nostarlist +# extra options --framing=[cog|max|min] +seqapplyreg preprocess -drizzle -framing=${OPT_FRAMING} + +cd .. +close + +ENDSIRILREGISTER + +# ------------------------------------------------------------------ +# STACK LIGHTS + +echo "------------------------------------------------------------------" +echo "Stacking calibrated lights" +#notify-send "${NOTIFICATIONTITLE}" "Stacking calibrated lights" + +siril-cli -d . -s - <<ENDSIRILSTACK + +requires 1.2.0 + +cd ${PROCESSDIR} + +# Stack calibrated lights to result.fits +stack r_preprocess rej 3 3 -norm=addscale -output_norm -rgb_equal -out=result + +# mirror the result +load result +mirrorx -bottomup +save ../result_drizzle_${OPT_FRAMING}_\$LIVETIME:%d\$s + +cd .. +close + +ENDSIRILSTACK + +notify-send -a "Siril" "Stacking (Finished)" + |