.. SPDX-FileCopyrightText: 1992-2026 NWO-I/SRON Space Research Organisation Netherlands
..
.. SPDX-License-Identifier: CC-BY-4.0

.. _sect:spoappend:

SPOappend
=========

SPOappend is a tool to append a new spectrum to an existing SPO and RES file.
This is especially helpful if one wants to create a setup with multiple sectors
and regions.

The spoappend tool takes a base SPO and RES file (append 'to') as input and
a set of SPO and RES files that will be appended to it ('from'). The user
can also specify to which sector the spectrum and response belong and
to what spectral region the model spectrum calculated should apply.

Using SPOappend
---------------

The ``spoappend`` program takes a number of command-line arguments. The
list of options can be called using ``spoappend --help``::

    user@unix:~> spoappend --help

    Usage:

    spoappend [OPTIONS]

    Options:

     --spo-to <input>                   Main SPO file name to append region to (required=yes)
     --res-to <input>                   Main RES file name to append region to (required=yes)
     --spo-from <input>                 SPO file name to append region from (required=yes)
     --res-from <input>                 RES file name to append region from (required=yes)
     --sector <input>                   Sector number (required=no)
     --region <input>                   Region number (required=no)

| ``--spo-to <input>``: Main SPO file name to append region to.
| ``--res-to <input>``: Main RES file name to append region to.
| ``--spo-from <input>``: SPO file name to append region from.
| ``--res-from <input>``: RES file name to append region from.
| ``--sector <input>``: The sector number to assign to this spectrum/response combination.
| ``--region <input>``: The region number to apply the caluculated spectrum to.

.. warning:: Please note that the base spo and res file will be overwritten! Keep a
             copy of these files if you want to keep them in their original state.


Examples:
'''''''''

In practice, the ``spoappend`` command looks like this::

    user@unix:~> spoappend --spo-to base.spo --res-to base.res --spo-from add.spo --res-from add.res
                 --sector 2 --region 2

In this example, the spectrum in ``add.spo`` and ``add.res`` is appended to ``base.spo`` and ``base.res``.
The appended spectrum gets sector number 2 assigned and applies to region 2.
