Add projection logic
This commit is contained in:
parent
621ff637da
commit
ab3d840bd3
4 changed files with 71 additions and 0 deletions
13
src/backscattering_analyzer/modelisation/__init__.py
Normal file
13
src/backscattering_analyzer/modelisation/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
from backscattering_analyzer.modelisation.bench import Bench
|
||||||
|
|
||||||
|
|
||||||
|
class Modelisation:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
injection_power: float,
|
||||||
|
dark_fringe_power: float,
|
||||||
|
benches: list[Bench],
|
||||||
|
):
|
||||||
|
self.injection_power = injection_power
|
||||||
|
self.dark_fringe_power = dark_fringe_power
|
||||||
|
self.benches = benches
|
10
src/backscattering_analyzer/modelisation/bench.py
Normal file
10
src/backscattering_analyzer/modelisation/bench.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from backscattering_analyzer.modelisation.transferfunction import (
|
||||||
|
TransferFunction,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Bench:
|
||||||
|
def __init__(self, name: str, signal: TransferFunction, fsc: float):
|
||||||
|
self.name = name
|
||||||
|
self.signal = signal
|
||||||
|
self.fsc = fsc
|
|
@ -0,0 +1,7 @@
|
||||||
|
from gwpy.frequencyseries import FrequencySeries
|
||||||
|
|
||||||
|
|
||||||
|
class TransferFunction:
|
||||||
|
def __init__(self, kn: FrequencySeries, kp: FrequencySeries):
|
||||||
|
self.kn = kn
|
||||||
|
self.kp = kp
|
41
src/backscattering_analyzer/projection.py
Normal file
41
src/backscattering_analyzer/projection.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
from backscattering_analyzer.measurement import Measurement
|
||||||
|
from backscattering_analyzer.modelisation import Modelisation
|
||||||
|
from backscattering_analyzer.modelisation.bench import Bench
|
||||||
|
from numpy import sin, cos, pi, sqrt
|
||||||
|
from gwpy.frequencyseries import FrequencySeries
|
||||||
|
|
||||||
|
|
||||||
|
class Projection:
|
||||||
|
def __init__(
|
||||||
|
self, measurement: Measurement, modelisation: Modelisation
|
||||||
|
):
|
||||||
|
self.measurement = measurement
|
||||||
|
self.modelisation = modelisation
|
||||||
|
self.results: list[FrequencySeries] = []
|
||||||
|
|
||||||
|
for bench in self.measurement.benches:
|
||||||
|
modelisation_bench: None | Bench = None
|
||||||
|
for i in range(len(self.modelisation.benches)):
|
||||||
|
if bench.name == self.modelisation.benches[i].name:
|
||||||
|
modelisation_bench = self.modelisation.benches[i]
|
||||||
|
if modelisation_bench is None:
|
||||||
|
raise Exception(
|
||||||
|
"missing bench modelisation for {}".format(
|
||||||
|
bench.name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
phase = 4 * pi / 1.064e-6
|
||||||
|
sin_side = sin(
|
||||||
|
bench.movement * phase
|
||||||
|
).asd(
|
||||||
|
0.001
|
||||||
|
) # FIXME: To change (0.001 s: what are 10 points for the movement rate ?)
|
||||||
|
cos_side = cos(bench.movement * phase).asd(0.001)
|
||||||
|
self.results.append(
|
||||||
|
sqrt(modelisation_bench.fsc)
|
||||||
|
/ phase
|
||||||
|
* (
|
||||||
|
modelisation_bench.signal.kn * sin_side
|
||||||
|
+ modelisation_bench.signal.kp * cos_side
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in a new issue