Сценарии Siril

Siril Script Files are the original format for scripting Siril and remain a simple and useful way of automating a fixed set of tasks.

Siril Scripts

Siril scripts are a list of commands, either from the graphical user interface or from the command line interface. In general, commands that modify a single image work on the currently loaded image, so the use of the load command is required in scripts, and commands that work on a sequence of images take the name of the sequence as argument. If files are not named in a way that Siril detects as a sequence, the command convert will help.

Совет

The Space character is the delimiter between arguments. If you need to have spaces inside the arguments you can use the quote or double quote, just like in a shell.

Команды можно вводить в командной строке в нижней части главного окна Siril. Другой способ — поместить команды в файл и запустить его в виде сценария. Чтобы запустить сценарий из графического интерфейса пользователя, добавьте его в одну из директорий, указанных в Настройках на вкладке Сценарии, или в командной строке Siril, используя символ @ следующим образом:

@file_name

Some commands (calibrate, stack, and all save commands) can use file names containing variables coming from the FITS header. The format of the expression is explained in details here and can be tested using the parse command.

Использование сценариев

There are four ways to run a script:

  • из командной строки Siril, используя ключевое слово @, за которым следует имя сценария в текущем рабочем каталоге,

  • из графического интерфейса пользователя используя меню Сценарии,

    script menu
  • from the graphical user interface, using the Script Editor dialog which can be used to write, save and execute your own scripts or to open and edit an existing script file,

    script editor dialog
  • из командной строки операционной системы (приложение siril-cli), используя аргумент -s, за которым следует путь к сценарию (для дополнительной информации см. руководство).

When a script is running, the user interface becomes non-interactive with the exception of the Stop button.

Заполнение списка сценариев

При установке Siril по умолчанию автоматически устанавливается ряд сценариев. Эти встроенные сценарии — официальные сценарии. Они разрабатываются командой разработчиков и будут гарантированно работать: они предназначены для определённых случаев использования.

Добавление директорий пользовательских сценариев

You can, of course, write your own and tell Siril where to find them:

  • Нажмите на значок Главное меню, а затем на Настройки (или нажмите Ctrl+P).

  • Нажмите на вкладку :guilabel: "Сценарии".

  • Скопируйте в новую строку путь к месту хранения ваших сценариев (при необходимости создайте директорию на своем компьютере или укажите на существующую).

  • Нажмите на значок Обновить чуть ниже.

  • Нажмите Применить.

У вас может быть столько пользовательских директорий, сколько вы пожелаете, просто добавьте их в список.

Если вы только что добавили новый скрипт в одну из директорий и хотите обновить меню, введите команду reloadscripts в командной строке или откройте раздел Настройки ‣ Сценарии и используйте значок Обновить. Это просканирует все директории из списка и найдет в них все файлы с расширением *.ssf.

Предупреждение

Настоятельно рекомендуется не хранить пользовательские скрипты в той же директории, что и встроенные скрипты Siril. В Windows они могут быть удалены при установке новой версии или помешать корректному удалению. В MacOS это сломает пакет и вообще не позволит использовать Siri.

Не волнуйтесь, поскольку список расположений сценариев хранится в вашем конфигурационном файле, вы обязательно их обнаружите при установке более новой версии.

Adding Scripts from the git Repository

Siril supports a git repository at https://gitlab.com/free-astro/siril-scripts This is set to auto update at startup by default, so you will always have access to the latest scripts (auto update can be disabled in preferences). To add scripts from the repository to the Scripts menu, pick the ones you want from the list available in Preferences -> Scripts or via the Burger Menu -> Get Scripts menu entry. See below for full details of the git repository.

Run Script Files

Script files can also be run directly from the hard disk using the Run Script Files... script menu entry. The filechooser shown by this menu defaults to showing recently used scripts, but you can navigate to choose scripts from anywhere accessible on the filesystem.

Устранение проблем

For different reasons, it is possible that the Scripts menu is empty. This means that the scripts have not been found. If this is the case, please use the following procedure.

  • Нажмите на значок Главное меню, а затем на Настройки.

  • Нажмите на вкладку :guilabel: "Сценарии".

  • Удалите все строки в поле Директории хранения сценариев, как показано на рисунке ниже.

  • If you are using the scripts repository, deselect the Fetch and update scripts... check box, then reselect it and select the scripts you want to use.

  • Нажмите Применить.

  • Закрыть и перезапустить Siril.

диалог

Страница настроек сценариев. Сценарии загружаются по путям, указанным в разделе Директории хранения сценариев.

Встроенные сценарии

Все встроенные сценарии требуют соблюдения следующей файловой структуры:

файловая структура для сценариев
  • Mono_Preprocessing.ssf: сценарий для предварительной обработки монохромных изображений, полученных с помощью DSLR или астрокамер. Использует кадры тока считывания (biases), кадры плоского поля (flats) и кадры темнового тока (darks), выравнивает и складывает изображения (lights). Чтобы использовать этот сценарий: поместите ваши файлы (RAW или FITs) в директории с именами lights, darks, flats и biases (в текущей рабочей директории Siril), затем запустите сценарий.

  • OSC_Preprocessing.ssf: такой же сценарий, что и выше, но для цветных (One-Shot Color (OSC) DSLR или астрокамер. Чтобы использовать этот сценарий: поместите ваши файлы (RAW или FITS) в директории с именами lights, darks, flats и biases (в текущей рабочей директории Siril), затем запустите сценарий.

  • OSC_Preprocessing_BayerDrizzle.ssf: same script as above but using Bayer Drizzle to retrieve colors. To use it: put your files (RAW or FITS) in the folders named lights, darks, flats and biases (in the Siril default working folder), then run the script. A large amount of data is strongly recommended to take advantage of the benefits of Bayer Drizzle and avoid unsightly artifacts.

  • OSC_Extract_Ha.ssf: сценарий для предварительной обработки изображений, полученных с использованием цветных (OSC) DSLR или астрокамер, при использовании двухполосного или Ha фильтра. Этот скрипт извлекает Ha-слой цветного изображения. Чтобы использовать этот сценарий: поместите ваши файлы (RAW или FITs) в директории с именами lights, darks, flats и biases (в текущей рабочей директории Siril), затем запустите сценарий.

  • OSC_Extract_HaOIII.ssf: такой же сценарий, что и выше, но извлекает из цветного изображения Ha и OIII слои. Чтобы использовать этот сценарий: поместите ваши файлы (RAW или FITs) в директории с именами lights, darks, flats и biases (в текущей рабочей директории Siril), затем запустите сценарий. Вы также можете использовать меню Обработка, затем Совмещение в RGB и поместить результат Ha в красный канал, а результат OIII в зелёный и синий слои, чтобы получить изображение в палитре HOO.

    Совет

    Для владельцев SII или двухполосных SII-OIII фильтров применяются те же сценарии. Фактически, для цветного датчика невозможно увидеть разницу между Ha (656,3 нм) и SII (671,6 нм), оба из которых красные.

  • RGB_Composition.ssf: Этот сценарий, добавленный в версии 1.2, делает глобальное выравнивание монохромных изображений, кадрирует их до области, общей для всех изображений, и берет первые три изображения для создания цветного изображения. Входные изображения должны быть помещены в отдельную директорию и названы R.fit (или с настроенным расширением), G.fit и B.fit. В результате будет получен файл с названием rgb.fit. Обязательно удаляйте директорию process перед каждым запуском сценария.

Editing Scripts

Some .ssf script files contain instructions to edit them, for example the Seestar_Preprocessing script instructs the user that if they find too many images are discarded before stacking, they should "increase the value after -filter-round= in the seqapplyreg command, line 47".

The scripts repository directory is not intended as a user-editable directory: at each update it is forcibly reset to match the state of the remote, so files saved in it are not safe. So how to make such changes?

Find the script in the list in Preferences->Scripts and double click it. This will open it in the Script Editor so that you can make the necessary changes and save it in a suitable location (one of the Scripts Storage Directories set at the top of Preferences->Scripts is ideal, but it is recommended to give it a different name so you can recognise it in your scripts menu).

Совет

You can also double click scripts in the list simply in order to examine the code.

Язык сценариев

В начале работы над скриптами, благодаря вкладу пользователей, скрипты существовали в двух версиях (английской и французской). Когда был выпущен Siril 1.2.0, для простоты обслуживания было решено оставить только английские скрипты. Мы призываем пользователей распространять переводы официальных скриптов в своих сообществах, если они сочтут это необходимым.

Получение дополнительных сценариев

Существует целая куча сценариев, которые не поставляются с установкой Siril. Однако мы создали для них репозиторий на gitlab. Каждый может зарегистрироваться и предложить новые сценарии. Мы примем их в зависимости от их актуальности: используемый язык должен быть английским.

Siril features git integration which means that it can download and synchronise a local copy of the repository. You can enable this by selecting the Enable use of the siril-scripts online repository check box in the Scripts tab of the Preferences dialog.

Selecting the check box will fetch scripts from the repository and show a list of the available scripts, categorised as either "Preprocessing" or "Processing" scripts. As there may eventually be a substantial number of scripts in the repository you need to select the ones you wish to have available in the Scripts menu. Click the check box next to the name of each script you wish to use and then press the Apply button.

The contents of any script can be viewed by double-clicking on its row in the list. It is always useful to do this to check what requirements the script may have in terms of pre-prepared directories. If you wish to modify a script, you can also use this to copy the script and paste it into your favourite text editor software. (You will need to save it in one of your local script directories.)

When the scripts repository is enabled, Siril can synchronise the local repository with the remote, either manually or automatically. If automatic updates are selected, updating will take place at application startup. Manual update is also available using the Manual update button. This will fetch any changes from the online repository and will show a list of the commit messages describing the changes, which the user must confirm to apply the update.

Если вы не хотите использовать интеграцию с git, вы можете использовать ссылку ниже для просмотра и загрузки сценариев вручную. В этом случае необходимо поместить скачанный скрипт в директорию, известную Siril: https://gitlab.com/free-astro/siril-scripts.

Предупреждение

Однако имейте в виду, что эти сценарии не обязательно поддерживаются пользователями, которые их загрузили, и могут быть неактуальными. Тем не менее, получайте удовольствие.

Написание собственных сценариев

Файл сценария — это простой текстовый файл с расширением *.ssf.

Writing a script is not difficult. It is a succession of calls to commands that will be executed sequentially. Each command must be executed without returning an error, otherwise the script stops. It is therefore strongly recommended to use the list of commands to know the syntax and the number of parameters needed. Also, some commands are not scriptable and are indicated with the Нельзя использовать в сценариях icon. It can also be useful to test each script line in the Siril command line. You may wish to read the provided scripts or view (or even modify) scripts from the repository as examples.

Each script should contain a comment header containing information about the script. An example of this is provided below.

############################################
#
# Script for Siril 1.0
# July 2020
# (C) Cyril Richard
# Mono_Preprocessing_WithoutDark v1.0
#
########### PREPROCESSING SCRIPT ###########
#
# Script for mono camera preprocessing
#
# Needs 3 sets of RAW images in the working
# directory, within 4 directories:
#   biases/
#   flats/
#   lights/
#
############################################

Below the comment header the first command should be requires. This specifies the minimum version of Siril required to use the script. For example:

requires 0.99.4

After this you can start the actual script. Commands go on a line of their own, and you can comment your script using lines starting with #.

Each new script created in this way should be placed in a user-defined folder for Siril to find them. If you believe your script is of benefit to the wider Siril community you may submit it to the script repository. Instructions on doing so are found in the repository README.