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

Adding pi to the functions #400

Closed
lionel42 opened this issue Jan 12, 2023 · 5 comments · Fixed by #404
Closed

Adding pi to the functions #400

lionel42 opened this issue Jan 12, 2023 · 5 comments · Fixed by #404

Comments

@lionel42
Copy link

Can we add pi as a function in pysd ?
It would be useful for one of my projects.

Simply adding the following in the function space of pysd/builders/python/python_functions.py

    "pi": (
        "np.pi",
        ("numpy",)),
@enekomartinmartinez
Copy link
Collaborator

Hi, sure! This will be an easy addition.

As far as I know, Pi is not defined by Vensim, so I suppose it will only be available in Stella. Could you create a test-model with canonical output that uses pi with an XMILE file? I currently have no access to Vensim or Stella, so I cannot create test models and run them with the original software.

You may need to add your test model here https://github.com/SDXorg/test-models. You have all the instructions in the README. Let me know if you need help :)

@lionel42
Copy link
Author

Hi ! Thanks for the reply ,

I also have no access to Stella or Vensim at the moment, actually I am working on another project where I try to create SD models using another program and then run the models with PySD (https://github.com/ScienceGamez/drawio_pysd)

I have seen that only Vensim or Stella models can uploaded at the moment by I could give you maybe a python file contaning an AbstractModel for pysd if that would work for you ? But this might requires a bit too much work for what it is worth.

@enekomartinmartinez
Copy link
Collaborator

Great work! Thanks for working on that tool it could be really useful for some people.

About adding pi, I am not sure about adding it to functions as it is not a function, but a constant. Nevertheless, in XMILE it is defined as a function and I don't think that makes sense to include a new builder for constant. I could add it now so it is available for the next release.

@enekomartinmartinez
Copy link
Collaborator

Already included it in dev branch. I will wait until we solve some other minor fixes to merge it to master and publish it.

@lionel42
Copy link
Author

lionel42 commented Feb 1, 2023

Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants