# Analysis of ensembles of different solution lengths (DiffEq)

**URL:** https://discourse.julialang.org/t/analysis-of-ensembles-of-different-solution-lengths-diffeq/89752
**Category:** Modelling & Simulations
**Tags:** diffeq, differentialequation
**Created:** [November 4, 2022, 2:42am UTC](https://discourse.julialang.org/t/analysis-of-ensembles-of-different-solution-lengths-diffeq/89752 "2022-11-04T02:42:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lachlan-Bn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lachlan-bn/32/17008_2.png) [@Lachlan-Bn](https://discourse.julialang.org/u/Lachlan-Bn)
#### Post date: [November 4, 2022, 2:42am UTC](https://discourse.julialang.org/t/analysis-of-ensembles-of-different-solution-lengths-diffeq/89752/1 "2022-11-04T02:42:29Z")

</div>

I’m solving some ensembles where each trajectory is going to have a wildly different length due to a termination callback. I’d like to be able to, e.g using the EnsembleSolution/EnsembleSummary methods visualize how this ensemble evolves over time. Pretty much what I want to do is:

1. solve Ensemble
2. use something like `componentwise_vectors_timestep()` to get the position of every solution at some timesteps/points of interest
3. plot them

Using the timestep/timepoint methods on the whole ensemble is clearly going to be limited to the length of the shortest trajectory, as it’ll throw an error if I try to look at timestep N+1 when the ensemble contains a trajectory of length N.

Is there a nice way to manipulate the `EnsembleSolution` object to, e.g, filter out trajectories by length? Or to have the methods like componentwise\_vectors\_timestep() behave in the way I describe?

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [November 5, 2022, 8:56pm UTC](https://discourse.julialang.org/t/analysis-of-ensembles-of-different-solution-lengths-diffeq/89752/2 "2022-11-05T20:56:39Z")

</div>

> [@Lachlan-Bn](#):
>
> Is there a nice way to manipulate the `EnsembleSolution` object to, e.g, filter out trajectories by length?

Loop through them.

> [@Lachlan-Bn](#):
>
> Or to have the methods like componentwise\_vectors\_timestep() behave in the way I describe?

Use the methods that are by time not by time step if time steps don’t align. That’s the reason for the difference.
