SKIRT / SKIRT9

SKIRT version 9 -- advanced radiative transfer in dusty systems
http://www.skirt.ugent.be
GNU Affero General Public License v3.0
38 stars 31 forks source link

HEALPixSkyInstrument calibration and coordinate transformation fixes #86

Closed bwvdnbro closed 3 years ago

bwvdnbro commented 3 years ago

Description The flux calibration in the HEALPixSkyInstrument was wrong, leading to fluxes that did not respect some basic physical laws, like the law that states that a flux should decrease with the distance to an object. It is very likely that the same is true for the AllSkyInstrument and the PerspectiveInstrument. This pull request adds an additional configuration flag and variable to FluxRecorder that allows for a proper calibration of the fluxes (upon detection of a photon packet) without affecting the calibration for other instruments. The pull request also gets rid of the current coordinate transformation used by the HEALPixSkyInstrument to convert from world coordinates to the observer coordinate frame, since this transformation did not yield intuitive results. The instrument documentation was updated to reflect all changes.

Motivation The original HEALPixSkyInstrument calibration depended on an arbitrary radius and scaled accordingly. This made it impossible to compare fluxes with observational results (e.g. the Planck all-sky maps), and also turned out to be wrong, since distant objects appeared brighter than they should.

Tests sourcecube.zip contains the files required to set up a simple test case, consisting of a cube with side length 2 kpc and centred at the origin that has a number of sources on its faces, edges and corners. The sources are observed by a HEALPixSkyInstrument at the origin. The base idea is to put sources at the centres of all 6 faces, the centres of all 12 edges, and on all 8 corners. However, this leads to symmetric positions for the observed fluxes, which makes it impossible to test the projected positions. For this reason, only a quarter of the cube is actually used. All sources have the same luminosity, and since we know all distances and solid angles involved, it is possible to predict the observed fluxes. The results match the predictions: result The .zip file contains a template .ski file without sources, a script (write_sourcecube_ski.py) to generate the actual .ski file for the test, and an analysis script (results.py) that generates the above image. The latter uses PTS to match sky angles to HEALPix pixels.

Guidelines Code was formatted with the formatting script.

Context The changes to FluxRecorder have been made in such a way that they do not currently affect the other instruments. Since I am however more and more convinced that the calibration for AllSkyInstrument and PerspectiveInstrument is also wrong, it might be good to revise these as well before merging this request.

petercamps commented 3 years ago

The changes proposed here were implemented by pull request #87 because the issues turned out to exist for all local instruments, so that a more generic implementation was called for.