Update coupling finding for sib2 and sdb2
This commit is contained in:
parent
363971e2c1
commit
d86b8ecfef
2 changed files with 18 additions and 13 deletions
|
@ -1,6 +1,5 @@
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
from scipy.interpolate import CubicSpline
|
|
||||||
from backscattering_analyzer.settings import Settings
|
from backscattering_analyzer.settings import Settings
|
||||||
from science_signal.signal import Signal
|
from science_signal.signal import Signal
|
||||||
from science_signal import interpolate
|
from science_signal import interpolate
|
||||||
|
@ -51,7 +50,7 @@ class Analyzer:
|
||||||
Load bench movement
|
Load bench movement
|
||||||
"""
|
"""
|
||||||
file = self.settings.bench_file()
|
file = self.settings.bench_file()
|
||||||
self.settings.log("loading bench movement")
|
self.settings.log("loading bench movement: {}".format(self.settings.bench_file()))
|
||||||
try:
|
try:
|
||||||
data = loadtxt(file).T
|
data = loadtxt(file).T
|
||||||
self.bench_movement = Signal(data[0], data[1]) * 1e-6 # um
|
self.bench_movement = Signal(data[0], data[1]) * 1e-6 # um
|
||||||
|
@ -63,10 +62,10 @@ class Analyzer:
|
||||||
Load mirror movement
|
Load mirror movement
|
||||||
"""
|
"""
|
||||||
file = self.settings.mirror_file()
|
file = self.settings.mirror_file()
|
||||||
self.settings.log("loading mirror movement")
|
self.settings.log("loading mirror movement: {}".format(self.settings.mirror_file()))
|
||||||
try:
|
try:
|
||||||
data = loadtxt(file).T
|
data = loadtxt(file).T
|
||||||
self.mirror_movement = Signal(data[0], data[1]) * 1e-6
|
self.mirror_movement = Signal(data[0], data[1]) * 1e-6 # um
|
||||||
except OSError:
|
except OSError:
|
||||||
raise Exception("{file} does not exist".format(file=file))
|
raise Exception("{file} does not exist".format(file=file))
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ class Analyzer:
|
||||||
Load excited h(t)
|
Load excited h(t)
|
||||||
"""
|
"""
|
||||||
file = self.settings.data_file()
|
file = self.settings.data_file()
|
||||||
self.settings.log("loading excited h(t)")
|
self.settings.log("loading excited h(t): {}".format(self.settings.data_file()))
|
||||||
try:
|
try:
|
||||||
data = loadtxt(file).T
|
data = loadtxt(file).T
|
||||||
self.data_signal = Signal(data[0], data[1])
|
self.data_signal = Signal(data[0], data[1])
|
||||||
|
@ -87,7 +86,7 @@ class Analyzer:
|
||||||
Load reference h(t)
|
Load reference h(t)
|
||||||
"""
|
"""
|
||||||
file = self.settings.reference_file()
|
file = self.settings.reference_file()
|
||||||
self.settings.log("loading reference h(t)")
|
self.settings.log("loading reference h(t): {}".format(self.settings.reference_file()))
|
||||||
try:
|
try:
|
||||||
data = loadtxt(file).T
|
data = loadtxt(file).T
|
||||||
self.reference_signal = Signal(data[0], data[1])
|
self.reference_signal = Signal(data[0], data[1])
|
||||||
|
@ -99,7 +98,7 @@ class Analyzer:
|
||||||
Load modelisation coupling data
|
Load modelisation coupling data
|
||||||
"""
|
"""
|
||||||
file = self.settings.modelisation_file()
|
file = self.settings.modelisation_file()
|
||||||
self.settings.log("loading matlab modelisation data")
|
self.settings.log("loading matlab modelisation data: {}".format(self.settings.modelisation_file()))
|
||||||
try:
|
try:
|
||||||
self.modelisation = loadmat(file)
|
self.modelisation = loadmat(file)
|
||||||
coupling_values = self.modelisation[
|
coupling_values = self.modelisation[
|
||||||
|
@ -152,6 +151,9 @@ class Analyzer:
|
||||||
"""
|
"""
|
||||||
if guess is None:
|
if guess is None:
|
||||||
guess = self.settings.scattering_factor[0]
|
guess = self.settings.scattering_factor[0]
|
||||||
|
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
phase = 4 * pi / self.settings.wavelength
|
phase = 4 * pi / self.settings.wavelength
|
||||||
factor_n = (self.movement * phase).sin().psd().sqrt()
|
factor_n = (self.movement * phase).sin().psd().sqrt()
|
||||||
coupling_n = abs(self.coupling[0])
|
coupling_n = abs(self.coupling[0])
|
||||||
|
@ -159,8 +161,8 @@ class Analyzer:
|
||||||
coupling_d = abs(self.coupling[1])
|
coupling_d = abs(self.coupling[1])
|
||||||
|
|
||||||
coupling_d = coupling_d.cut(
|
coupling_d = coupling_d.cut(
|
||||||
11,
|
10,
|
||||||
25,
|
200,
|
||||||
) # cut signal between 10 and 200 Hz (updated to 11-15 to test)
|
) # cut signal between 10 and 200 Hz (updated to 11-15 to test)
|
||||||
|
|
||||||
factor_n, coupling_n, factor_d, coupling_d, data, reference = (
|
factor_n, coupling_n, factor_d, coupling_d, data, reference = (
|
||||||
|
@ -195,8 +197,6 @@ class Analyzer:
|
||||||
|
|
||||||
factor: float = x[argmin(y)]
|
factor: float = x[argmin(y)]
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
projection = Signal(
|
projection = Signal(
|
||||||
factor_n.x,
|
factor_n.x,
|
||||||
opt_compute_light(
|
opt_compute_light(
|
||||||
|
|
|
@ -186,7 +186,12 @@ class Settings:
|
||||||
return self.folder / (self.modelisation)
|
return self.folder / (self.modelisation)
|
||||||
|
|
||||||
def coupling_name(self) -> str:
|
def coupling_name(self) -> str:
|
||||||
return "{bench}coupling".format(bench=self.bench)
|
bench = self.bench
|
||||||
|
if self.bench == 'SDB2':
|
||||||
|
bench = 'SDB1'
|
||||||
|
elif self.bench == 'SIB2':
|
||||||
|
bench = 'SIB1'
|
||||||
|
return "{bench}coupling".format(bench=bench)
|
||||||
|
|
||||||
def log(self, message: str) -> None:
|
def log(self, message: str) -> None:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
|
|
Loading…
Reference in a new issue