# chaosmagpy.model_utils.design_matrix¶

chaosmagpy.model_utils.design_matrix(knots, order, n_tdep, time, radius, theta, phi, n_static=None, source=None)[source]

Returns matrices that connect radial, colatitude and azimuthal field components on a grid with radius, theta (colatitude) and phi to the spherical harmonics expansion of a potential.

The potential is time-dependent on large length-scales (n <= n_tdep) and static on small length-scales (n_tdep < n <= n_static). The time-dependent part uses a B-spline representation of order k.

Parameters:
knotsndarray, shape >= (k+1,)

Knot vector with adequate endpoint multiplicity.

orderint, positive

Order k of B-spline basis functions (4 = cubic).

n_tdepint, positive

Maximum degree of the time-dependent field.

timendarray, shape (N,)

Time vector of the N data points in days.

Radius vector of the N data points in kilometers.

thetandarray, shape (N,)

Data colatitude vector in degrees $$[0^\circ,180^\circ]$$.

phindarray, shape (N,)

Data longitude vector in degrees.

n_staticint, positive, optional

Maximum degree of static field (default is None, n_static > n_tdep).

source{‘internal’, ‘external’}, optional

Magnetic field source (default is internal).

Returns:
G_radius, G_theta, G_phindarray, shape (N, …)

Forward matrix for $$B_r$$, $$B_{\theta}$$ and $$B_{\phi}$$.

Raises:
ValueError

If degree of static field is smaller than the degree of the time-dep. field. In order to exclude the static field and obtain a purely time-dependent potential, use optional argument n_static=None or leave out completely.