Commit 48da51fc authored by Daniel Brown's avatar Daniel Brown
Browse files

evaling quad ss can be pretty slow, so just cache the results and keep reusing that

parent 655b69fc
......@@ -100,6 +100,8 @@ class LIGOQuadSuspension(Connector):
>>> }, f, protocol=3)
__QUAD_ss_cache = {}
def __init__(self, name, connect_to):
mech_port = get_mechanical_port(connect_to)
......@@ -258,7 +260,15 @@ class LIGOQuadSuspension(Connector):
of the proposed algorithm.
s = 2j * np.pi * ws.sim.model_data.fsig
H =
# This is a fairly slow process, however, we keep evaluating the same
# state space over and over again, so just cache it in a dict then
# allow multiple quad sus models to call from it. Obviously breaks if
# someone changes the ABCD values
H = self.__QUAD_ss_cache.get(s)
if H is None:
H =
self.__QUAD_ss_cache[s] = H
for i in range(ws.N):
with ws.sim.signal.component_edge_fill3(ws.owner_id, i, 0, 0) as mat:
mat[:] = H[ws.odxs[i], ws.idxs[i]]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment