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,
|
||||
)
|
||||
|
||||
excited = experiment.data.excited.sensibility.psd().sqrt()
|
||||
reference = experiment.data.reference.sensibility.psd().sqrt()
|
||||
try:
|
||||
excited = experiment.data.excited.sensibility.psd().sqrt()
|
||||
loglog(
|
||||
experiment.projection_excited.x,
|
||||
experiment.projection_excited.y,
|
||||
label=_("projection with excitation"),
|
||||
) # type: ignore[ReportUnusedCallResult]
|
||||
loglog(
|
||||
experiment.projection_reference.x,
|
||||
experiment.projection_reference.y,
|
||||
label=_("projection without excitation"),
|
||||
) # type: ignore[ReportUnunsedCallResult]
|
||||
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(
|
||||
experiment.projection_reference.x,
|
||||
experiment.projection_reference.y,
|
||||
label=_("projection without excitation"),
|
||||
) # type: ignore[ReportUnunsedCallResult]
|
||||
loglog(
|
||||
reference.x,
|
||||
reference.y,
|
||||
label=_("detected sensibility without 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]
|
||||
legend() # type: ignore[ReportUnusedCallResult]
|
||||
title(experiment.bench) # type: ignore[ReportUnusedCallResult]
|
||||
xlabel(_("frequency (Hz)")) # type: ignore[ReportUnusedCallResult]
|
||||
|
|
|
@ -203,7 +203,7 @@ class Experiment:
|
|||
self.calibrations,
|
||||
vibration_frequency,
|
||||
)
|
||||
except ValueError:
|
||||
except AttributeError:
|
||||
pass
|
||||
logger.debug(_("movement processed"))
|
||||
|
||||
|
@ -255,12 +255,15 @@ class Experiment:
|
|||
)
|
||||
self.factors = self.fit_factors()
|
||||
|
||||
self.projection_excited = self.compute_projection(
|
||||
AcquisitionType.EXCITED,
|
||||
)
|
||||
self.projection_reference = self.compute_projection(
|
||||
AcquisitionType.REFERENCE,
|
||||
)
|
||||
try:
|
||||
self.projection_excited = self.compute_projection(
|
||||
AcquisitionType.EXCITED,
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
logger.debug(_("end of experiment initialisation"))
|
||||
|
||||
def get_factors(
|
||||
|
@ -294,7 +297,7 @@ class Experiment:
|
|||
)
|
||||
raise Exception(
|
||||
_(
|
||||
"no excited signal given, cannot get facotrs "
|
||||
"no excited signal given, cannot get factors "
|
||||
+ "of the excited signal"
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue