-
Notifications
You must be signed in to change notification settings - Fork 4
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
added a json converter class in json_encoder.py to pyscan/general. Th… #184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to replace the recursive_to_dict method. Also, we need to decode on load_experiment.
…general. This is now implemented in the save_metadata method of abstract_experiment.py which enables numpy values to be used as data inputs before saving. The converter changes the numpy values to standard python values and no longer throws the same type error as before.
efb489f
to
c2c2b8f
Compare
…mpy data types and consolidated the json converter added in the last commit to the pre existing recursive_to_dict function which can now handle numpy data types for saving.
…as causing a type error.
Got it working sufficiently, but Andy says he wants it as a json-converter in place of the recursive_to_dict function. I had issues when trying this at first; however, I will try to solve them exhaustively before reopening this pull request. |
The specific type error issue from before was: "TypeError: Object of type wrapper_descriptor is not JSON serializable." Looking into overcoming this now. I think it has to do with not properly omitting certain keys from the converter data, such as those with keys: ['logger', 'expt_thread', 'data_path', 'instrument', 'module_id_string', 'spec']. Not sure how to best handle this yet, although again, the original issue detailing how numpy values were not saveable by json has been addressed and is currently working with recursive_to_dict as mentioned above. |
…ata now implemented in abstract experiment's save_metadata method.
…oder item_attribute_object_hook.
…le changes from previous commits and import successfully with a new order since itemattribute is used in other pyscan/general modules now.
… np.float_ which was removed in numpy 2.0.
… np.float_ which was removed in numpy 2.0.
encoder has been added to replace recursive_to_dict, as well as encoder to replace recursive_to_item_attribute. |
…is is now implemented in the save_metadata method of abstract_experiment.py which enables numpy values to be used as data inputs before saving. The converter changes the numpy values to standard python values and no longer throws the same type error as before.