Flat Frame Script

Thought this script might be of use to other users to automate what flat frames to take at the end of an imaging session. It is a Python script that searches your light frame folder for images captured in the last 12 hours and then interrogates the filename to see what filters and gains were used and adds this to a string variable which is output and Voyager can read in the external script function in your Dragscript.

In the Dragscript, you can use a Do if String contains action to run an Autoflat sequence matching the filter and gain combination if this appears in the string. I do this at the end of my Dragscript/imaging session each morning. The script also sends you an email with a list of images captured that night and what flat frames have been requested.

Up until now, I have just used a series of Yes/No variables which I set manually prior to running the Dragscript to pick which Autoflat sequences I wanted to run at the end of the night.

It is my first attempt at Python programming, so probably not very “elegant” but it seems to work. You will need to change the path variable to your image folder (it searches sub folders), and change the filter_list and gain_list contents to match your filter names and gains as they appear in your filenames.

You could probably also extend the script to include binning with an extra for loop (I don’t bin any of my images, so haven’t done this).

There are some variables to change for email address, user, password etc. You will also need to download and install Python.

A PDF file containing the Python code is attached which you should be able to cut and paste.
FlatFramesScript.pdf (57.8 KB)

Also attached are some screenshots of my Dragscript calling the external script and running the Autoflat sequences, as well as the settings for the external script action, do if string value and a sample email sent by the script.

Hope this makes sense and is helpful to some. Many may have already implemented something similar. Let me know if you have any queries or suggestions for improvement.