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

Export Data .csv always 20 periods #137

Open
AlexDece opened this issue Jul 7, 2021 · 2 comments
Open

Export Data .csv always 20 periods #137

AlexDece opened this issue Jul 7, 2021 · 2 comments

Comments

@AlexDece
Copy link
Contributor

AlexDece commented Jul 7, 2021

When changing the time horizon of the simulation and exporting the results in csv, the default time horizon is shown in the csv file.

I was surprised someone would actually download the csv file :D
I received this issue from external source, so I should take care of it.
I scanned through the code, but I didn't find where this information is read in matlab.
@j2L4e do you have any idea? Since the output.json has the correct time horizon, I assume I just didnt find the right spot in the code...

To Reproduce
Steps to reproduce the behavior:

  1. Check any model with any policy rule and any shock/variables
  2. Change Horizon to e.g. 40 in the options block
  3. Run simulation
  4. Click on "Export data .csv"
  5. In the output.csv only 21 periods are shown, while the output.json 41 periods are shown

Expected behavior
The csv file should contain 41 periods output

Screenshots
error1
error2
error3

Desktop (please complete the following information):

  • Device: PC
  • OS: Windows
  • Dynare 4.5.7, Matlab 2019
@j2L4e
Copy link
Member

j2L4e commented Jul 19, 2021

Hi Alex,

CSV columns are hard-coded:

fields: ['resulttype', 'rule', 'model', 'shock', 'variable', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'],

You should be able to get the chosen horizon from the store ...

computed: {
  ...mapGetters('options', ['horizon']),
}

... and use it to build the correct fields array:

const moreFields = new Array(this.horizon).fill().map((_, i) => String(i + 1));

// ...

fields: ['resulttype', 'rule', 'model', 'shock', 'variable', ...moreFields]

Sorry for the late response, was on vacation

@AlexDece
Copy link
Contributor Author

Got it, thank you!

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

No branches or pull requests

2 participants