Output Stokes Q, U, and V flux contributions#261
Merged
petercamps merged 4 commits intoSKIRT:masterfrom Feb 3, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description and motivation
We extend the FluxRecorder to also output the flux contributions (i.e., direct, scattered, secondary) of the Stokes Q, Stokes U, and Stokes V photon fluxes when modelling polarisation, which is crucial to analyse and interpret (X-ray) polarisation simulations. The main motivation is the analysis of a project I am working on now, but I have missed this functionality before.
We decided to only output the flux contributions for the SED instruments and not for the IFU instruments, in order to not let the number of output files explode (one IFU per contribution). If this information would be required for IFUs in the future, SKIRT can be extended following the same pattern.
The order of the columns could be debated. Now the order seems illogical as the pattern is different for Stokes I vs. Q, U, and V. But this is consistent with the current implementation (i.e., not changing the order of the columns that are already there).
I also changed the order "SecondaryTransparent, SecondaryDirect, SecondaryScattered" -> "SecondaryDirect, SecondaryScattered, SecondaryTransparent" in the code (no effect for the user), to be consistent with the order of the output columns.
Tests
As a test case, we ran X-ray radiative transfer simulations of an AGN torus, centred on a polarised X-ray point source (PL=10%, gamma = 30 deg). We compare the total Stokes parameters to the current implementation: CompareCurrentNew.pdf. We plot the Stokes Q and Stokes U contribution (noting that Stokes V is not being studied in X-rays): StokesUComponents.pdf and
StokesQComponents.pdf. Finally, we checked if the Stokes contributions add up to the total Stokes parameters: ConsistencyCheck.pdf.
Also confirmed there are no changes to the IFU instrument output.