Description
Turns out the sampling of random photon packet directions for polarised secondary emission was wrong: the directions were not sampled correctly. There were two issues: first of all, there was a small issue with the calculation of the cumulative distribution function for the sampling. Second and most important, in the old implementation the randomly generated direction was not transformed from the dust frame (reference frame with the z-axis along the magnetic field direction) to the lab frame, leading to a completely incorrect sampling of the anisotropic emission profile.
Motivation
This issue was discovered while running a dedicated test case for secondary emission, described in detail below.
Tests
To test the intensity and polarisation state of secondary emission photon packets that contribute to the random walk, we set up a test in the grid depicted below:
The central cell is filled with spheroidal dust particles that align with a magnetic field that has an arbitrary direction (out of the plane of the grid and on purpose not aligned with any coordinate direction). In the center of the central cell, a single source is located that emits polarised radiation according to a SineSquaredPolarizationProfile, at a single frequency. The source will heat the dust and cause secondary emission.
The 4 cells at the edges of the cross that has the central cell at its center are filled with electrons, so that light is Thomson scattered towards an observer that looks down onto the xy plane. During this scattering, the Stokes I and Q components mix up, making the observed intensities depend on both the intensity and polarization state of the emission (in a predictable way). We can test that we understand our setup by observing the scattered light from the source, since this has a known polarization state (and this polarization should work correctly).
We then test the same scenario for polarised dust emission by constructing a custom optical property table with different behaviour at 3 distinct wavelengths:
at 50 micron, light is emitted isotropically, but polarised (this is identical to what happens for the source),
at 100 micron, light is emitted anistropically, but without polarisation
at 200 micron, light is emitted anisotropically and with polarization. This is the realistic scenario.
By only studying the emission at these 3 wavelengths, we can test both the polarization, the anisotropy and the combination in one test.
The result is shown in the image below:
The top row shows the anistropic observed intensity. While this is anistropic at all wavelengths, this has various reasons: the source light and 50 micron emission are anistropic because of the mixing of Stokes I and Q during electron scattering, while the 100 micron emission is anistropic because the emission is anistropic. The 200 micron emission is anistropic because of both reasons. For all cases, the observed light from the central source has the correct polarisation direction (perpendicular to the transverse component of the magnetic field), and is observed without any noticeable Stokes U intensity (as it should be). The (normalised) Stokes Q and I intensities match the expected values for all cases.
The source files (and README) for this test can be found in test.tar.gz.
Guidelines
The code was automatically formatted using the formatting script.
Description Turns out the sampling of random photon packet directions for polarised secondary emission was wrong: the directions were not sampled correctly. There were two issues: first of all, there was a small issue with the calculation of the cumulative distribution function for the sampling. Second and most important, in the old implementation the randomly generated direction was not transformed from the dust frame (reference frame with the z-axis along the magnetic field direction) to the lab frame, leading to a completely incorrect sampling of the anisotropic emission profile.
Motivation This issue was discovered while running a dedicated test case for secondary emission, described in detail below.
Tests To test the intensity and polarisation state of secondary emission photon packets that contribute to the random walk, we set up a test in the grid depicted below: The central cell is filled with spheroidal dust particles that align with a magnetic field that has an arbitrary direction (out of the plane of the grid and on purpose not aligned with any coordinate direction). In the center of the central cell, a single source is located that emits polarised radiation according to a
SineSquaredPolarizationProfile
, at a single frequency. The source will heat the dust and cause secondary emission. The 4 cells at the edges of the cross that has the central cell at its center are filled with electrons, so that light is Thomson scattered towards an observer that looks down onto the xy plane. During this scattering, the Stokes I and Q components mix up, making the observed intensities depend on both the intensity and polarization state of the emission (in a predictable way). We can test that we understand our setup by observing the scattered light from the source, since this has a known polarization state (and this polarization should work correctly). We then test the same scenario for polarised dust emission by constructing a custom optical property table with different behaviour at 3 distinct wavelengths:By only studying the emission at these 3 wavelengths, we can test both the polarization, the anisotropy and the combination in one test. The result is shown in the image below: The top row shows the anistropic observed intensity. While this is anistropic at all wavelengths, this has various reasons: the source light and 50 micron emission are anistropic because of the mixing of Stokes I and Q during electron scattering, while the 100 micron emission is anistropic because the emission is anistropic. The 200 micron emission is anistropic because of both reasons. For all cases, the observed light from the central source has the correct polarisation direction (perpendicular to the transverse component of the magnetic field), and is observed without any noticeable Stokes U intensity (as it should be). The (normalised) Stokes Q and I intensities match the expected values for all cases. The source files (and README) for this test can be found in test.tar.gz.
Guidelines The code was automatically formatted using the formatting script.