×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

Import masters in Dark library?

  • Posts: 37
  • Thank you received: 4
Hi everyone. Is there any way (or trick) to import my master darks into the Dark Library? E.g., my guider camera doesn't have a shutter and I find uncomfortable to manually have to cover the guidescope every once in a while (sometimes in the middle of a guiding session, when temperature change exceeds the threshold, I guess).

Thanks!
5 years 8 months ago #27557

Please Log in or Create an account to join the conversation.

Well, manually you can add the master dark to ~/.local/share/kstars/darks and then edit ~/.local/share/kstars/userdb.sqlite in an SQL Editor to add a new record to the darklibrary table.
The following user(s) said Thank You: Sergio
5 years 8 months ago #27562

Please Log in or Create an account to join the conversation.

  • Posts: 37
  • Thank you received: 4
Hi there,

just if anyone is interested: I used this bash script (on Ubuntu Bionic) to import a (master) dark to the Darks Library, following Jasem's tip of handling directly the sqlite database. Sorry, no warranty provided.

It assumes that the FITS file has some keywords (INSTRUME, XBINNING, YBINNING, EXPTIME) with the correct values (and that it has the correct bit depth, etc.), so you only have to input the path to the filename, and the temperature value (my guide camera doesn't provide it). Copy the code below and save with filename import-dark.sh. You should then give execution permission to the file: $ chmod u+x import-dark.sh

To import a dark: $ <path.to>/import-dark.sh <filename> <temperature>

After importing you may have to hit "Refresh" on the Dark Library configuration page on KStars to actually see the new row.

Hope it helps.

#!/bin/bash
#
# Requires package 'sqlite': $ sudo apt install sqlite
# Requires package 'astropy-utils': $ sudo apt install astropy-utils
# Requires 'readlink -e' command
 
 
if [[ -z "$1" || -z "$2" ]] ; then
  echo "Usage: import-dark.sh <filename> <temperature>"
  exit 1
fi
 
TIMESTAMP=`date +"%Y-%m-%d %H:%M:%S"`
echo "Timestamp: $TIMESTAMP (now)"
 
TEMP=$2
echo "Temperature: $TEMP (ºC, provided as argument)"
 
SOURCE=$(readlink -e "$1")
BASENAME=$(basename "$1")
FILENAME="$HOME/.local/share/kstars/darks/$BASENAME"
echo "Copying $BASENAME to $FILENAME..."
cp "$SOURCE" "$FILENAME"
echo "Reading headers of file $FILENAME..."
declare -a FITSKEYS
readarray -t FITSKEYS <<< "$(fitsheader -e 0 -t ascii.csv -k INSTRUME -k XBINNING -k YBINNING -k EXPTIME "$FILENAME" | cut -f 4 -d , | tail -n +2)"
CCD="${FITSKEYS[0]}"
BINX="${FITSKEYS[1]}"
BINY="${FITSKEYS[2]}"
DURATION="${FITSKEYS[3]}"
echo "  CCD:       $CCD"
echo "  BinX:      $BINX"
echo "  BinY:      $BINY"
echo "  Duration:  $DURATION (s)"
 
SQL="insert into darkframe(ccd, chip, binX, binY, temperature, duration, filename, timestamp)  values('$CCD', '0', '$BINX', '$BINY', '$TEMP', '$DURATION', '$FILENAME', '$TIMESTAMP')"
# echo "Importing dark..."
echo "Executing '$SQL'..."
 
sqlite3 ~/.local/share/kstars/userdb.sqlite "$SQL" && echo "Done."
exit $?
The following user(s) said Thank You: Jasem Mutlaq, Darren Poulson
5 years 8 months ago #27621

Please Log in or Create an account to join the conversation.

Great.. maybe you can help us implement this import right in KStars :D
5 years 8 months ago #27654

Please Log in or Create an account to join the conversation.

Time to create page: 0.643 seconds