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

FAQ: Some common errors with scripts #17

Open
svdhoog opened this issue May 25, 2018 · 0 comments
Open

FAQ: Some common errors with scripts #17

svdhoog opened this issue May 25, 2018 · 0 comments

Comments

@svdhoog
Copy link
Owner

svdhoog commented May 25, 2018

Below are commands followed by the error message.

db_hdf5_v2.py

Error 1

python3 ../db_hdf5_v2.py -vs db/set_$n -o h5/set_$n
Traceback (most recent call last):
  File "../db_hdf5_v2.py", line 153, in <module>
    dir_check(output_folder)
  File "../db_hdf5_v2.py", line 26, in dir_check
    print("- Directory ["+outpath+ "] was created and is used for output files")
UnboundLocalError: local variable 'outpath' referenced before assignment

Reason:

Usage: db_hdf5_v2.py [-h] [-o OUTPATH] [-v] [-s] [-r] dbpath

The argument -o outpath has to come before the argument dbpath

Solution:

Add argument for the input folder dbpath.

Error 2

Also without -vs as arguments (or -v -s) there is output.

Solution:

Suppress all output when neither -v nor -s are used.

Error 3

DB file contains nan, NA or inf values.

Traceback (most recent call last):
  File "db_hdf5_v2.py", line 190, in <module>
    gen_hdf(fname, output_folder)
  File "db_hdf5_v2.py", line 104, in gen_hdf
    store[a] = gendp(dfa)
  File "/usr/local/lib/python3.4/dist-packages/pandas/io/pytables.py", line 480, in __setitem__
    self.put(key, value)
  File "/usr/local/lib/python3.4/dist-packages/pandas/io/pytables.py", line 889, in put
    self._write_to_group(key, value, append=append, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/pandas/io/pytables.py", line 1331, in _write_to_group
    s.write(obj=value, append=append, complib=complib, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/pandas/io/pytables.py", line 3905, in write
    self._handle.create_table(self.group, **options)
  File "/usr/lib/python3/dist-packages/tables/file.py", line 1067, in create_table
    chunkshape=chunkshape, byteorder=byteorder)
  File "/usr/lib/python3/dist-packages/tables/table.py", line 807, in __init__
    self.description = Description(description)
  File "/usr/lib/python3/dist-packages/tables/description.py", line 492, in __init__
    'initialize columns.' % object)
TypeError: Passing an incorrect value to a table column. Expected a Col (or subclass) instance and got: "ObjectAtom()". Please make use of the Col(), or descendant, constructor to properly initialize columns.
Closing remaining open files: <filename>

Solution:

  • No solution yet.
  • Preferred behavior: add non-double values gracefully to the HDF5 file.

Error 4

If DB filenames contains strings for the set name, this cannot be added to the HDF5 file.
The DB filenames have to adhere to the convention: set_s_run_r_iters.db, where s and r are integers.

Traceback (most recent call last):
  File "main.py", line 149, in <module>
    sets_runs = process_hdf_keys(key)  # get set and run values from the names: set_1_run_1_iters etc. hardcoded for set_*_run_*_iters atm
  File "main.py", line 36, in process_hdf_keys
    return list(map(int, string_out.split(',')))
ValueError: invalid literal for int() with base 10: '0615_short'
Closing remaining open <filename>

Solution:

  • No solution yet.
  • Preferred behavior: allow for string-values names of the sets to be added to the HDF5 file.

merge_hdf_agentwise.py

(none so far)

Error 1

Reason:

Solution:

visualisation_scripts/main.py

Error 1
If the variable list contains a var that is not in the h5 file, then an error occurs:

>> Error: Table has columns ['id', 'total_income', 'total_expenses', 'fiat_money_govs', 'fiat_money_banks', 'fiat_money_firms', 'fiat_money', 'equity', 'ecb_interest_rate', 'inflation_gap', 'output_gap', 'inflation_rate', 'regulatory_capital_buffer', 'regulatory_ltv_cap', 'regulatory_dsti_cap', 'counter_cyclical_capital_buffer', 'capital_conservation_buffer'] and var1='reserves' does not match.

Reason:

Solution:
It would be more informative if this error message also includes the agent name.

Error 2
In plot_config.yaml it is not clear how no plot title is specified. This does not work:

plot_title: no

Solution:
Add option no or none for plot_title.

Error 3

Using histogram with 100 bins yields an error:

/usr/local/lib/python3.4/dist-packages/numpy/lib/function_base.py:838: RuntimeWarning: invalid value encountered in true_divide return n/db/n.sum(), bin_edge
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

1 participant