Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



This python module allows you to create sequences and interacting with your devices using python scripting.

A few examples of how to use this module are in the "example" directory.


At the moment only manual installation is supported.

Get the sources:

git clone git@github.com:GuLinux/indi-lite-tools.git

Copy one of the examples from the pyindi_sequence/examples/ directory, change the path on the second one to the path containing the pyindi_sequence directory.


The easiest way to use this module is to import the SequenceBuilder object

from pyindi_sequence import SequenceBuilder
sb = SequenceBuilder('M42', upload_path = '/tmp/M42')

The SequenceBuilder class has all the methods required to create a sequence.

  • Constructor: SequenceBuilder(name, camera_name = None, upload_path = None, indi_host = INDIClient.DEFAULT_HOST, indi_port = INDIClient.DEFAULT_PORT) Within the constructor you can set the camera name, path for saving file (which will be autogenerated if not specified), and INDI connection parameter. Remember that an INDI server must be already up and running when creating the SequenceBuilder object.

  • devices(): returns a list of devices connected to the INDI server.

  • set_camera(camera_name): sets the camera to be used in the sequence.

  • set_filter_wheel(filter_wheel): sets the filter wheel to be used in the sequence.

  • add_sequence(sequence_name, exposure, count): adds count shots of exposure seconds as a sequence named sequence_name. Output file name will be changed accordingly.

  • add_filter_wheel_step(filter_name, filter_number): adds a step in the sequence changing the filter on the filter wheel. You can set either the filter name or the number, according to INDI settings.

  • add_user_confirmation_prompt(message, on_input): displays a message to the user, and waits for input (pressing enter on the keyboard). Useful if you don't have an electric filter wheel, and you need to manually change filters, or if you need to cover the lenses before taking dark frames. The (optional) on_input callback function will be called with the text entered by the user (see examples/flat_dark_bias.py)

  • add_message_step(message, sleep_time): displays a message, and if sleep_time is specified, will also sleep for sleep_time seconds. message can also be a function returning a string.

  • add_shell_command(command, shell, abort_on_failure): runs the specified command in the sequence. command and shell are set as per python documentation for the subprocess.call() method. abort_on_failure defaults to False, if set to True throws an exception when the command returns a non zero exit status

  • add_function(function): runs a native python function inside the sequence

  • add_auto_dark(count): this particular step collects all the exposures previously used, and takes count (defaults to 10) dark frame for each different exposure value. You can add multiple auto dark commands: each time you add it, the exposures list will reset.

  • start(): starts taking frames.

The SequenceBuilder object will also store a few useful attributes for directly manipulating INDI devices, such as camera, filter_wheel, indi_client, upload_path.

Please see the other files for a more advanced use of this API.

Extending PyINDI-Sequence

the Device class in device.py contains a few primitives for interact with INDI devices, particularly to get and set values. You can look at the Camera and FilterWheel classes for a few examples.

You can also add new steps, both for controlling new INDI device types, and other various usages (like the User Confirmation prompt and the Run Command).

All the steps need to do is to implement the run() method.

You can then add them directly to the sequences attribute of the SequenceBuilder object.

User notes

This script was created mainly to satisfy my personal requirements: having a very simple batch processor capable to handle frames capturing without user input. I capture using a small mount (SkyWatcher Star Adventurer), an ASI1600mm and a Raspberry Pi. I need the Pi to capture indipendently, without having to have a notebook always connected to it for imag e viewing/saving.

My typical usage scenario is:

  • Start INDI server on the Pi (using INDI Web manager, for instance).
  • Open KStars on my laptop, start Ekos
  • connect it to the Pi (which has a builtin wifi access point configuration)
  • Use Ekos preview to select the field of view
  • Use Ekos focusing tool
  • Calculate the proper exposure times using Ekos preview for each filter (LRGB)
  • Use SequenceBuilder on a shell session on the Pi (use screen or tmux to have an indipendent session), entering the shooting times calculated.
  • Start the sequence, and do something else while the Pi is capturing by itself :)

I also did setup some hooks to control the leds on my Raspberry Pi: slowly blinking when capture is in progress, fast blinking if it has finished, or there is an error, or anything requiring user in teraction.

You can pause sequences by creating an empty file named pause in the sequence upload directory. This will pause the next shooting, until the file is deleted.