SKA SDP Mock Dish Devices

This project defines a set of Docker images and Docker compose files that are useful for TANGO control system development.

Mock Dish Master Device

Introduction

Mock implementation of the SKA Dish Master Tango device based on the interface provided by https://gitlab.com/ska-telescope/ska-sim-dishmaster.

Usage

This mock implementation when in the ON state will simulate mocked attributes listed below of the real device using a mock dataset. Mocking must be started using the Start command and may be stopped (for restart) using the Stop command.

Additionally, the device will automatically transition to the Off state when at the end of the mock data stream.

For API usage see ska_sdp_mock_dish_devices.MockDishMaster.

States

State

Description

OFF

Device is initialized and is not simulating

ON

Attributes are being continuously simulated from mock data by the device

Properties

Property

Type

Values

Description

mock_achieved_paths

String

‘’{“1”: “mnt/data/pointings.hdf”}’`

Json mapping of scan id to a path of PointingTable collections in HDF5 format for achievedPointing

antenna_id

Int32

0

Antenna ID within the pointing data

time_scale

Float

1.0

Scale factor for the timing interval pointings are read

Commands

Command

Argument type

Return type

Action

Scan

int

None

Set device state to ON

EndScan

None

None

Set device state to OFF

Attributes

Attribute

Type

Format

Values

Description

achievedPointing

Float64

SPECTRUM[3]

[Offset since Epoch, az, el]

Marks the dish actual pointing direction in radians for a corresponding timestamp.

Offset since Epoch

These are specified as an offset in SI seconds (or multiples/sub-multiples of SI seconds) from the TAI epoch of midnight, 1 January 2000, which equates to 1999-12-31T23:59:28Z UTC. See https://confluence.skatelescope.org/display/SWSI/ADR-78+SKA+approach+to+timestamps+in+time+sensitive+data for more information.

Note

The UTC equivalent is different because at the start of Y2000 UTC was 32 seconds behind TAI (it is now further behind because of leap second adjustments).

Mock Dish Leafnode Device

Introduction

Mock implementation of the SKA TMC Dish Leafnode Tango Device provided by https://gitlab.com/ska-telescope/ska-tmc/ska-tmc-dishleafnode.

Usage

This mock implementation when in the ON state will simulate mocked attributes listed below of the real device using a mock dataset. Mocking must be started using the Start command and may be stopped (for restart) using the Stop command.

Additionally, the device will automatically transition to the Off state when at the end of the mock data stream.

For API usage see ska_sdp_mock_dish_devices.MockDishLeafnode.

States

State

Description

OFF

Device is initialized and is not simulating

ON

Attributes are being continuously simulated from mock data by the device

Properties

Property

Type

Values

Description

mock_desired_paths

String

‘’{“1”: “mnt/data/pointings.hdf”}’`

Json mapping of scan id to a path PointingTable collections in HDF5 format for desiredPointing

mock_offset_paths

String

‘’{“1”: “mnt/data/pointings.hdf”}’`

Json mapping of scan id to a path of PointingTable collections in HDF5 format for sourceOffset

antenna_id

Int32

0

Antenna ID within the pointing data

time_scale

Float

1.0

Scale factor for the timing interval pointings are read

Commands

Command

Argument type

Return type

Action

Scan

int

None

Set device state to ON

EndScan

None

None

Set device state to OFF

Attributes

Attribute

Type

Format

Values

Description

desiredPointing

Float64

SPECTRUM[3]

[Offset since Epoch, az, el]

Marks the dish commanded pointing direction in radians for a corresponding timestamp.

API Reference

ska_sdp_mock_dish_devices Package

Classes

MockDishLeafnode(cl, name)

A Mock implementation of ska-tmc-dishleafnode for interfaces used by SDP.

MockDishMaster(cl, name)

A Mock implementation of ska-sim-dishmaster for interfaces used by SDP.

Developer guide

Get Started

Install dependencies

You will need:

Before running poetry install to install the Python dependencies you will need a system tango library installed on your system (which is required by pytango).

For Debian/Ubuntu:

$ sudo apt update
$ sudo apt install -y curl git build-essential libboost-python-dev libtango-dev

Please note that:

  • The libtango-dev will install an old version of the TANGO-controls framework (9.2.5);

  • The best way to get the latest version of the framework is compiling it (instructions can be found here)

  • MacOS is not supported

  • Windows users will need to use WSL

  • The above script has been tested with Ubuntu 22.04.

During this step, libtango-dev installation might ask for the Tango Server IP:PORT. Just accept the default proposed value.

Once you have that available you can install the python dependencies. Note that on some systems, you may need to explicitly provide the path to the tango C++ headers:

CPPFLAGS=-I/usr/include/tango poetry install

Run linting and testing

Since this project supports interfacing with Kafka, we need to spin up a instance for testing. For this we use Docker Compose so you will need to install docker engine, and docker compose.

When these are available you can run the tests using

$ poetry run make python-tests

Linting can be run in a similar way:

$ poetry run make python-lint

Other

Makefile targets

This project contains a Makefile which acts as a UI for building Docker images, testing images, and for launching interactive developer environments. For the documentation of the Makefile run make help.

TANGO References

  • https://pytango.readthedocs.io/en/stable/contents.html

  • https://pytango.readthedocs.io/en/stable/green_modes/green_modes_server.html

  • https://pytango.readthedocs.io/en/stable/testing.html

  • https://pytango.readthedocs.io/en/stable/client_api/index.html

  • https://pytango.readthedocs.io/en/stable/server_api/server.html

ska-tango-images

Please note that this project make use of the charts and docker images for the TANGO-controls framework available at here.

Test execution

All tests created for the present project can run in simulated mode or in a real environment except for the ones marked as post_deployment.

make test-deployment runs all the application test procedures defined in the folder tests in a new pod in the k8s deployment. This target copies the tests folder into a new pod and execute the test with the option --true-context allowing the execution to happen against the real application. On success it copies the resulting output and test artefacts out of the container and into the folder charts/build directory, ready for inclusion in the CI server’s downloadable artefacts.

make python-test runs the application test procedures (except the ones marked as post_deployment) defined in the folder tests without starting a new pod. The result will be found in the build.

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

[Development]

[0.5.1]

Fixed

  • Python logging setup now correctly follows the -v command line option.

[0.5.0]

Changed

  • BREAKING Moved sourceOffset and mock_offset_paths to Mock Dish Leafnode

[0.4.0]

Added

  • Added support for time axis in pointing table

  • Added sourceOffset attribute to Mock Dish Master

  • Added mock_offset_paths property for source offset data to Mock Dish Master

Changed

  • BREAKING Renamed mock_data_paths attribute to mock_achieved_paths on Mock Dish Master

  • BREAKING Renamed mock_data_paths attribute to mock_desired_paths on Mock Dish Leafnode

[0.3.0]

Added

  • Added support for multiple scans of datasets.

Changed

  • Changed Start() command to Scan(scan_id)

  • Changed Stop() command to EndScan()

  • Changed mock_data_path to mock_data_paths

[0.2.0]

Added

  • Mock Dish Master and Mock Dish Leafnode doc pages

Changed

  • Changed desired_pointing attribute name to desiredPointing

  • Changed achieved_pointing attribute name to achievedPointing

[0.1.0]

Added

  • Added Mock Dish Leafnode

  • Added Mock Dish Master