ceholden / yatsm

Yet Another Time Series Model
https://yatsm.readthedocs.org/en/latest/
MIT License
63 stars 30 forks source link

Error in commission test #84

Closed parevalo closed 8 years ago

parevalo commented 8 years ago

I'm getting the following error when trying to run yatsm line with commission test enabled:

Traceback (most recent call last):
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/bin/yatsm", line 9, in <module>
    load_entry_point('yatsm', 'console_scripts', 'yatsm')()
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr3/graduate/parevalo/miniconda2/envs/conda_env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/projectnb/landsat/users/parevalo/yatsm/yatsm/cli/line.py", line 166, in line
    yatsm, cfg['YATSM']['commission_alpha'])
  File "/projectnb/landsat/users/parevalo/yatsm/yatsm/algorithms/postprocess.py", line 89, in commission_test
    yatsm.Y[b, m_2_start:m_2_end])[1]
ValueError: setting an array element with a sequence.

Location of the log file for that specific line: /projectnb/landsat/projects/Colombia/logs/859/FIT2/y859_1.o6460045 My conda environment: /usr3/graduate/parevalo/miniconda2/envs/conda_env Yatsm location: /projectnb/landsat/users/parevalo/yatsm Script I'm using: /projectnb/landsat/projects/Colombia/workflow/multi_scene/yatsm.sh

The script I'm using is being run for a single line out of 400, because I was trying to debug the code. The config file is in the same folder as that script. My postprocess.py script has been slightly modified to call the debugger once yatsm.px = 2362, because that's when it seems to fail for that specific line I'm running. What seems to be happening is that m_1 and m_2 (and their corresponding start and end variables) are not being assigned any values (I get errors like *** NameError: name 'm_1' is not defined). So when it reaches the least squares code, it complains because m_2_start:m_2_end is actually a string and not a numeric value. However, while debugging, if I manually type the code and run it, the variables are assigned their correct values.

parevalo commented 8 years ago

I just realized that the NameError happens only because I was a little confused about the order in which pdb is working. The code IS actually working and the values are being assigned correctly. The least squares code is actually producing correct data, but the second element, which is the one that the code is trying to get, is an empty array: array([], dtype=float64).

parevalo commented 8 years ago

So the empty array is being produced because, according to the numpy.linalg.lstsq documentation, that's the expected behavior when M <= N. For this case, I'm getting that they are 4 and 4, so the condition is being met. But why is that the case, if my minimum number of observations is set to 6?

ceholden commented 8 years ago

Skipping test for two models when either model has n <= k (number of observations fewer than or equal to the number of parameters estimated).