Skip to content
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

Different size output for observation.to_json() and observation.to_dict() #509

Closed
Rkaddah opened this issue Aug 3, 2023 · 1 comment
Closed
Labels
documentation Improvements or additions to documentation

Comments

@Rkaddah
Copy link

Rkaddah commented Aug 3, 2023

When trying to see the observation size using env.obersevation_space.size_obs(), I get 1432.
When trying to export using .to_dict(), I get the same size but obs.to_json() gives more output (mainly the thetas). I enclosed an image showing the summary of attributes I get using each function. I use grid2op version 1.8.2.dev4.

values_summarised
@Rkaddah Rkaddah added the bug Something isn't working label Aug 3, 2023
@BDonnot BDonnot added documentation Improvements or additions to documentation and removed bug Something isn't working labels Aug 24, 2023
@BDonnot
Copy link
Collaborator

BDonnot commented Aug 24, 2023

Hello,

Yes you are correct, you have more data in an object of type observation (namely the thetas, the shunts etc.) compared to what is available to the observation as converted to a vector.

This is mainly due to historical reasons (so basically no reason at all...) but also because some backend might not support the output of the thetas. And when that is the case, we want the observation (as a vector) to be still usable.

If you want the complete list of attributes present in "obs.to_dict()" you can have it with type(obs).attr_list_vect and if you want the list of attributes present in the obs.to_json() you can do type(obs).attr_list_vect + type(obs).attr_list_json

It's not really a bug that 2 different functions output two different results. This is rather a missing documentation issue, which i'll fix ASAP.

@BDonnot BDonnot mentioned this issue Aug 25, 2023
@BDonnot BDonnot closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants