choderalab / msm-pipeline

A pipeline for MSMs.
GNU Lesser General Public License v3.0
2 stars 5 forks source link

AssertionError error running `test_report_generation.py` #18

Open sonyahanson opened 8 years ago

sonyahanson commented 8 years ago

Could this be related to my other AssertionError?

estimating BayesianMSM: 100% (100/100) [################################################################################################] eta 00:01 |Traceback (most recent call last):
  File "test_report_generation.py", line 35, in <module>
    make_plots(dtrajs, tica, tica_output, msm, project_name = 'test')
  File "/Users/hansons/Documents/github/msm-pipeline/generate_report.py", line 40, in make_plots
    hmm = msm.coarse_grain(n_states)
  File "/Users/hansons/anaconda/lib/python2.7/site-packages/pyEMMA-2.2.2-py2.7-macosx-10.6-x86_64.egg/pyemma/msm/estimators/maximum_likelihood_msm.py", line 744, in coarse_grain
    'nstates must be an int in [2,msmobj.nstates]'
AssertionError: nstates must be an int in [2,msmobj.nstates]
maxentile commented 8 years ago

Hmm, can you print n_states? Maybe our heuristic for choosing the number of macrostates either yields unreasonably many or unreasonably few.

jchodera commented 8 years ago

Hmm, can you print n_states? Maybe our heuristic for choosing the number of macrostates either yields unreasonably many or unreasonably few.

+1 on printing this, and for also adding:

# Make sure number of states is in [2,msm.nstates]
if n_states < 2:
   print('Warning: n_states < 2. Adjusting to 2 states.')
   n_states = 2
elif n_states > msm.nstates:
   print('Warning: n_states > msm.nstates. Adjusting to msm.nstates (%d).' % msm.nstates)
   n_states = msm.nstates
sonyahanson commented 8 years ago

n_states is zero at least in one instance where I saw this error.

Full error

WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
WARNING:root:Too few points to create valid contours
/cbio/jclab/home/hansons/opt/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):
estimating BayesianMSM: 100% (100/100) [###########################] eta 00:00 -09-08-16 22:02:56 pyemma.msm.estimators.implied_timescales.ImpliedTimescales[2] WARNING  Changed user setting nits to the number of available timescales nits=5
WARNING:pyemma.msm.estimators.implied_timescales.ImpliedTimescales[2]:Changed user setting nits to the number of available timescales nits=5
09-08-16 22:02:58 pyemma.msm.estimators.implied_timescales.ImpliedTimescales[2] WARNING  Some timescales could not be computed. Timescales array is smaller than expected or contains NaNs
WARNING:pyemma.msm.estimators.implied_timescales.ImpliedTimescales[2]:Some timescales could not be computed. Timescales array is smaller than expected or contains NaNs
/cbio/jclab/home/hansons/opt/anaconda/lib/python2.7/site-packages/matplotlib/scale.py:100: RuntimeWarning: invalid value encountered in less_equal
  a[a <= 0.0] = 1e-300
estimating BayesianMSM:  98% ( 98/100) [########################## ] eta 00:04 |09-08-16 22:05:58 pyemma.msm.estimators.bayesian_msm.BayesianMSM[3] WARNING  Ignored error during estimation: Active set is empty. Cannot estimate MSM.
WARNING:pyemma.msm.estimators.bayesian_msm.BayesianMSM[3]:Ignored error during estimation: Active set is empty. Cannot estimate MSM.
estimating BayesianMSM:  99% ( 99/100) [########################## ] eta 00:02 /09-08-16 22:06:00 pyemma.msm.estimators.bayesian_msm.BayesianMSM[4] WARNING  Ignored error during estimation: Active set is empty. Cannot estimate MSM.
WARNING:pyemma.msm.estimators.bayesian_msm.BayesianMSM[4]:Ignored error during estimation: Active set is empty. Cannot estimate MSM.
estimating BayesianMSM: 100% (100/100) [###########################] eta 00:01 \09-08-16 22:06:00 pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5] WARNING  Estimation has failed at lagtimes: [981 991]. Run single-lag estimation at these lags to track down the error.
WARNING:pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5]:Estimation has failed at lagtimes: [981 991]. Run single-lag estimation at these lags to track down the error.
09-08-16 22:06:00 pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5] WARNING  Changed user setting nits to the number of available timescales nits=5
WARNING:pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5]:Changed user setting nits to the number of available timescales nits=5
09-08-16 22:06:02 pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5] WARNING  Some timescales could not be computed. Timescales array is smaller than expected or contains NaNs
WARNING:pyemma.msm.estimators.implied_timescales.ImpliedTimescales[5]:Some timescales could not be computed. Timescales array is smaller than expected or contains NaNs
THIS IS n_states: 0
Traceback (most recent call last):
  File "pipeline-cov-nstates.py", line 192, in <module>
    run_pipeline(fnames, project_name = project_name)
  File "pipeline-cov-nstates.py", line 135, in run_pipeline
    make_plots(dtrajs, tica, tica_output = Y, msm = msm, project_name = project_name)
  File "/cbio/jclab/home/hansons/git/msm-pipeline/August/msm-pipeline/generate_report_nstates.py", line 42, in make_plots
    hmm = msm.coarse_grain(n_states)
  File "/cbio/jclab/home/hansons/opt/anaconda/lib/python2.7/site-packages/pyEMMA-2.2.2-py2.7-linux-x86_64.egg/pyemma/msm/estimators/maximum_likelihood_msm.py", line 744, in coarse_grain
    'nstates must be an int in [2,msmobj.nstates]'
AssertionError: nstates must be an int in [2,msmobj.nstates]
jchodera commented 8 years ago

Can we print n_states and also restrict it to be within [2, msmobj.nstates] as I noted above?