Fix error when reference-only data given
This commit is contained in:
parent
35ae306712
commit
d49ca3e39f
2 changed files with 31 additions and 21 deletions
|
@ -21,33 +21,40 @@ def show_projection(
|
||||||
ylabel,
|
ylabel,
|
||||||
)
|
)
|
||||||
|
|
||||||
excited = experiment.data.excited.sensibility.psd().sqrt()
|
|
||||||
reference = experiment.data.reference.sensibility.psd().sqrt()
|
reference = experiment.data.reference.sensibility.psd().sqrt()
|
||||||
loglog(
|
try:
|
||||||
experiment.projection_excited.x,
|
excited = experiment.data.excited.sensibility.psd().sqrt()
|
||||||
experiment.projection_excited.y,
|
loglog(
|
||||||
label=_("projection with excitation"),
|
experiment.projection_excited.x,
|
||||||
) # type: ignore[ReportUnusedCallResult]
|
experiment.projection_excited.y,
|
||||||
|
label=_("projection with excitation"),
|
||||||
|
) # type: ignore[ReportUnusedCallResult]
|
||||||
|
loglog(
|
||||||
|
excited.x,
|
||||||
|
excited.y,
|
||||||
|
label=_("detected sensibility with excitation"),
|
||||||
|
) # type: ignore[ReportUnusedCallResult]
|
||||||
|
loglog(
|
||||||
|
(experiment.projection_excited + reference).x,
|
||||||
|
(experiment.projection_excited + reference).y,
|
||||||
|
label=_(
|
||||||
|
"sum: no excitation and projection with excitation"
|
||||||
|
),
|
||||||
|
) # type: ignore[ReportUnusedCallResult]
|
||||||
|
except AttributeError:
|
||||||
|
logger.debug(
|
||||||
|
_("no excited signal, will only show reference signal")
|
||||||
|
)
|
||||||
loglog(
|
loglog(
|
||||||
experiment.projection_reference.x,
|
experiment.projection_reference.x,
|
||||||
experiment.projection_reference.y,
|
experiment.projection_reference.y,
|
||||||
label=_("projection without excitation"),
|
label=_("projection without excitation"),
|
||||||
) # type: ignore[ReportUnunsedCallResult]
|
) # type: ignore[ReportUnunsedCallResult]
|
||||||
loglog(
|
|
||||||
excited.x,
|
|
||||||
excited.y,
|
|
||||||
label=_("detected sensibility with excitation"),
|
|
||||||
) # type: ignore[ReportUnusedCallResult]
|
|
||||||
loglog(
|
loglog(
|
||||||
reference.x,
|
reference.x,
|
||||||
reference.y,
|
reference.y,
|
||||||
label=_("detected sensibility without excitation"),
|
label=_("detected sensibility without excitation"),
|
||||||
) # type: ignore[ReportUnusedCallResult]
|
) # type: ignore[ReportUnusedCallResult]
|
||||||
loglog(
|
|
||||||
(experiment.projection_excited + reference).x,
|
|
||||||
(experiment.projection_excited + reference).y,
|
|
||||||
label=_("sum: no excitation and projection with excitation"),
|
|
||||||
) # type: ignore[ReportUnusedCallResult]
|
|
||||||
legend() # type: ignore[ReportUnusedCallResult]
|
legend() # type: ignore[ReportUnusedCallResult]
|
||||||
title(experiment.bench) # type: ignore[ReportUnusedCallResult]
|
title(experiment.bench) # type: ignore[ReportUnusedCallResult]
|
||||||
xlabel(_("frequency (Hz)")) # type: ignore[ReportUnusedCallResult]
|
xlabel(_("frequency (Hz)")) # type: ignore[ReportUnusedCallResult]
|
||||||
|
|
|
@ -203,7 +203,7 @@ class Experiment:
|
||||||
self.calibrations,
|
self.calibrations,
|
||||||
vibration_frequency,
|
vibration_frequency,
|
||||||
)
|
)
|
||||||
except ValueError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
logger.debug(_("movement processed"))
|
logger.debug(_("movement processed"))
|
||||||
|
|
||||||
|
@ -255,12 +255,15 @@ class Experiment:
|
||||||
)
|
)
|
||||||
self.factors = self.fit_factors()
|
self.factors = self.fit_factors()
|
||||||
|
|
||||||
self.projection_excited = self.compute_projection(
|
|
||||||
AcquisitionType.EXCITED,
|
|
||||||
)
|
|
||||||
self.projection_reference = self.compute_projection(
|
self.projection_reference = self.compute_projection(
|
||||||
AcquisitionType.REFERENCE,
|
AcquisitionType.REFERENCE,
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
self.projection_excited = self.compute_projection(
|
||||||
|
AcquisitionType.EXCITED,
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
logger.debug(_("end of experiment initialisation"))
|
logger.debug(_("end of experiment initialisation"))
|
||||||
|
|
||||||
def get_factors(
|
def get_factors(
|
||||||
|
@ -294,7 +297,7 @@ class Experiment:
|
||||||
)
|
)
|
||||||
raise Exception(
|
raise Exception(
|
||||||
_(
|
_(
|
||||||
"no excited signal given, cannot get facotrs "
|
"no excited signal given, cannot get factors "
|
||||||
+ "of the excited signal"
|
+ "of the excited signal"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue