main_script_virgo/figure_overleaf.py

74 lines
2.1 KiB
Python
Executable file

#!/usr/bin/env python3
from gettext import install
from logging import basicConfig, getLogger
from warnings import filterwarnings
from backscattering_analyzer.acquisition import AcquisitionType
from backscattering_analyzer.experiment import Experiment
from rich.logging import RichHandler
from matplotlib.pyplot import figure, show
install(__name__)
filterwarnings("error")
basicConfig(
level = "INFO",
format = "%(message)s",
datefmt = "[%X]",
handlers = [RichHandler()],
)
logger = getLogger(__name__)
date = "2024_06_07"
bancs = [
"SNEB",
"SWEB",
"SDB1",
"SDB2",
]
experiment = Experiment(
bench = bancs[0],
date = date,
values_file = "values-coupling.toml",
)
reference = experiment.data.reference.sensibility.psd().sqrt()
projections = [experiment.compute_projection(
type = AcquisitionType.REFERENCE,
)]
for banc in bancs[1:]:
experiment = Experiment(
bench = banc,
date = date,
values_file = "values-coupling.toml",
)
projections.append(experiment.compute_projection( # type: ignore[reportUnknownVariable]
type = AcquisitionType.REFERENCE,
))
fig = figure()
axes = fig.add_subplot(1, 1, 1) # type: ignore[reportUnknownVariable]
axes.loglog( # type: ignore[reportUnknownVariable]
reference.x,
reference.y,
)
for index in range(len(bancs)):
axes.loglog( # type: ignore[reportUnknownVariable]
projections[index].x,
projections[index].y,
label = _("{bench} projection").format(bench = bancs[index]) # type: ignore[reportUnknownVariable]
)
axes.set_xlabel(_("frequencies")) # type: ignore[reportUnknownVariable]
axes.set_ylabel(_("sensibility ($\\frac{1}{\\sqrt{Hz}}$)")) # type: ignore[reportUnknownVariable]
axes.set_title(_("Projection pour un interféromètre dans une condition nominale")) # type: ignore[reportUnknownVariable]
temp = axes.set_xlim(5, 100)
temp = axes.set_ylim(10e-28, 10e-18)
temp = axes.legend() # type: ignore[reportUnknownVariable]
axes.grid(True, "both") # type: ignore[reportUnknownVariable]
show()