peterdsharpe / AeroSandbox

Aircraft design optimization made fast through modern automatic differentiation. Composable analysis tools for aerodynamics, propulsion, structures, trajectory design, and much more.
https://peterdsharpe.github.io/AeroSandbox/
MIT License
690 stars 111 forks source link

Error running fitting example #38

Closed joyo44 closed 3 years ago

joyo44 commented 3 years ago

Hi Peter,

I updated to Version 2.3.2 and trying to run the fitting example. I got two errors in fitting.py:

First:

Traceback (most recent call last): File ".\example.py", line 28, in Cl = af.fit_xfoil_data_Cl(plot_fit=True) File "c:\users\lenovo\anaconda3\lib\site-packages\aerosandbox\tools\airfoil_fitter\airfoil_fitter.py", line 154, in fit_xfoil_data_Cl verbose=self.verbose, File "c:\users\lenovo\anaconda3\lib\site-packages\aerosandbox\tools\fitting.py", line 85, in fit weights /= np.sum(weights) TypeError: No loop matching the specified signature and casting was found for ufunc truedivide

I changed line 85 with: np.divide(weights, np.sum(weights), out=weights, casting='unsafe') which removed the TypeError. All weights are zero ???

Second:

This was a data lenght mismatch at line 113

Traceback (most recent call last): File ".\example.py", line 28, in Cl = af.fit_xfoil_data_Cl(plot_fit=True) File "c:\users\lenovo\anaconda3\lib\site-packages\aerosandbox\tools\airfoil_fitter\airfoil_fitter.py", line 154, in fit_xfoil_data_Cl verbose=self.verbose, File "c:\users\lenovo\anaconda3\lib\site-packages\aerosandbox\tools\fitting.py", line 113, in fit f"The supplied data series \"{key}\" has length {series_length}, but y_data has length {n_datapoints}.") ValueError: The supplied data series "alpha_indices" has length 37, but y_data has length 868.

Can you please have a look at these errors.

Regards, John

peterdsharpe commented 3 years ago

Hi @joyo44 !

Thank you for the bug report! We've looked at this issue and fixed it in our develop branch; changes will be pushed to master in a few days as part of the AeroSandbox v3.0.0 release. :)

Thanks, Peter