MESmerize
MESmerize copied to clipboard
[BUG] <Loading k-shape project plot error>
Describe the bug I've performed the K-shape analysis and saved the plot within the project as a .ptrn file. If I reopen Mesmerize and try to access the k_shape plot again, I get the error:
Screenshots
Traceback (most recent call last):
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\common\qdialogs.py", line 52, in fn
return func(self, *args, **kwargs)
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\plotting\widgets\base.py", line 229, in open_plot
self.set_plot_opts(plot_state)
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\plotting\widgets\kshape\widget.py", line 933, in set_plot_opts
setattr(self, k, opts[k])
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\plotting\widgets\kshape\widget.py", line 481, in _ksgrid_json
self.ksgrid = kga
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\plotting\widgets\kshape\widget.py", line 394, in ksgrid
if self.n_clusters_out[ij] < self.ksgrid[ij].n_clusters:
IndexError: too many indices for array
If I click OK, I get the main k-shape clustering window with the clusters in the center, but I do not get the interactive plot on the side with clusters of different inertia.
If I run: this.inertia_sorted.head()
now, I get this error as well:
Traceback (most recent call last):
File "D:\Anaconda3\envs\mesmerize\lib\site-packages\mesmerize\pyqtgraphCore\console\Console.py", line 167, in execSingle
output = eval(cmd, self.globals(), self.locals())
File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'head'
I will have to re-run the clustering if I'd like to view the interactive plot for choosing clusters.
Operating System & specs (CPU, RAM etc.). Please complete the following information:
- OS: Tried on Windows 10 and 11, 32 GB RAM, AMD Ryzen 9 5900X
Details about your Mesmerize install
- Anaconda
Thanks
Pradeep
Thanks for providing details! I can take a look at this next week, I have an important exam this weekend.
@DanielDondorp you could check this out if you have time.
I will try and see if I can reproduce this or say something sensible about it.
@pr4deepr @DanielDondorp I think that the gridsearch isn't saved to file, only the iteration which you have chosen. You really only need the final iteration which was the best and I don't see the purpose of looking through the other iterations on the grid again.
Thanks @kushalkolar and @DanielDondorp Ahh, thats good to know. So, as long as we make a selection after the analysis it should be saved, right?
The reason I asked is I think it would be useful feature if:
- I'd like to share the analysis and others would like to validate or see the gridsearch and choices of iteration. The choice of iteration and especially, the nature of the curves may make more sense to the subject matter expert than the analyst.
- OR, if someone not familiar with the analysis would like to share the file to get input on choosing parameters. Not sure how hard it is to implement.
However, instead of saving the gridsearch, is there a way to document or share the choice of the grid?
Cheers Pradeep
@pr4deepr Sorry for the late response (been cleaning up issues this weekend). Let me know if you want to chat sometime for help on implementing this.
I'm not sure how to go about it, but happy to give it a try.. If you could give me some pointers on where to look and how you'd approach it, that would give me a good start!
All the kshape related code is here: https://github.com/kushalkolar/MESmerize/tree/master/mesmerize/plotting/widgets/kshape
So the ksgrid
is saved as a json string within the .ptrn
hdf5 file structure:
https://github.com/kushalkolar/MESmerize/blob/master/mesmerize/plotting/widgets/kshape/widget.py#L950
You might want to play around here to set the ksgrid_json
directly:
https://github.com/kushalkolar/MESmerize/blob/master/mesmerize/plotting/widgets/kshape/widget.py#L843
I'm pretty busy until mid/late April but I could help you sometime in the latter half of April