Add custom as_dict/from_dict method for proper initialization of attributes of IcohpCollection#4391
Conversation
|
Dear @shyuep , I wanted to know what the implications would be if one does not use the I am asking this because I ran into serialization issues when working on the app in crystal-toolkit (See materialsproject/crystaltoolkit#459). The issue to be precise orginates from plotly not being able to serialize FloatWithUnit class objects. |
|
Hi @shyuep , @mkhorton , @esoteric-ephemera , does anyone of you have more insight on this issue? We ran into this when preparing our LOBSTER data for the CrystalToolkit and corresponding visualization. |
|
Not sure I understand: how is You can also use the |
Hi @esoteric-ephemera, yes, Maybe I got it wrong before, I think serialization happens via dash, not plotly, I suppose here https://github.com/materialsproject/crystaltoolkit/blob/79e6a9981f0af0a97109e2f7e9343aefc0d75a1c/crystal_toolkit/core/mpcomponent.py#L270, When I try to initialize the app, I get the error |
|
My guess is that something is not going right on the crystaltoolkit side since I'm able to do without issue. Maybe just pass the |
Thanks @esoteric-ephemera , this can work, maybe I will adapt a bit of stuff in our LobsterPy API too then it should work fine without needing any changes. |
Currently
IcohpCollectioninstance is not serialized correctly, thus I added custom from_dict and as_dict methods here.