## Name

snapfour - fourier analyze a snapshot

## Synopsis

snapfour in=snapshot_file [parameters=values...]

## Description

snapfour computes a number of requested fourier (cos and sin) coefficients in a user determined part of the snapshot By default the snapshot is divided in a set of concentric cylindrical rings, and a fourier analysis is done in cylindrical coordinates.

The observable quantity f is fitted as

```  f(r,theta) = sum_{cmi..}{A(r)cos(cmi*theta) + sum_{smi..}{B(r)sin(smi*theta)

```
where x, y as well as f r = sqrt(x*x+y*y) , theta=atan2(y,x)
can be any arbitrary bodytrans(3NEMO) expression using the xvar, yvar and fvar keywords. The least squares is done using normalized equations, which are known for roundoff problem in case a large number of coefficients or points are used.

Optionally the cos (A) and sin (B) coefficients can be transformed into an amplitude (C) and phase (P), see amode= below.

## Parameters

The following parameters are recognized in any order if the keyword is also given:
in=in_file
Input data file, must be in standard snapshot(5NEMO) format [No default].
Radii of the rings (but see xvar and yvar below) within which the fourier coefficients are computed. [Default: 0:2:0.2].
cos=cm1,cm2,..
Set of integers for which the cosine amplitudes need to be computed. [Default: 0:4].
sin=sm1,sm2,..
Set of integers for which the sine amplitudes need to be computed. [Default: 1:4].
xvar=x-variable
X-variable which is used to compute the radius and angle used in the fourier decomposition. [Default: x].
yvar=y-variable
Y-variable which is used to compute the radius and angle used in the fourier decomposition. [Default: y].
fvar=f-variable
Fourier-variable which is the variable used in in the fourier decomposition. [Default: vy].
weight=w-variable
Weight-variable which is the weight applied to the observable. [Default: 1].
amode=t|f
Logical; if true it displays the sin and cos terms, if false, the amplitudes and phases (in degrees). [Default: t]
times=t1,t2,...
Times to select for analysis. [Default: all].

## Examples

```  % mkexpdisk disk1 10000
% snapfour disk1 amode=f > tab1
% tabplot tab1 1 4,3,6,8,10 line=1,1 color=2,3,4,5 ycoord=0
% tabplot tab1 1 5:11:2 line=1,1 color=2,3,4,5 ycoord=0
```
Another case is that of an inclined disk that first needs to be rectified, but preserving the position angle of the major axis. Lets assume the \$pa and \$inc are known. Unlike for kinematic observations (see e.g. rotcur(1NEMO) ) we don’t care which side of the disk is the near side. The rectify operation to get the galaxy back to a "face-on" view depends if you disk is truely 3D or (as is normally observed) a sky-projected inclined disk. For the former case we then get:
```  % snaprotate disk1 disk2 theta=-\$pa,-\$inc,\$pa order=zyz
% snapfour disk2 ...
```
and for the latter case
```  % snaprotate disk1 -     theta=-\$pa order=z         |\
snapscale  -     -     rscale="1/cosd(\$inc),1,0"  |\
snaprotate -     disk2 theta=\$pa  order=z
% snapfour disk2 ...
```

bodytyrans(1NEMO) , orbfour(1NEMO) , snapshot(5NEMO)

Binney, J.J. & Spergel, D. (1982) ApJ 253, 308.

Peter Teuben

## Files

```~/src/nbody/reduc    snapfour.c
```

## Update History

```3-dec-90    V1.0: written    PJT