arim.scat.Scattering2d#
- class arim.scat.Scattering2d[source]#
Bases:
ABC
Base object for computing the scattering functions in 2D.
Examples
>>> material = arim.Material(6300., 3120., 2700., 'solid', metadata={'long_name': 'Aluminium'}) >>> scat_obj = scat_factory('sdh', material, radius=0.5e-3)
A
Scattering2d
can be used a function of the incident angles, the scattered angles and the frequency:>>> inc_theta = np.deg2rad([0., 0., 0.]) >>> out_theta = np.deg2rad([0., 10., 20]) >>> frequency = 5e6 # Hz >>> result = scat_obj(inc_theta, out_theta, frequency)
result
is a dict with keys ‘LL’, ‘LT’, ‘TL’, ‘TT’. Each value of the dict is an array of shape (3, ).>>> result2 = scat_obj(inc_theta, out_theta, frequency, to_compute=['LL'])
result2
is a dict which contains the key ‘LL’. Use this feature to reduce the amount of computation. Depending on how the function is written, other keys may be returned.To generate scattering matrices:
>>> numangles = 10 # number of angles between -pi (included) and +pi (excluded) >>> single_freq_matrices = scat_obj.as_single_freq_matrices(numangles, frequency)
single_freq_matrices['LL']
is here a 2d array of shape (10, 10).>>> frequencies = [1e6, 2e6, 3e6, 4e6, 5e6] # Hz >>> multi_freq_matrices = scat_obj.as_multi_freq_matrices(numangles, frequencies)
multi_freq_matrices['LL']
is here a 3d array of shape (5, 10, 10).For convenience, functions that return an array instead of a dict of array are provided.
>>> func_dict = scat_obj.as_freq_angles_funcs() >>> scat_LL_func = func_dict['LL'] >>> scat_LL_func(phi_in, phi_out, frequency) ... # return an array
- as_angles_funcs(frequency)[source]#
Returns a dict of scattering functions that take as input the incident angle and the outgoing angle.
- as_freq_angles_funcs()[source]#
Returns a dict of scattering functions that take as input the incident angle, the outgoing angle and the frequency.
- as_multi_freq_matrices(frequencies, numangles, to_compute=frozenset({'LL', 'LT', 'TL', 'TT'}))[source]#
Returns scattering matrices at different frequencies.
- Parameters:
frequency (ndarray) – Shape: (numfreq, )
numangles (int)
to_compute – See
SCAT_KEYS
- Returns:
Shape of each matrix:
(numfreq, numpoints, numpoints)
- Return type:
dict[str, ndarray]
- as_multi_freq_matrices_obj(frequencies, numangles, to_compute=frozenset({'LL', 'LT', 'TL', 'TT'}))[source]#
Returns scattering matrices at different frequencies as a ScatFromData object.
- Parameters:
frequencies (ndarray)
numangles (int)
to_compute (set[str])
- Return type:
- as_single_freq_matrices(frequency, numangles, to_compute=frozenset({'LL', 'LT', 'TL', 'TT'}))[source]#
Returns scattering matrices at a given frequency.
- Parameters:
frequency (float)
numangles (int)
to_compute (set[str])
- Returns:
Shape of each matrix:
(numpoints, numpoints)
- Return type:
dict[str, ndarray]