vice.migration.migration_matrix¶
A square matrix designed to detail the manner in which gas migrates between zones in multizone models. This is a 2-dimensional array-like object denoted by \(G_{ij}\), defined as the mass fraction of the interstellar gas in zone \(i\) that migrates to zone \(j\) in a 10 Myr time interval.
Signature: vice.migration.migration_matrix(size)
New in version 1.2.0.
Parameters¶
- size
int
The number of rows and columns. This is also the number of zones in the multizone model.
Attributes¶
- size
int
See parameter “size”.
Allowed Data Types¶
- real number
\(G_{ij}\) does not vary with time, and is given by this value.
- <function>
\(G_{ij}\) varies with time, and is described by this function. Time in Gyr is the only parameter the function takes.
Indexing¶
int
,int
the row and column numbersThe value of \(G_{ij}\) can be accessed by indexing this object with \(i\) as the first index and \(j\) as the second. For instance,
example[1][0]
andexample[1, 0]
both look up \(G_{1,0}\).
Functions¶
tolist
tonumpyarray
Example Code¶
>>> import math
>>> import vice
>>> example = vice.migration.migration_matrix(3)
>>> example
MigrationMatrix{
0 ---------> {0.0, 0.0, 0.0}
1 ---------> {0.0, 0.0, 0.0}
2 ---------> {0.0, 0.0, 0.0}
}
>>> example[1][0] = 0.1
>>> def f(t):
return 0.1 * math.exp(-t / 5)
>>> example[0, 1] = f
>>> example
MigrationMatrix{
0 ---------> {0.0, <function f at 0x120588560>, 0.0}
1 ---------> {0.1, 0.0, 0.0}
2 ---------> {0.0, 0.0, 0.0}
}
>>> example.tonumpyarray()
array([[0.0, <function f at 0x120588560>, 0.0],
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0]])