symphony calculates synchrotron emissivities and absorptivities, polarized in the Stokes basis {I, Q, U, V}, for any arbitrary gyrotropic momentum space distribution function. As of 2018, symphony also computes Faraday rotation coefficients in the Stokes basis and the full relativistic magnetized plasma susceptibility tensor, provided the distribution function is isotropic. Three distribution functions are built in: a relativistic thermal (Maxwell-Juettner) distribution, a nonthermal power-law distribution, and a kappa distribution.
symphony was first described in Pandya et al., 2016 ApJ 822 34, and extended to compute Faraday rotation coefficients in Pandya et al., 2018. If you use this code in an academic context, cite these papers.
Ccode to calculate synchrotron emissivities via thej_nu()function and absorptivities via thealpha_nu()function.Ccode to calculate Faraday rotation coefficients via therho_nu()functionCcode to evaluate approximate fitting function values for the emissivity and absorptivity, via thej_nu_fit()andalpha_nu_fit()functions, respectively.- CMake configure system, which helps during the build process to find all necessary libraries and files.
Pythoninterface forj_nu(),alpha_nu(),j_nu_fit(), andalpha_nu_fit().Pythoninterface torho_nu()and spline fits- This combines the speed of
Cwhen evaluating emissivities and absorptivities withPython's user-friendly syntax. It also allows for interfacing with largerPythoncodes.
- This combines the speed of
- Clone symphony from github. Navigate into the "symphony" folder, and create a folder named "build"; navigate into it.
- Type
cmakefollowed by the location of the "src/" folder (in the "symphony" folder, above). Altogether, this line should look something like:cmake /location/to/symphony/src. You can add the argument-DCMAKE_INSTALL_PREFIX=/name/of/dirto set the name of the directory to install to. - Type
make. - Optionally, run
make installto install the library and Python module onto your system. - In the "build" folder, navigate into the newly created "susceptibility_tensor" folder. Make an empty file called "_init_.py" and save it.
- Unzip the "kernel_samples_datafiles.zip" file in place within the "symphony" folder.
- Navigate into the "src" folder, then into the "susceptibility_tensor" folder. Open the file "susceptibilityPy.pyx" and go to the line (line 289) that says
main_directory =; after the equals sign, add the absolute directory pointing to the "kernel_samples_datafiles/" folder.
- Navigate to the "build/" folder created in step 1., above. Open
Pythonin the command line or by writing a ".py" file. - Import symphony by typing
import symphonyPy.
- This allows one to call the functions:
j_nu_py(),alpha_nu_py(),j_nu_fit_py(),alpha_nu_fit_py(),rho_nu_py(), and spline fit functionsalpha_{I, Q, V}_spline(),rho_{Q, V}_spline(), andchi_ij(). - The first two provide calculated values of the emissivity and absorptivity for the input parameters, and the second two provide the corresponding approximate fitting formula results.
- The function
rho_nu_py()computes Faraday rotation coefficients using the symphony integrator; this is slow, and should only be used as a check of the spline fits.
- The arguments of these functions can be found by accessing the associated docstrings. This can be done in the
Pythoncommand line using the following:
import symphonyPy
symphonyPy.j_nu_py?
- Arguments for all emissivity, absorptivity, and Faraday rotation coefficient functions in both
CandPythontake nearly the same arguments and output a double. The only difference is that the C version has anerror_messageparameter for handling evaluation errors, and the absorptivity coefficients include a switch to choose the integration method. The arguments are:
j_nu(nu, magnetic_field, electron_density, observer_angle, distribution, polarization,
theta_e, power_law_p, gamma_min, gamma_max, gamma_cutoff, kappa, kappa_width,
error_message)
Sample values:
j_nu_py(): j_nu_py(230e9, 30, 1, 1.047, symphonyPy.MAXWELL_JUETTNER, symphonyPy.STOKES_I,
10, 2.5, 1, 1000, 1e10, 3.5, 10)
- Note: All parameters with units are in CGS.
- Note: In
C, the keyssymphonyPy.MAXWELL_JUETTNERandsymphonyPy.STOKES_Iare members of a struct calledparams. They can be used with:params->MAXWELL_JUETTNERandparams->STOKES_I.
- Add an anisotropic DF
- Put in warnings for frequencies outside the intended frequency regime (much greater than the plasma, relativistic cyclotron frequencies)
- Make cmake automatically add kernel_samples_datafiles/ directory to susceptibilityPy.pyx