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

ERROR: only integer scalar arrays can be converted to a scalar index #286

Open
avantonder opened this issue Nov 21, 2024 · 2 comments
Open

Comments

@avantonder
Copy link

Hi,

I've been generating the following error using an older version of TreeTime and the latest version:

/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py:493: RuntimeWarning: invalid value encountered in divide
  int_y/=int_y[-1]
/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/node_interpolator.py:343: RuntimeWarning: divide by zero encountered in divide
  np.array(100*(dx[1:-2]+dx[2:-1])/min_fwhm, dtype=int)), 10)
/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/node_interpolator.py:343: RuntimeWarning: invalid value encountered in cast
  np.array(100*(dx[1:-2]+dx[2:-1])/min_fwhm, dtype=int)), 10)
Traceback (most recent call last):
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/treetime.py", line 57, in run
    return self._run(**kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/treetime.py", line 238, in _run
    self.make_time_tree(**tt_kwargs)
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py", line 376, in make_time_tree
    self._ml_t_joint()
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/clock_tree.py", line 491, in _ml_t_joint
    y = subtree_distribution.prob_relative(subtree_distribution.x)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/distribution.py", line 370, in prob_relative
    return np.exp(-1 * (self.__call__(x)-self.peak_val))
                        ^^^^^^^^^^^^^^^^
  File "/home/ajv37/miniconda3/envs/treetime/lib/python3.12/site-packages/treetime/distribution.py", line 292, in __call__
    tmp_x = x[valid_idxs]
            ~^^^^^^^^^^^^
TypeError: only integer scalar arrays can be converted to a scalar index

ERROR: only integer scalar arrays can be converted to a scalar index 
 
ERROR in TreeTime.run: An error occurred which was not properly handled in TreeTime. If this error persists, please let us know by filing a new issue including the original command and the error above at: https://github.com/neherlab/treetime/issues 


Attempting to parse dates...
	Using column 'accession' as name. This needs match the taxon names in the tree!!
	Using column 'date' as date.

0.00	-TreeAnc: set-up

822.04	###TreeTime.run: INITIAL ROUND

The command I used is as follows:

treetime --tree MTBC0_ancient_no_ref_191124_rooted.treefile \
        --dates dates.tsv \
        --name-column accession \
        --date-column date \
        --aln MTBC0_ancient_no_ref_191124.aln \
        --outdir treetime_ancient \
        --report-ambiguous \
        --time-marginal only-final \
        --clock-rate 1.136364e-07 \
        --clock-std-dev 0.00003 \
        --keep-root \
        --relax 1.0 0
@ivan-aksamentov
Copy link
Member

ivan-aksamentov commented Nov 22, 2024

Hi @avantonder, by chance are you able to share the (minimal) data files you are using here? This would help us to reproduce and debug the issue locally. Thanks!

@avantonder
Copy link
Author

Hi @ivan-aksamentov , thanks for getting back to me. I've been having a little play and it appears to be an issue with the older dates of some of the samples I'm trying to include e.g. 1126-01-01. More "recent" older dates e.g. 1797-01-01 don't appear to cause the error. I've created minimal data files that should allow you to recreate the error.
vantonder_test.zip

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