HTML automatically generated with rman
Table of Contents

Name

snaprotate - rotate N-body snapshot file about principle axes.

Synopsis

snaprotate in=snap-file out=snap-file [parameter=value] ...

Description

snaprotate rotates the positions and velocities of an N-body snapshot file. A maximum of 3 rotations around either the x, y or z axes can be applied in any order. An Eulerian rotation is a rotation around the z, y and z axes respectively. Some common examples for projections of barred and unbarred galaxies are given in the examples below.

The rotation is counter clock-wise (i.e., mathematically positive, unless invert=f is used) as seen from the right-handed xyz-axes; a z rotation will rotate the x axis towards the y axis; a y rotation will rotate the z axis towards the x axis; a x rotation will rotate the y axis towards the z axis.

An alternate way to specify rotations is using the spinvector= keyword, where all points are rotated around this vector.

Although by default all vectors are rotated by the same matrix, the keyword select= can be used to select any set of Position, Velocity or Acceleration.

Parameters

The following parameters are recognized; they may be given in any order.
in=snap-file
Input data is read from snap-file, which must be in snapshot format.
out=snap-file
Output data is written to snap-file.
theta=x-angle
Angles (in degrees) to rotate particles about the specified axes in the order= keyword. Up to 3 rotations can be applied. Default: none.
order=trans-order
Order to apply the rotations about the three coordinate axes. An Eulerian rotation would be order=zyz. Default is none. See also the spinvector keyword below for an alternate way to specify rotations.
invert=invert-flag
If true, invert specified transformation. Useful for rotating something back to original coordinate system. Default is false.
tscale=t-scale-factor
If used, this is the degrees per time-unit that the theta angles are multiplied with in order to calculate the actual rotation angle. This can give interesting effects if used for simulations. Default not used.
spinvector=x,y,z
Use this vector if you know the vector to rotate around instead of a set of euler angles. Only one angle theta= is needed. Positive rotation is a counterclockwise rotation as seen down the spin vector towards the origin. The vector does not need to be normalized. **note this option still disables various other options such as tscale, invert
select=vec1,vec2,...
Vector variables in a snapshot that should be rotated. Valid options are: pos, vel, and acc. Exact match required for now. [Default: pos,vel,acc]

Examples

Suppose you have a barred galaxy model, bar.dat, with the galactic plane at z=0 and the bar along the y axis ("position angle=0"), and want to project this (such that z=0 will be the sky plane, and the positive z-axis pointed towards the observer) with given final position angle ($pa), inclination ($inc) and angle from line of nodes to bar ($phi) the following rotations will do the job:
    set pa=39
    set inc=-45
    set phi=-34
    snaprotate bar.dat n7476.dat "atand(tand($phi)/cosd($inc)),$inc,$pa"
zyz
    snapplot n7476 psize="z>0?0.03:0.0"
where psize was choosen such that ‘‘near’’ (z>0) particles were plotted a bit bigger to accentuate the near side of the model. Flipping the sign if $inc will flip the near and far side.

For ’normal’ spiral galaxies the following example shows how to project them into their normaly sky view, taking the sense of rotation into account:

   set pa=170             # M51, use pa=-160 for M33
   set inc=22             # M51, use inc=30 for M33
   set sign=-1            # M51, use sign=1 for M33
   set sinc=‘nemoinp "iflt($sign,0,$inc,-$inc)"‘
   mkdisk - 1000 sign=$sign |\
      snaprotate - - theta=$sinc,$pa order=yz |\
      snapgrid - velfie.ccd mom=-1
   nds9 velfie.ccd        # view the velocity field using ’ds9’
With sign=-1 it will create a counter-clockwise rotating disk and project it using $inc,$pa, For a clock-wise rotating disk the math is nearly the same, except the sign for the inclination needs to be flipped, or -$inc,$pa, hence the somewhat awkward looking expressing to compute sinc.

See Also

snapshift(1NEMO) , snapscale(1NEMO) , snapspin(1NEMO) , snapshot(5NEMO)

Author

Joshua E. Barnes, Peter Teuben

History


xx-jan-88    V1.0 original                       JEB
3-oct-88    V2.1 eulerian angles (order=zyz)    PJT
17-feb-89:      V2.1a new get+snap macros redef’s    PJT
27-nov-89:    V2.1b cosmetic defv[]                 PJT
15-nov-90    V3.0 theta is now an array keyword    PJT
1-jun-92    documented the rotation manner bit more precise         PJT
11-jun-92    V4.0 rotation now defined in math sense                 PJT
21-nov-98    V5.0 added tscale= keyword    PJT
18-nov-05    V5.1a added select=, also implemented select=acc    PJT
22-sep-08    V6.0 added spinvector=    PJT


Table of Contents