tracmass.ParticleState#

class tracmass.ParticleState(x, y, z, ia, ja, ka, tt, ts, t0, subvol, niter, active, reason)[source]#

Bases: NamedTuple

State vector for all particles — each field is shape (n,).

Parameters:
__init__()#

Methods

__init__()

concat(*states)

Join particle states end to end.

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Attributes

active

Alias for field number 11

ia

Alias for field number 3

ja

Alias for field number 4

ka

Alias for field number 5

niter

Alias for field number 10

reason

Alias for field number 12

subvol

Alias for field number 9

t0

Alias for field number 8

ts

Alias for field number 7

tt

Alias for field number 6

x

Alias for field number 0

y

Alias for field number 1

z

Alias for field number 2

x: Array#

Alias for field number 0

y: Array#

Alias for field number 1

z: Array#

Alias for field number 2

ia: Array#

Alias for field number 3

ja: Array#

Alias for field number 4

ka: Array#

Alias for field number 5

tt: Array#

Alias for field number 6

ts: Array#

Alias for field number 7

t0: Array#

Alias for field number 8

subvol: Array#

Alias for field number 9

niter: Array#

Alias for field number 10

active: Array#

Alias for field number 11

reason: Array#

Alias for field number 12

classmethod concat(*states)[source]#

Join particle states end to end.

Particles keep their order, so the particles of the first state keep their indices (the id written by ParticleRecorder) and those of later states get new ones after them.

Parameters:

*states (ParticleState) – States to join, in order.

Returns:

ParticleState – NumPy arrays if every input field is a NumPy array (e.g. the host-side state of a batched run), JAX arrays otherwise.

Return type:

ParticleState

Examples

>>> both = ParticleState.concat(state, new_particles)
>>> len(both.x) == len(state.x) + len(new_particles.x)
True