
Examples
========



**1. Pipeline**
^^^^^^^^^^^^^^^

Use ``pipe run`` command to execute pipeline steps.

.. code-block:: bash
   :caption: bash

   avica pipe run --t TARGET_NAME --f example.idifits

.. code-block:: text
   :caption: out

   +--------------------+---------------+--------------+----------------------------+-----------------------------------+-----------------------------------+--------------+------------------+
   | name               | success_count | failed_count | start_stamp                | detail                            | desc                              | success      | end_stamp        |
   +==========================================================================================================================================================================================+
   | preprocess_fitsidi | 1             | 0            | 2026-04-15 21:45:41.4 | {"example.idifits": "done"}       | ["fixed extra_byte"]              | [true]       | 2026-04-15 21:45:02.5 |
   | fits_to_ms         | 1             | 0            | 2026-04-15 21:45:03.2 | {"VLBI.ms": "done"}               | ["Successfully completed con..."] | [true]       | 2026-04-15 21:49:02.5 |
   | avica_avg          | 2             | 0            | 2026-04-15 21:49:02.8 | {"C": "done", "X": "done"}        | ["C", "X"]                        | [true, true] | 2026-04-15 21:50:22.4 |
   | avicameta_ms       | 2             | 0            | 2026-04-15 21:50:22.6 | {"C": "done", "X": "done"}        | ["filled C", "filled X"]          | [true, true] | 2026-04-15 21:50:26.7 |
   | avica_snr          | 2             | 0            | 2026-04-15 21:50:27.1 | {"C": "done", "X": "done"}        | ["refant=LA,FD,PT calibrarator... | [true, true] | 2026-04-15 21:58:22.1 |
   | avica_fill_input   | 2             | 0            | 2026-04-15 21:58:22.2 | {"C": "done", "X": "done"}        | null                              | [true, true] | 2026-04-15 21:58:22.5 |
   | avica_split_ms     | 2             | 0            | 2026-04-15 21:58:22.8 | {"C": "/data/avi/tests/avica_0... | ["..splitted J0852+2833,MJV234... | [true, true] | 2026-04-15 21:59:05.8 |
   | rpicard            | 2             | 0            | 2026-04-15 21:59:06.2 | {"C": "/data/avi/tests/avica_0... | ["calibrated J0927+3902,J1215+... | [true, true] | 2026-04-15 22:09:47.2 |
   +--------------------+---------------+--------------+----------------------------+-----------------------------------+-----------------------------------+--------------+------------------+



**2. Print observation summary**
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Use ``listobs`` command to get a summary of the observation for multiple files. This is enabled using ``CFITSIO``.


.. code-block:: bash
   :caption: bash

   avica listobs ex1.idifits ex2.idifits

.. code-block:: text
   :caption: [out]

   +-------------------------+-------------------------+-------+-------------+------------------------------+------+-----------+
   | start_time              | end_time                | nrows | source      | inttime                      | scan | source_id |
   +===========================================================================================================================+
   | 2008-01-19 04:28:21.212 | 2008-01-19 04:33:14.158 | 5102  | J09452+2729 | [1.9660, 1.9660, ... 1.9660] | 1    | 1         |
   | 2008-01-19 04:33:18.090 | 2008-01-19 04:38:30.697 | 5688  | J10512+4644 | [1.9660, 1.9660, ... 1.9660] | 2    | 2         |
   | 2008-01-19 04:38:34.629 | 2008-01-19 04:43:47.236 | 7046  | J08116+4308 | [1.9660, 1.9660, ... 1.9660] | 3    | 3         |
   | 2008-01-19 04:43:51.168 | 2008-01-19 04:49:07.707 | 7149  | J09128+4422 | [1.9660, 1.9660, ... 1.9660] | 4    | 4         |
   | 2008-01-19 04:49:09.673 | 2008-01-19 04:54:22.280 | 5688  | J10305+5132 | [1.9660, 1.9660, ... 1.9660] | 5    | 5         |
   | 2008-01-19 04:54:26.212 | 2008-01-19 04:59:38.819 | 5688  | J11285+3243 | [1.9660, 1.9660, ... 1.9660] | 6    | 6         |
   | 2008-01-19 04:59:42.751 | 2008-01-19 05:04:55.357 | 7083  | J08116+4308 | [1.9660, 1.9660, ... 1.9660] | 7    | 3         |
   | 2008-01-19 05:04:59.290 | 2008-01-19 05:10:15.828 | 7151  | J09128+4422 | [1.9660, 1.9660, ... 1.9660] | 8    | 4         |
   | 2008-01-19 05:10:17.795 | 2008-01-19 05:15:30.401 | 5688  | J10305+5132 | [1.9660, 1.9660, ... 1.9660] | 9    | 5         |
   | 2008-01-19 05:15:34.333 | 2008-01-19 05:20:48.906 | 5724  | J11285+3243 | [1.9660, 1.9660, ... 1.9660] | 10   | 6         |
   | 2008-01-19 05:20:52.838 | 2008-01-19 05:26:54.597 | 8166  | J0854+2006  | [1.9660, 1.9660, ... 1.9660] | 11   | 7         |
   +-------------------------+-------------------------+-------+-------------+------------------------------+------+-----------+

To reproduce the above in python, one can import the ``ObservationSummary`` class.

.. code-block:: python
   :caption: python

   from avica.fitsidiutil import ObservationSummary

   fitsfilepaths  = ["ex1.idifits", "ex2.idifits"]
   obs            = ObservationSummary(fitsfilepaths)
   print(obs.to_polars())

.. code-block:: text
   :caption: [out]

      +-------------------------+-------------------------+-------+-------------+------------------------------+------+-----------+
      | start_time              | end_time                | nrows | source      | inttime                      | scan | source_id |
      +===========================================================================================================================+
      | 2008-01-19 04:28:21.212 | 2008-01-19 04:33:14.158 | 5102  | J09452+2729 | [1.9660, 1.9660, ... 1.9660] | 1    | 1         |
      | 2008-01-19 04:33:18.090 | 2008-01-19 04:38:30.697 | 5688  | J10512+4644 | [1.9660, 1.9660, ... 1.9660] | 2    | 2         |
      | 2008-01-19 04:38:34.629 | 2008-01-19 04:43:47.236 | 7046  | J08116+4308 | [1.9660, 1.9660, ... 1.9660] | 3    | 3         |
      | 2008-01-19 04:43:51.168 | 2008-01-19 04:49:07.707 | 7149  | J09128+4422 | [1.9660, 1.9660, ... 1.9660] | 4    | 4         |
      | 2008-01-19 04:49:09.673 | 2008-01-19 04:54:22.280 | 5688  | J10305+5132 | [1.9660, 1.9660, ... 1.9660] | 5    | 5         |
      | 2008-01-19 04:54:26.212 | 2008-01-19 04:59:38.819 | 5688  | J11285+3243 | [1.9660, 1.9660, ... 1.9660] | 6    | 6         |
      | 2008-01-19 04:59:42.751 | 2008-01-19 05:04:55.357 | 7083  | J08116+4308 | [1.9660, 1.9660, ... 1.9660] | 7    | 3         |
      | 2008-01-19 05:04:59.290 | 2008-01-19 05:10:15.828 | 7151  | J09128+4422 | [1.9660, 1.9660, ... 1.9660] | 8    | 4         |
      | 2008-01-19 05:10:17.795 | 2008-01-19 05:15:30.401 | 5688  | J10305+5132 | [1.9660, 1.9660, ... 1.9660] | 9    | 5         |
      | 2008-01-19 05:15:34.333 | 2008-01-19 05:20:48.906 | 5724  | J11285+3243 | [1.9660, 1.9660, ... 1.9660] | 10   | 6         |
      | 2008-01-19 05:20:52.838 | 2008-01-19 05:26:54.597 | 8166  | J0854+2006  | [1.9660, 1.9660, ... 1.9660] | 11   | 7         |
      +-------------------------+-------------------------+-------+-------------+------------------------------+------+-----------+
