Added inclination/PA/azimuth to image parameters#63
Conversation
Added the possibility to set the inclination, position angle and the azimuth angle in the image parameters (img[i].incl, img[i].posang, img[i].azimuth). If either of the three new angles are not set in the image structure the old theta and phi will be used. Added incl/posang/azimuth to the example model
|
For the record, I'm quoting @AttilaJuhasz 's email here:
The issue/question on the polarisation is described in #68. |
|
Are these really image parameters? It seems to me they describe the source, and not the way the images are computed. The only reason to put them in the |
|
Inclination, position angle and azimuth are just as much image parameters as theta and phi. They are actually even more. Theta and phi describe the rotation around the X- and Y-axes and are equivalent to the inclination and position angles. However, it is more convenient to use inclination and position angle as observations traditionally report these angles not theta and phi. Moreover I don't see how you can describe the azimuth angle with theta and phi. For axisymmetric models the azimuth doesn't matter but for truly 3D models it does. Granted, you can always rotate the model structure with the azimuth but that's a bit troublesome as you need to implement the rotation in all model functions from the density() to the velocity(). It is way more simple to just rotate during the raytracing. |
Sorry I forgot that I've tested these changes with a 2D axis symmetric model and it seems to works fine. Indeed it is much more convenient to set the position and inclination angle in this fashion. Could you please document these changes in the user manual? For this you need to edit the |
|
I would like to see this PR included in the next LIME release, but for this the new parameters needs to be documented. |
|
This is a useful addition to LIME's capabilities. I found a couple of errors though, and I have some suggestions for enhancements.
Also, having set defaults of -999.0, I would test all three angles for equality with that rather than testing for <-100. In this scheme, safest (read 'least unsafe') would be something like Testing two floats for equality is evil, but the whole necessity for flagging unset optional parameters via impossible (or at least unlikely) default values is pretty evil, although unavoidable unless we want to force the user to set a bunch of extra boolean parameters. (Some day we will replace this C crap with a proper python interface which will make this stuff much neater!) At the very least I would test for <-900 rather than <-100, which is an angular value I could plausibly imagine a user choosing. Finally, I would use || rather than | myself, even for expressions which will only take a non-zero value in the LSB. Bitwise operations should be reserved for bitwise contexts.
|
|
...or rather |
|
After a great deal of offline discussion, I hope @AttilaJuhasz and I can now agree on the following: (I adopt the usual convention that
Moving on to the proposed {az,inc,PA} scheme, I believe that my analysis of @AttilaJuhasz's suggested rotMat (after the correction indicated) is correct. In particular:
I do suggest that all three of these angular values, as reverse-engineered from @AttilaJuhasz's supplied matrix, require either some applied scalar offset, or an inverse in sign, or both. This is purely a matter of convention and is something which astronomer users are in a better position to dictate than me; nevertheless, below is my understanding, subject to correction, of the way things ought to be arranged.
(cos(az+PI/2.) = -sin(az) etc, but let's keep it simple.)
|
|
While I agree with most of what @allegroLeiden listed I do not agree with all of them.
@allegroLeiden @smaret would it be to big of a change in the raytracer to move the observer at the starting position from z=-infinity to z=+infinity, so then for phi=0 and theta<90deg the model would face the observer with the side that is located at positive z values. 5)-6) The theta and phi rotations change both the inclination and the position angle in the general case. So I'm not really sure how to implement PA next to theta and phi in a self-consistent way, but maybe I just don't see the forest for the trees. :-) In the 1 July implementation of @allegroLeiden when using {theta, phi, PA} the first rotation by 'posang' will set the position angle of a disk in the X-Y plane of the model only if phi=0. For phi=90deg, the position angle of a disk in the x-y plane would be theta + posang if I'm not mistaken.
The observer would be located at z=+infinity looking down onto the model. Then the three rotations would produce the following orientation This way if we have a disk-like structure flattened along the z-axis, whose mid-plane corresponds to the model X-Y plane then {az,incl,PA}=(0,0,0) will give us an face-on orientation of the model, {az,incl,PA}=(0,90,0) would give us an image with an edge-on disk whose major axis is vertical on the image (i.e. aligned with the declination axis), while {az, incl, PA} = (0, 90, 90) would give us again an edge-on disk whose major axis is aligned horizontally in the image, which is consistent with the astronomical notation assuming that the RA axis of the image is pointed to the left. |
|
|
|
|
A figure in the user manual showing the various angle definition with respect to the x, y and z axis would be extremely useful I think. |
|
There already is one for the theta/phi stuff. |
|
Here is a figure showing the changes proposed by Ian, as I understand them. Indeed the PA angle is usually defined from North to East, so we would need to change it sign. Also as noted by @AttilaJuhasz, an inclination of 0 degrees for disk rotating around the z axis usually corresponds to an edge-on disk; so the inclination should be replaced by 90-inclination in the figure above. With these minor changes, the angle definitions would look like this: Do we all agree on these definitions? |
|
Sorry, @smaret , your diagrams don't seem to correspond with either @AttilaJuhasz 's original suggested code or his diagrams in his point 10 of 18 July. I have suggested no scheme myself, I am just trying to interpret AJ's. Without going into mathematical detail, your scheme and his cannot be consistent, because he assumes incl==0 corresponds to a face-on disk whereas you assume it corresponds to an edge-on disk. |
|
I attach some drawings of a donut with its positive XY quadrant shaded, rotated to various angles according to AJ's scheme of 18 July (I'm assuming that his rotations are performed about the fixed frame and that they are done in the order az, incl, pa). @AttilaJuhasz please tell me if I have misunderstood. If not, the only question @smaret is whether you agree with this scheme or not. |
|
Oops sorry it is a pdf. |
|
Michiel agrees with your definitions @AttilaJuhasz. Pseudo code for matrices which will generate the behaviour you describe is If you code the PR that way I'll accept it. |
New image parameters incl, posang, azimuth have been added as an alternative way to rotate the model. The way to select these is a bit primitive: they are each given a default value of -999 and detected values of >-900 for both incl and azimuth will trigger use of these parameters rather than the older theta/phi angles. The zero points and directions of these rotations have been defined according to Attila Juhasz's recommendations in the discussion of lime-rt#63. I modified the model.c to exemplify the new angles instead of the old. Finally, for convenience I added a (commented-out) line in the makefile with a debugging switch.
|
Superseded by #161. |


Added the possibility to set the inclination, position angle and the azimuth angle in the image parameters (
img[i].incl,img[i].posang,img[i].azimuth). If either of the three new angles are not set in the image structure the oldthetaandphiwill be used.