Fix for 3D RM Synthesis --- Outputting NaN for pixels without input data #107
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.
This pull request comes from an action item of the on-going POSSUM Busy Week
It has been identified from the POSSUM 3D pipeline that, for pixels without any valid input data, some of the output data products are set as 0 instead of NaN, which can make it confusing regarding whether those are valid pixels with the output results coincidentally being 0, or that they are actually invalid pixels
This pull request fixes the issue by:
(1) Changing util_misc.toscalar:
Currently, if a fully masked array (e.g., by passing an array full of NaNs through MAD()) is input to toscalar(), the output will be 0.
This can then lead to, for example, the FDF uncertainty being set as 0 instead of NaN (because it can be calculated by toscalar(MAD(...)))
(2) Changing fundamentally how RM-Synthesis is run, through modifying util_RM:
If, for any particular pixel, the Q&U data are all 0 across frequency (e.g., the individual SBID of POSSUM data), then RM-Synthesis will still be run and give FDF=0 across FD.
This has now been fixed by forcing the output FDF to be NaN throughout FD, if the FDF itself is found to be identical to 0 across FD (which result from input Q=U=0)