Skip to content

Commit 52458c7

Browse files
merge
2 parents 73a150a + 3917c37 commit 52458c7

8 files changed

Lines changed: 24 additions & 56 deletions

File tree

scripts/kfvib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def plot_cl_rtf(data, timestamp, save=False):
5555
plt.show()
5656

5757
# start ad hoc modifications to the observe/control matrices
58-
klqg.R *= 1000
58+
klqg.R *= 1e6
5959
# end modifications
6060
klqg.recompute()
6161

scripts/seal_schedule.py

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,18 @@
11
import numpy as np
22
from matplotlib import pyplot as plt
3-
import sys
4-
import re
5-
from os.path import join
3+
from sealrtc import loadres
4+
from sealrtc import joindata
65

76
fs = 100
87

9-
def stamp_to_seconds(t):
10-
h, m, s, ms = [int(x) for x in re.search("(\d+):(\d+):(\d+),(\d+)", t).groups()]
11-
return 3600 * h + 60 * m + s + 0.001 * ms
8+
good_run = "2021_11_19_08_44_34"
129

13-
good_runs = ["07_02_14", "07_04_45", "08_11_19", "08_11_46"]
10+
res = loadres("lqg/klqg_nstate_18_amp_0.005_ang_0.7854_f_1_tstamp_2021_11_19_08_44_34.csv")
11+
exposures = res.texp
12+
measures = res.tmeas
13+
dmcs = res.tdmc
1414

15-
exposures = []
16-
measures = []
17-
dmcs = []
18-
19-
total_nframes = 0
20-
for fname in good_runs:
21-
with open(join("..", "data", "log", f"log_13_11_2021_{fname}.log")) as file:
22-
final_frame = np.inf
23-
for line in file:
24-
time = re.search("\d+:\d+:\d+,\d+", line)[0]
25-
seconds = stamp_to_seconds(time)
26-
event = re.search("INFO \| (.+)", line)[1]
27-
if not any([event.startswith(x) for x in ["Exposure", "Measurement", "DMC"]]):
28-
continue
29-
frame_num = re.search("\d+", event)
30-
if frame_num:
31-
frame_num = int(frame_num[0])
32-
if event.startswith("Exposure"):
33-
exposures.append(seconds)
34-
elif event.startswith("Measurement"):
35-
measures.append(seconds)
36-
elif event.startswith("DMC"):
37-
dmcs.append(seconds)
38-
final_frame = frame_num
39-
total_nframes += final_frame
40-
exposures = exposures[:total_nframes]
41-
measures = measures[:total_nframes]
42-
dmcs = dmcs[:total_nframes]
43-
44-
t0 = exposures[0]
45-
exposures = np.array(exposures) - t0
46-
measures = np.array(measures) - t0
47-
dmcs = np.array(dmcs) - t0
48-
49-
nstart = 1200
15+
nstart = 600
5016
npoints = 30
5117
tstart = exposures[nstart]
5218
plt.figure(figsize=(8,6))

seal_schedule.pdf

14.7 KB
Binary file not shown.

sealrtc/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
def make_experiments():
77
optics = make_optics
88
# Some predefined experiments
9-
short_wait = Experiment(make_noise, 1)
10-
med_wait = Experiment(make_noise, 10)
11-
long_wait = Experiment(make_noise, 100)
9+
short_wait = Experiment(make_noise, 1, optics)
10+
med_wait = Experiment(make_noise, 10, optics)
11+
long_wait = Experiment(make_noise, 100, optics)
1212

13-
ustep_tilt = Experiment(make_ustep, 1, tilt_amp=0.005, tip_amp=0.0)
14-
ustep_tip = Experiment(make_ustep, 1, tilt_amp=0.0, tip_amp=0.005)
13+
ustep_tilt = Experiment(make_ustep, 1, optics, tilt_amp=0.005, tip_amp=0.0)
14+
ustep_tip = Experiment(make_ustep, 1, optics, tilt_amp=0.0, tip_amp=0.005)
1515

16-
sine_one = Experiment(make_sine, 10, amp=0.003, ang=np.pi/4, f=1)
17-
sine_five = Experiment(make_sine, 10, amp=0.003, ang=np.pi/4, f=5)
16+
sine_one = Experiment(make_sine, 10, optics, amp=0.003, ang=np.pi/4, f=1)
17+
sine_five = Experiment(make_sine, 10, optics, amp=0.003, ang=np.pi/4, f=5)
1818

1919
# and some controllers from the controller submodule
2020
ol = make_openloop()

sealrtc/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
dmdims = (320, 320)
55
imdims = (320, 320)
6-
fs = 50.0 # Hz
6+
fs = 100.0 # Hz
77
dt = 1 / fs
88
wav0 = 1.65e-6 #assumed wav0 for sine amplitude input in meters
99
beam_ratio = 5.361256544502618 #pixels/resel

sealrtc/experiments/experiment.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
import sys
66
import logging
7-
import warnings
7+
from multiprocessing import Process
8+
from functools import partial
89

9-
from threading import Thread
10-
from abc import ABC
1110
import numpy as np
1211
from copy import copy
1312

@@ -121,8 +120,8 @@ def run(self, con):
121120
t_start = mns()
122121

123122
processes = [
124-
Process(target=scheduled_loop, args=(partial(self.loop_iter, controller), t_start)),
125-
Process(target=scheduled_loop, args=(self.disturb_iter, t_start))
123+
Process(target=self.scheduled_loop, args=(partial(self.loop_iter, controller), t_start)),
124+
Process(target=self.scheduled_loop, args=(self.disturb_iter, t_start))
126125
]
127126

128127
for p in processes:

sealrtc/optics/fast.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import time
2+
import warnings
23
import numpy as np
34

45
from .optics import Optics
@@ -19,6 +20,7 @@ def __init__(self):
1920
self.dmdims = self.getdmc().shape
2021
self.imdims = self.getim().shape
2122
self.name = "FAST_LODM"
23+
self.set_process_vars()
2224
port = "5556"
2325
context = zmq.Context()
2426
self.socket = context.socket(zmq.REQ)

sealrtc/optics/optics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def set_process_vars(self):
3333
sidemask = np.zeros(self.imdims)
3434
sidemaskind = np.where(sidemaskrho < sidemaskrad)
3535
sidemask[sidemaskind] = 1
36+
self.mtfgrid = mtfgrid
3637
self.sidemask = sidemask
3738

3839
#central lobe MTF mask

0 commit comments

Comments
 (0)