GaussConv Service

The GaussConv Service provides a FastAPI-based application to apply Gaussian convolution filters to FITS images.
It allows users to send an input FITS file, apply a Gaussian filter with a configurable sigma value, and receive the processed FITS image as output.

This service can be deployed locally (for testing and development), via Docker containers, or through a GitOps-based deployment (FluxCD/ArgoCD) as part of the SRCNet Local Optional Services.


Purpose

The GaussConv service enables the application of Gaussian convolution filters to astronomical FITS images, providing a convenient REST API for users and other SRCNet services.

Main functionalities:

  • FastAPI-based REST API – lightweight and efficient

  • Gaussian convolution – configurable sigma values for image smoothing

  • Dockerized – portable and production-ready

  • Integration with SRCNet workflows

This service supports flexible sigma values (1.0–10.0), enabling adaptive processing for different use cases.


Prerequisites

To run or deploy the service, the following dependencies are required:

  • Python 3.8 or higher

  • FastAPI

  • Uvicorn (ASGI server)

  • Astropy (for FITS file handling)

  • SciPy (for Gaussian filtering)

  • Requests (for client-side interactions)

  • Docker (for container-based deployment)

  • Optional: FluxCD / ArgoCD for GitOps-based integration

Ensure that your host has sufficient permissions to pull images and create local volumes if needed.


Deployment

The service can be deployed in multiple ways: manually for testing, using Docker, or using GitOps.

A. Manual Installation (Testing and Development)

git clone https://gitlab.com/ska-telescope/src/src-ia/ska-src-ia-parser-lib-gaussian-convolution
cd ska-src-ia-gaussian-convolution
python -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000

B. Docker Deployment

docker build -t fits-gaussconv-service .
docker run -p 8000:8000 -e ABS_PATH=./data fits-gaussconv-service

To pull from a registry:

docker pull yourusername/fits-convolution-service
docker run -p 8000:8000 yourusername/fits-convolution-service

C. GitOps Deployment (FluxCD / ArgoCD)

The following manifests define a full Kubernetes deployment for the Gaussian Convolution service.

kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - deployment-gaussian-convolution.yaml
  - ServiceAccount.yaml
  - ClusterRoleBinding.yaml
  - fs-gaussian.pv.yaml
  - fs-gaussian.pvc.yaml
  - service-gaussian-convolution.yaml

deployment-gaussian-convolution.yaml

---
kind: Namespace
apiVersion: v1
metadata:
  name: gauss-conv
  labels:
    name: gauss-conv
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gaussian-convolution
  namespace: gauss-conv
spec:
  replicas: 3
  selector:
    matchLabels:
      app: gaussian-convolution
  template:
    metadata:
      labels:
        app: gaussian-convolution
    spec:
      containers:
        - name: gaussian-convolution
          image: registry.gitlab.com/ska-telescope/src/src-ia/ska-src-ia-parser-lib-gaussian-convolution:v1.0
          ports:
            - containerPort: 8000
          env:
            - name: ABS_PATH
              value: /data
          volumeMounts:
            - mountPath: /data
              name: parser-lib-volume
      volumes:
        - name: parser-lib-volume
          hostPath:
            path: /mnt/rucio/dev/deterministic
            type: Directory

ServiceAccount.yaml

apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: vault-secret-store
  namespace: gauss-conv
spec:
  provider:
    vault:
      server: "http://vault.vault.svc.cluster.local:8200"
      path: "app"
      version: "v2"
      auth:
        kubernetes:
          mountPath: "kubernetes"
          role: "gaussian-convolution"
          serviceAccountRef:
            name: "gaussian-convolution"

ClusterRoleBinding.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: vault-access-rolebinding
roleRef:
  kind: ClusterRole
  name: system:auth-delegator
  apiGroup: rbac.authorization.k8s.io
subjects:
  - kind: ServiceAccount
    name: gaussian-convolution
    namespace: gauss-conv

fs-gaussian.pv.yaml and fs-gaussian.pvc.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: parser-lib-pv
  namespace: gauss-conv
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /mnt/k8s-shared/homes/cavern/home
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: parser-lib-pvc
  namespace: gauss-conv
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

service-gaussian-convolution.yaml

apiVersion: v1
kind: Service
metadata:
  name: gaussian-convolution-service
  namespace: gauss-conv
spec:
  selector:
    app: gaussian-convolution
  type: NodePort
  ports:
    - port: 8000
      targetPort: 8000
      nodePort: 30188

Integration

The GaussConv Service can be integrated with other components in SRCNet that require automated FITS image pre-processing or filtering.

When deployed within an SRC node, it can be invoked directly by GateKeeper or other data processing workflows as a Function-as-a-Service (FaaS).

It supports local data access through mounted volumes and exposes endpoints that can be registered in the node’s registry service.


Testing

API Usage

The service exposes the following endpoint:

  • POST /gaussconv_fitsimg/

Request body:

{
  "ivo": "somepath?example.fits",
  "sigma": 2.5
}

Response: Binary FITS stream.

Example using curl:

curl -X POST "http://127.0.0.1:8000/gaussconv_fitsimg/"      -H "Content-Type: application/json"      -d '{"ivo": "somepath?example.fits", "sigma": 2.5}'      --output output.fits

Python Client (fits_gaussconv_client.py)

Arguments:

  • --ivo : Path to the FITS file (must contain ?)

  • --sigma : Sigma value between 1 and 10

  • --output : Output FITS filename

Usage:

python fits_gaussconv_client.py --ivo "somepath?example.fits" --sigma 2.5 --output output.fits

FAQ

Q1. What is the typical use case of GaussConv?
It’s used for smoothing or preprocessing astronomical FITS images before scientific analysis or visualization.

Q2. Can I deploy GaussConv without Kubernetes?
Yes. You can use the provided Dockerfile for local or standalone deployment.

Q3. Which SRCNet components can call this service?
It need to be invoked by GateKeeper.