Skip to main content

Python interface and tools for FINESSE

Project description

PyKat is a wrapper for using FINESSE ( It aims to provide a Python toolset for automating more complex tasks as well as providing a GUI for manipulating and viewing simulation setups.


The easiest way to install PyKat is through PyPi:

pip install pykat

If you are a Windows user you also have the option to download the installer at

You will also need to ensure that you have a fully working copy of FINESSE installed and setup on your machine. More details on this can be found at


This does not detail how to use FINESSE itself, just PyKat. FINESSE related queries should be directed at the FINESSE manual or the forum

We highly recommend running PyKat with IPython, it has so far provided the best way to explore the various PyKat objects and output data. Also of use is IPythons interactive matplotlib mode - or pylab mode - which makes displaying and interacting with multiple plots easy. You can start pylab mode from a terminal using:

ipython -pylab

Regardless of which interpreter you use, to begin using PyKat you first need to include the following:

from pykat import finesse
from pykat.detectors import *
from pykat.components import *
from pykat.commands import *
from pykat.structs import *

This provides all the various FINESSE components and commands you will typically need. Running a simulation requires you to already know how to code FINESSE files, which is beyond the scope of this readme. FINESSE commands can be entered in many ways: Reading in a previous .kat file, creating pykat objects representing the various FINESSE commands or by wring blocks of code as shown next:

import pylab as pl

code = """
l l1 1 0 0 n1
s s1 10 1 n1 n2
m m1 0.5 0.5 0 n2 n3
s s2 10 1 n3 n4
m m2 0.5 0.5 0 n4 n5
s s3 10 1 n5 n6

yaxis abs:deg

# this kat object represents one single simulation, it containts
# all the objects and their various states.
kat = finesse.kat()
# Currently the kat object is empty. We can fill it using a block
# string of normal FINESSE commands by parsing them.
# Once we have some simulation built up we can run it simply by calling...
out =

# This out object contains the results from this run of the simulation.
# Parameters can then be changed and can be called again producing
# another output object.

# We can plot the output simply enough using pylab plotting.
pl.plot(out.x, out["pd_cav"])
pl.ylabel("Intensity [W]")

The above demonstates a way of packaging up a FINESSE simulation - simple or complex - and including any post-processing and plotting in one Python script file. Or you can create kat files separately and produce Python scripts to run and process them, that choice is upto you, Pykat provides the means to be used in both ways.

Finesse Test Server

A Flask based website that runs the Finesse test suites is included in PyKat. This can be hosted in Apache or run as a development server for quick testing on a system. This is a developer tool for testing FINESSE against a selection of known test cases.


Flask Numpy

Command to start server:

python -m pykat.test.web_server --path=[path to create website] --port=[HTTP port] --git-bin=[path to git binary]

The website can then be accessed in a web browser at the address: localhost:[port]

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (93.7 kB view hashes)

Uploaded Source

Built Distributions (296.1 kB view hashes)

Uploaded Source

PyKat-0.2.4.win32.tar.gz (130.5 kB view hashes)

Uploaded Source

PyKat-0.2.4.win32.exe (268.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page