You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using sdynpy.core.sdynpy_data.PowerSpectralDensityArray.error_summary to compare test data (from a Rattlesnake virtual test) to a CPSD spec. Documentation says it should return a tuple of dictionaries of error metrics.
I am running the following line: error_metrics = cpsd_spec.error_summary(figure_kwargs={}, linewidth=1, plot_kwargs={}, cpsd_matrices = cpsd_data)
where cpsd_spec and cpsd_data are both PowerSpectralDensityArray objects with shape 10 x 10 and 1000 elements per function. The function does produce the error summary plot (including the dB error vs. frequency), but my error_metrics output is NoneType.
I see in line 1911 of sdynpy_data.py that return_data is initialized as None. If len(cpsd_matrices) > 1 (line 1928), return_data is populated with the error metrics. However, if this boolean returns False, as it does in my case, return_data stays as NoneType. Can a line be added to the len(cpsd_matrices) > 0 case to populate return_data, or is this a problem with my inputs to error_summary()? Thank you!
The text was updated successfully, but these errors were encountered:
You're right, this looks like a bug. I think the issue is that the error metrics that are returned are not computed when only one CPSD matrix is passed to the function, as they end up in the bar plot at the bottom of the figure which doesn't get plotted when only one CPSD is passed.
I'll work on a fix for that, but it might be a bit before it gets pushed to the github page due to the approval process we have for releasing code. In the meantime, you can trick the function to give you the data simply by doing something like this where you just repeat the data twice to get it to trigger the len(cpsd_matrices) > 1 if statement: error_metrics = cpsd_spec.error_summary(figure_kwargs={}, linewidth=1, plot_kwargs={}, cpsd_matrices = cpsd_data, cpsd_matrices_2 = cpsd_data). You can then just pull the data out of the dictionary for the first cpsd_data key.
I am using
sdynpy.core.sdynpy_data.PowerSpectralDensityArray.error_summary
to compare test data (from a Rattlesnake virtual test) to a CPSD spec. Documentation says it should return a tuple of dictionaries of error metrics.I am running the following line:
error_metrics = cpsd_spec.error_summary(figure_kwargs={}, linewidth=1, plot_kwargs={}, cpsd_matrices = cpsd_data)
where
cpsd_spec
andcpsd_data
are bothPowerSpectralDensityArray
objects with shape 10 x 10 and 1000 elements per function. The function does produce the error summary plot (including the dB error vs. frequency), but myerror_metrics
output isNoneType
.I see in line 1911 of
sdynpy_data.py
thatreturn_data
is initialized asNone
. Iflen(cpsd_matrices) > 1
(line 1928),return_data
is populated with the error metrics. However, if this boolean returns False, as it does in my case,return_data
stays asNoneType
. Can a line be added to thelen(cpsd_matrices) > 0
case to populatereturn_data
, or is this a problem with my inputs toerror_summary()
? Thank you!The text was updated successfully, but these errors were encountered: