3. Advanced topics > 3. Reduced order modelling
Making a reduced order model of a mirror map
Author: Daniel Brown
This notebook demonstrates how you can take a mirror map you are using in Finesse and make a reduced order model (ROM) of it. In the end this allows us to make a reduced order quadrature rule for efficiently calculating the modal scattering of an incoming beam. The output of this process will be the weights for this quadrature rule which can be used in both Finesse or Pykat. This assumes that you already have:
These topics are covered in other notebooks. In this tutorial we will be using a previously generated empirical interpolant for the advanced LIGO arm cavities. These have been generated for both the ITM and ETM for a range of cavity states likely to be seen in the aLIGO arm cavities. You can get these for yourself in the subfolder aligo_arm.
First we need to import some basics:
import pykat
import pickle
from pykat.optics.maps import read_map
from pykat.optics.romhom import read_EI
pykat.init_pykat_plotting()
Then we need to define what map, output and empirical interpolant we will be using:
map_file = "etm08_virtual.map"
outfile_file = "etm08_virtual" # Code will append the '.rom' file extension
EI_file = "aligo_arm/ETM_14_EI.p"
Reading the map in we should double check we have the correct map:
m = read_map(map_file)
fig = m.plot()
It is a good idea to check the limits and ranges of the empirical interpolant you are using. This can be done with the helper function to read an EI in:
ei = read_EI(EI_file, verbose=True)
print(m.size)
print(m.x.max(), m.x.min())
Above we can see the map size and also the map size that the ROM was produced for. The map we are using doesn't have the same number of points but has the same range. Small differences like this can easily be fixed by interpolating our current map data. This is done internally in the code when using the interpolate=True
argument as seen below.
We are now ready to generate the weights for an efficient quadrature rule:
m.generateROMWeights(EI_file, verbose=True, interpolate=True)
Finally, we can just write these weights to a file:
m.ROMWeights.writeToFile(outfile_file)
This weights file can then be used in Finesse instead of the original map file. This will result in faster numerical integration that is required to compute higher order mode scattering.