ladisk / FLife

Vibration Fatigue by Spectral Methods
MIT License
33 stars 9 forks source link

TypeError: __init__() got an unexpected keyword argument 'pack_toolbar' #6

Closed ParNaderi closed 2 years ago

ParNaderi commented 2 years ago

Hi,

Thank you for FLife. I tested it for (x,dt) as the simple test example you provided and it works fine. But when I test with GUI with sd1 = FLife.SpectralData(input='GUI') I get the following error:

TypeError: init() got an unexpected keyword argument 'pack_toolbar'

Any thought?

jankoslavic commented 2 years ago

@Pariya2009 thank you. We will look into it:D

jankoslavic commented 2 years ago

We have added the requirement of Matplotlib>=3.3 to the requirements. @Pariya2009 can you please double-check at your side?

ParNaderi commented 2 years ago

I update Matplotlib and re-installed FLife. I used the provided example:

seed = 111 rg = np.random.default_rng(seed) sd3 = FLife.SpectralData(input='GUI', rg=rg)

time_history = sd3.data T = sd3.t # time-history duration dt = sd3.dt # sampling period time = np.arange(0, T, dt) plt.plot(time, time_history)

1) The GUI pops-up now and works fine.

2) After giving a psd profile , the new error is related to "data". This folder or function or... should be introduced.

time_history = sd3.data

AttributeError: 'SpectralData' object has no attribute 'data'

jankoslavic commented 2 years ago

We forgot to update the readme. We should add readme examples to testing! I will add a new issue.

ParNaderi commented 2 years ago

Hi,

Thanks for updates. So far I checked the following for Spectral data and they work fine.

I tried to check "test_basic.py" getting the error of not finding folder "data". You might want to address correctly to folder "data". I copied "data" folder inside folder "tests" and it worked fine.

One last comment, in GUI, the default upper x and y axis values are very high. If a user inputs low psd at low frequency, it is hard to be visualized in the graph. You might want to give user to adjust the axis upper value.

I will test more other modules later, if I see any issue I will let you know.

ParNaderi commented 2 years ago

Hi, I followed the new version. Here is what I got:

I update Matplotlib and re-installed FLife. I used the provided example:

seed = 111 rg = np.random.default_rng(seed) sd3 = FLife.SpectralData(input='GUI', rg=rg)

time_history = sd3.data T = sd3.t # time-history duration dt = sd3.dt # sampling period time = np.arange(0, T, dt) plt.plot(time, time_history)

The GUI pops-up now and works fine.

After giving a psd profile , the new error is related to "data". This folder or function or... should be introduced.

time_history = sd3.data

AttributeError: 'SpectralData' object has no attribute 'data'

Regards,

Mehdi Naderi, PhD

Technical Data Analysis (TDA), Inc., Falls Church Virginia. Tel: (703) 237-1300 x113 Email: @.*** “This email and the data contained within (or attached) is protected by and subject to the SBIR Data Rights clause as outlined in DFARS 252.227-7018. Any disclosure, in any form, is strictly prohibited outside of the US government without Technical Data Analysis, Inc’s written authorization.”

On Wed, Jun 22, 2022 at 8:52 AM Janko Slavič @.***> wrote:

We have added the requirement of Matplotlib>=3.3 to the requirements. @Pariya2009 https://github.com/Pariya2009 can you please double-check at your side?

— Reply to this email directly, view it on GitHub https://github.com/ladisk/FLife/issues/6#issuecomment-1163060079, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOVUERU55GZPNKRS65AYXSTVQMEB7ANCNFSM5ZMFF5SA . You are receiving this because you were mentioned.Message ID: @.***>

azorman commented 2 years ago

@Pariya2009, it seems you have followed the example from the non-latest version od FLife. In latest version we have added the parameter fs and T to generate the time history, based on the defined PSD. In your case, the time-history was not generated as sampling frequency and time of random process were not specified. Parameter rg is optional, and is considered only if both parameters (fs and T) are provided. Here is copy-paste from README.rst:

seed = 111 rg = np.random.default_rng(seed)

time-history can be generated at SpectralData object instantiation. Sampling frequency fs and signal length T parameter are needed.

sd3 = FLife.SpectralData(input='GUI', T=1, fs=1e5, rg=rg)

time_history = sd3.data T = sd3.t # time-history duration dt = sd3.dt # sampling period time = np.arange(0, T, dt) plt.plot(time, time_history)

jankoslavic commented 2 years ago

Thank you @azorman . I will close this issue; @Pariya2009 re-open please if necesarry.