Application for automatic sky flats with SGP

Hi all,

I’ve been working since quite some time on an application for controlling SGP (through its API) to automatize sky flat captures. Specifically I do so-called blue sky flats, starting about 30 min before sunset, and I wanted to automatize the whole sequence, particularly a dynamic adjustment of the exposure time to reach a target ADU with the changing light level. The application also has a sequencer to handle a list of filters, calculates and waits for sunset, etc. The idea was to do a “click-and-forget” application, because frankly flats are boring to take (but necessary :)! I would also mention that this project started during the pandemic, hence it is a lock-down project that grew out of proportions…

I have been using the application for my imaging during about 4 months now, and on my computer it works like a charm. I feel rather confident it could be used by others, but of course there might be a lot of bugs that do not appear on my system. If there is an interest in testing the application, do not hesitate to tell me and you can be beta tester. As for now I will not release it on the net, before I get some feedback from other users that do sky flats. So just answer this message if you are interested, and I will forward the installation files on a private channel.

A screenshot of the application can be found below.

EDIT: The application connects directly to the mount and therefore requires an ASCOM driver for the mount

Cheers, Mikael


Hi Mikael. What a great idea. I do sky flats with my C14. I point at the zenith about 1 to 1.5 hours before sunset, and then just run sequence that I have tuned to be close to 30k ADU with each filter. But like you, the sky brightness varies and I do get variation in the mean ADU value. I haven’t noticed that it causes an issue, but I like that you have a closed loop feedback to get it more accurate. I have the latest version of SGP, and use a ZWO camera and would love to try your application.

Ok, I’ll send you a link for downloading the installer.

I agree, there is no real issue with the varying ADU, as long as it is well below saturation and well above the readout noise. But I found it hard to do all my 7 filters at once using the flats calibration wizard in SGP due to the long download times of the 1x1 binned frames (late filters would have too low ADU despite the wizard), and since I never started at exactly the same time I had to redo the wizard each time. I wanted a highly automatized process, particularly for the winter time when I need to launch the flat process during office hours at my latitudes. With this application I log on to the remote computer in my obsy, turn on the equipment, open the roof, launch it and log off, letting it do the flats unattended.

Very cool idea. Do you use it with a rotator and pre-capture any framing changes you might make over the night?



I have no experience with rotators, so no the application doesnt support it. Could probably be added though. I’ll see if there is a general interest for this application first (and if it works for others!) before adding features.

I am definitely interested either way!

Got it! :slight_smile:

I sent you a private message with the link and some instructions.

Hi Mikael,

This is such a long awaited application for SGP that developers have always said wasn’t needed!

Well done. I have a couple of remote setups and doing sky flats manually is a pain.

It would be great if you shared the code (e.g. via GitHub) so that everyone can test and impressive it.


Glad you are interested!

I’ll send you the current installation file.


I’m interested, too. I’m currently doing my sky flats and automation with a competing product that starts with a V on a RC 10 and a RASA. Especially for the latter sky flats are basically the only thing that really works. I like the sequence recovery of SGP a lot better and would like to have the option of using both applications again. I can compare results for flatness against my current approach. Is there also an option to shoot the flats at dawn instead of dusk? Can you start it “after sequence” in SGP?

1 Like

I’m fixing some bugs that a couple of beta testers have uncovered, I’ll send you a link when its done.

Shooting the flats at dawn is surely an interesting option to add. It would require some changes to the logic of the flat sequencer, as now it supposes that ADU is always decreasing. For instance, now if the ADU is too high for even the lowest allowed exposure time (i.e. too bright sky) it waits 60s, and then does another test frame. So it likely will not work well in a dawn scenario, but I dont think it would take long to add the option in the future.

As to letting SGP start Skyflats as part of a sequence, I dont think that is possible now within SGP. To my understanding all pre and post events that one can add, they dont allow controlling SGP through its api, I think. It looks to me as if all calls to the api are ignored once the sequence Run button has been clicked. @Jared or @Ken can maybe confirm this ?

Hi Mikael, I would be interested in testing out your sky flats software. Wife and I are heading out to the Okie-Tex Star Party in Western Oklahoma the end of this month and it would be a good time to test out the sky flat software. I have a custom flat box I use but would like to do sky flats…

Kind Regards,

Hello Mikael,

Thanks for sharing your work with us. I would be very much interested to beta test your app.

Clear skies

Sedat Bilgebay

Hello Mikael,

Very good idea. I would be very interested in testing your application.

Philippe Baudouin

Mikael, I’d also like to try your sky flats application.


I’m interested in the testing, too.

Hi Mikael,

I’d like to test this please, it looks amazing!

Thank you,

I’m very interested to test and use it. It looks really good

Thanks all for showing interest!

I had a first version out with a couple of beta testers (thanks @psparkman and @bjswx44), and we identified a couple of serious issues with the SGP communication. I think they are solved now though, hopefully. I will make a couple of small changes in addition, I’ll have a new beta version in a couple of days.

I would like feedback from a couple of more people before releasing generally here, so please if someone among those who showed interest will be in a position to test the application in the next week or so, then please send me a private message and I’ll give you a download link.

Skyflats has now gone through some beta testing, and quite a few bugs have been corrected. Undoubtedly more problems will show up, but hopefully this version will serve its purpose for most users.

The first release can be downloaded here: SkyFlats - Browse Files at

A few words of caution. Please be careful in filling out the Setup form with valid values, there is no exhaustive check of proper formatting of parameters. Please also carefully read the help file (File menu About → Help), particularly the section about slewing to the flat position, and the recommendations regarding the minimum flat exposure duration.

The beta testers have suggested several interesting improvements, including the support of OSC cameras (Skyflats now supposes you have a filterwheel, I’m a mono guy :), support for rotators (I’m waiting for my Pegasus Rotator to arrive, so this will be high on my list of priorities), and other minor things. Dont hesitate to share your experience and provide suggestions.

Cheers, Mikael

1 Like