Annanilsson-code / ProjectAppliedMolBiophys

Project in the course Applied Molecular Biophysics 2020
1 stars 1 forks source link

plt.hist() takes forever #13

Closed Annanilsson-code closed 3 years ago

Annanilsson-code commented 3 years ago

https://github.com/Annanilsson-code/ProjectAppliedMolBiophys/blob/9c97a09d72731a681f61f349ff2f884280eee9a6/cc_calculation_prot.py#L35

It takes a couple of seconds to create a histogram with numpy, but plotting with matplotlib takes forever. Why is that?

FilipeMaia commented 3 years ago

Try to set a fixed number of bins instead of leaving it auto to see if the issue still happens.

Annanilsson-code commented 3 years ago

The issue still happens when I write the code inside of the script, but it works when I write the plt.hist() part in Spyder's console. It took half a second even with bins='auto'. I realized that there might be some trouble with the input array, and saw that the data that belongs to the same dataset should be in the same column, not on a row. And noise_x_reshaped has the shape 1x42800, so I used the transpose of noise_x_reshaped, which worked. It still doesn't work inside of the script though, but perhaps that doesn't matter...

Annanilsson-code commented 3 years ago

By the way, here are the two histograms. One for the experimental data in one cryo EM image and one for the simulated Gaussian noise around the projection on the x axis. image image

FilipeMaia commented 3 years ago

You seem to have forgotten to add your data to the noise. Also can you share your 6yhs.mrc? It's also good to superimpose the histograms in the same plot to make it easier to see how well they overlap.

FilipeMaia commented 3 years ago

Also the experimental mrc file contains 81 images, not just one.

Annanilsson-code commented 3 years ago

Yes, I changed that now - I added "noise_x + u" and got this: image

Yes, I can upload a zip file here because .mrc doesn't seem to be supported here. I used 3Å resolution to generate the map. 6yhs.zip

What does it mean for us that the experimental mrc file contains 81 images? We thought that it was only one image in the mrc file that we used.

FilipeMaia commented 3 years ago

Look at the shape of the data. It's 3D with the leading dimension 81.