Fix typo & add 2024_06_07 observation
This commit is contained in:
parent
3bbcc3bbed
commit
03d704b97a
4 changed files with 266 additions and 1 deletions
186
.ipynb_checkpoints/display-checkpoint.py
Executable file
186
.ipynb_checkpoints/display-checkpoint.py
Executable file
|
@ -0,0 +1,186 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from gettext import install
|
||||
from backscattering_analyzer.display import show_projection # type: ignore[reportMissingTypeStubs]
|
||||
from backscattering_analyzer.experiment import AcquisitionType, Experiment # type: ignore[reportMissingTypeStubs]
|
||||
from logging import basicConfig, getLogger
|
||||
from rich.console import Console
|
||||
from rich.theme import Theme
|
||||
from rich.logging import RichHandler
|
||||
from warnings import filterwarnings
|
||||
from command_parser.flag import Flag # type: ignore[reportMissingTypeStubs]
|
||||
from command_parser.value import Value # type: ignore[reportMissingTypeStubs]
|
||||
from command_parser.parser import parse # type: ignore[reportMissingTypeStubs]
|
||||
from sys import argv
|
||||
from importlib.metadata import version
|
||||
|
||||
install(__name__)
|
||||
|
||||
filterwarnings("error")
|
||||
|
||||
flags = [
|
||||
Flag("help"),
|
||||
Flag("version", single_char="V"),
|
||||
Flag("verbose"),
|
||||
Flag("full"),
|
||||
]
|
||||
values = [
|
||||
Value("date", "2023_03_24"),
|
||||
Value("bench", "SDB1"),
|
||||
Value("file", "values.toml", single_char="F"),
|
||||
Value("vibration-frequency", "0.2"),
|
||||
]
|
||||
parse(" ".join(argv[1:]), flags, values)
|
||||
|
||||
if flags[0].value:
|
||||
theme = Theme(
|
||||
{
|
||||
"main": "white bold",
|
||||
"option": "grey50 italic",
|
||||
"argument": "red",
|
||||
"description": "green italic",
|
||||
}
|
||||
)
|
||||
console = Console(theme=theme)
|
||||
help = (
|
||||
"[main]display[/main] [option]\\[options][/option]"
|
||||
"\n [argument]-b --bench[/argument] [description]bench of the experiment[/description]"
|
||||
"\n [argument]-d --date[/argument] [description]date of the experiment[/description]"
|
||||
"\n [argument]-h --help[/argument] [description]print this help and exit[/description]"
|
||||
"\n [argument]-f --full[/argument] [description]run experiment with all benches with all dates[/description]"
|
||||
"\n [argument]-F --file[/argument] [description]file containing all the parameters values (toml file)[/description]"
|
||||
"\n [argument]-v --verbose[/argument] [description]be verbose[/description]"
|
||||
"\n [argument]-V --version[/argument] [description]print version number and exit[/description]"
|
||||
)
|
||||
console.print(help)
|
||||
exit(0)
|
||||
|
||||
if flags[1].value:
|
||||
version = (
|
||||
"Versions\n"
|
||||
"numpy {numpy}\n"
|
||||
"scipy {scipy}\n"
|
||||
"matplotlib {matplotlib}\n"
|
||||
"science_signal {science_signal}\n"
|
||||
"backscattering_analyzer {backscattering_analyzer}\n"
|
||||
"command_parser {command_parser}\n"
|
||||
"script 0.1.0\n"
|
||||
).format(
|
||||
numpy=version("numpy"),
|
||||
scipy=version("scipy"),
|
||||
matplotlib=version("matplotlib"),
|
||||
science_signal=version("science_signal"),
|
||||
backscattering_analyzer=version("backscattering_analyzer"),
|
||||
command_parser=version("command_parser"),
|
||||
)
|
||||
console = Console()
|
||||
console.print(version)
|
||||
exit(0)
|
||||
|
||||
if flags[2].value:
|
||||
level = "DEBUG"
|
||||
else:
|
||||
level = "INFO"
|
||||
|
||||
|
||||
basicConfig(
|
||||
level=level,
|
||||
format="%(message)s",
|
||||
datefmt="[%X]",
|
||||
handlers=[RichHandler()],
|
||||
)
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
if flags[3].value:
|
||||
logger.debug(_("loading every experiments"))
|
||||
experiments: list[Experiment] = []
|
||||
results: dict[str, float | None] = dict({})
|
||||
for bench in ["SDB1", "SDB2", "SNEB", "SWEB"]:
|
||||
if bench in ["SDB1", "SDB2"]:
|
||||
experiment = Experiment(
|
||||
bench,
|
||||
"2023_03_24",
|
||||
values[2].value,
|
||||
float(values[3].value),
|
||||
)
|
||||
if bench == "SDB1":
|
||||
start_frequency, end_frequency = 12.5, 30
|
||||
else:
|
||||
start_frequency, end_frequency = 40, 50
|
||||
experiment.factors = experiment.fit_factors(
|
||||
start_frequency=start_frequency,
|
||||
end_frequency=end_frequency,
|
||||
)
|
||||
results[
|
||||
"{bench}-{date}".format(
|
||||
bench=bench,
|
||||
date="2023_03_24",
|
||||
)
|
||||
] = experiment.factors["true"]
|
||||
elif bench == "SNEB":
|
||||
for date in ["2023_03_24", "2024_01_21"]:
|
||||
experiment = Experiment(
|
||||
bench,
|
||||
date,
|
||||
values[2].value,
|
||||
float(values[3].value),
|
||||
)
|
||||
experiment.factors = experiment.fit_factors(
|
||||
start_frequency=15,
|
||||
end_frequency=100,
|
||||
)
|
||||
results["{bench}-{date}".format(bench=bench, date=date)] = (
|
||||
experiment.factors["true"]
|
||||
)
|
||||
else: # bench == SWEB
|
||||
for date in ["2023_03_24", "2023_12_20"]:
|
||||
experiment = Experiment(
|
||||
bench,
|
||||
date,
|
||||
values[2].value,
|
||||
float(values[3].value),
|
||||
)
|
||||
experiment.factors = experiment.fit_factors(
|
||||
start_frequency=15,
|
||||
end_frequency=100,
|
||||
)
|
||||
results["{bench}-{date}".format(bench=bench, date=date)] = (
|
||||
experiment.factors["true"]
|
||||
)
|
||||
console = Console()
|
||||
console.print(results)
|
||||
|
||||
else:
|
||||
experiment = Experiment(
|
||||
values[1].value, values[0].value, values[2].value, float(values[3].value)
|
||||
)
|
||||
|
||||
if experiment.bench == "SDB1":
|
||||
start_frequency, end_frequency = 12.5, 30
|
||||
elif experiment.bench == "SDB2":
|
||||
start_frequency, end_frequency = 40, 50
|
||||
else:
|
||||
start_frequency, end_frequency = 15, 100
|
||||
|
||||
try:
|
||||
experiment.factors = experiment.fit_factors(
|
||||
start_frequency=start_frequency,
|
||||
end_frequency=end_frequency,
|
||||
)
|
||||
experiment.projection_reference = experiment.compute_projection(
|
||||
AcquisitionType.REFERENCE
|
||||
)
|
||||
experiment.projection_excited = experiment.compute_projection(
|
||||
AcquisitionType.EXCITED
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
#show_projection(experiment, start_frequency, end_frequency)
|
||||
import matplotlib.pyplot as plt
|
||||
plt.loglog(experiment.coupling[0].x, experiment.coupling[0].y)
|
||||
plt.loglog(experiment.coupling[1].x, experiment.coupling[1].y)
|
||||
plt.show()
|
||||
|
||||
exit(0)
|
|
@ -93,7 +93,7 @@ basicConfig(
|
|||
logger = getLogger(__name__)
|
||||
|
||||
if flags[3].value:
|
||||
logger.debug(_("loading every experiments"))
|
||||
logger.debug(_("loading every experiments")) # type: ignore[reportUnknownArgumentType]
|
||||
experiments: list[Experiment] = []
|
||||
results: dict[str, float | None] = dict({})
|
||||
for bench in ["SDB1", "SDB2", "SNEB", "SWEB"]:
|
||||
|
|
74
figure_overleaf.py
Executable file
74
figure_overleaf.py
Executable file
|
@ -0,0 +1,74 @@
|
|||
#!/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()
|
|
@ -49,3 +49,8 @@
|
|||
dark_fringe = 4.445e-3
|
||||
modelisation = "scatterCoupling_dec_jan.mat"
|
||||
correct-power = false
|
||||
[dates.2024_06_07]
|
||||
laser = 12.1
|
||||
dark_fringe = 4.445e-3
|
||||
modelisation = "scatterCoupling_dec_jan.mat"
|
||||
correct-power = false
|
||||
|
|
Loading…
Reference in a new issue