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

DelayFixed returning a list assignment index out of range due to wrong pointer value #427

Closed
OResearcher opened this issue Dec 10, 2023 · 8 comments
Assignees
Labels

Comments

@OResearcher
Copy link

OResearcher commented Dec 10, 2023

I tried to run .mdl file using pysd

#context: when I changed a few parameters in the model, it showed list assignment index out of range, but these values were working #fine in vensim model

!pip -q install pySD
import numpy as np
import pandas as pd
import pysd
import matplotlib.pyplot as plt

vmodel = pysd.read_vensim('Query_file.mdl')
SD_result = vmodel.run()
#the values of LT1, LT2 parameters in the original model are 30 and 3 respectively
#in the next step I tried to change the parameter (LT1, LT2) values to 60 and 6 respectively 

SD_result = vmodel.run(params={ 'LT1':60, 'LT2':6})

#I again tried to change the parameter values to 30 and 3, but it showed me an error: **list assignment index out of range**

SD_result = vmodel.run(params={ 'LT1':30, 'LT2':3})

Query_file.zip
please let me know why is it happening with my code
I have attached vensim model in the zip file for reference

@enekomartinmartinez
Copy link
Collaborator

HI @sanketme

Thank you for opening the issue. I will try to reproduce this bug and see if there is something that we need to correct.

@enekomartinmartinez
Copy link
Collaborator

Bug found!

self.pointer wasn't being set to 0 in the initialization. I will try to update it in the master soon.

@enekomartinmartinez enekomartinmartinez changed the title Dataframe is highly fragmented... could not restore the parameter settings after changing it DelayFixed returning a list assignment index out of range due to wrong pointer value Dec 18, 2023
@enekomartinmartinez
Copy link
Collaborator

Solved in branch dev.

I want to include some other fixes before the next release, which I will try to do before the new year. Currently, I do not have a lot of free time to work on PySD. Meanwhile, you can download PySD from that branch to make it work.

Please let me know if you need any further support!

@enekomartinmartinez
Copy link
Collaborator

enekomartinmartinez commented Dec 20, 2023

We are also missing a large model that produces the Dataframe is highly fragmented warning. Does it matter if we use your model for testing? @sanketme

We already implemented some fixes to make it faster and avoid this warning in the branch dev

@OResearcher
Copy link
Author

OResearcher commented Dec 23, 2023 via email

@OResearcher
Copy link
Author

OResearcher commented Dec 23, 2023

Solved in branch dev.

I want to include some other fixes before the next release, which I will try to do before the new year. Currently, I do not have a lot of free time to work on PySD. Meanwhile, you can download PySD from that branch to make it work.

Please let me know if you need any further support!

How can I download PySD from that branch?

@enekomartinmartinez
Copy link
Collaborator

enekomartinmartinez commented Dec 23, 2023

will it work if I run the code with the same code lines?

Yes, but you may need to wait until the new version is released or install pysd from the branch.

For installing from the branch the instruction should be something like:
pip install git+https://github.com/SDXorg/pysd.git@dev#egg=pysd

@enekomartinmartinez
Copy link
Collaborator

@sanketme the release is already done, you should be able to install the new version in the regular way (pip install pysd)

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

No branches or pull requests

2 participants