-
Notifications
You must be signed in to change notification settings - Fork 903
Add custom as_dict/from_dict method for proper initialization of attributes of IcohpCollection #4391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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
IcohpCollection
instance is not serialized correctly, thus I added custom from_dict and as_dict methods here.