Program: MOMENTS Purpose: Program to calculate moments and other properties of a profile Category: MANIPULATION, CALCULATION, PROFILES File: moments.c Author: M. Vogelaar Keywords: INSET= Give set (, subsets): Maximum number of subsets is 2048. BOX= Frame for input subsets. [entire subset] OPTION= Give option(s) 0..7 [List options] 0: Sum of profile amplitudes (zeroth moment, without multiplication with the channel spacing). 1: Intensity weighted mean of physical coordinates along profile (first moment). 2: Dispersion in intensity weighted physical coordinates along profile (second moment). 3: Physical coordinate of peak value in profile. 4: Peak value in profile. 5: Dispersion in intensities. 6: Number of subset contributions. 7: Intensity weighted Mode (only with WINDOW=0). OUTSET= Output set (,subsets). Maximum number of subsets is equal to the maximum number of different options. AUTO= Automatically set minimum per profile? Y/[N] The physical coordinates in a profile are weighted with the intensities of the pixels in that profile. An intensity weighted mean can only be weighted with positive pixel values. To avoid bias caused by noise contributed by pixels with a small positive value, this option calculates a threshold per profile. This threshold is the absolute value of the pixel in the profile with the highest negative value and only pixel values higher than the threshold are included in the moment analysis. RANGE= Give range of levels to work on. [0.0 inf] The keyword is prompted if AUTO=N Input consists of two values. The first value may be greater than the second. See the description for the correct use of this keyword. The threshold is set to zero because negative weights are not allowed by definition. RANGE= accepts the strings INF and -INF as input. WINDOW= Give window for data selection: [0, i.e. no window] See description. WINMODE= Stat. in most sign. peak(0), or all peaks(1): [0]/1 See description. Description: To calculate moments in profiles you first need to specify the set and the subsets. The number of subsets must be greater than 1 and less than 2048 and the sub- sets are specified by giving the name of the axis in the direction in which you want your profiles. Suppose your set AURORA has the axes: RA-NCP from -7 to 8 DEC-NCP from -7 to 8 FREQ-OHEL from 1 to 59 and you want to make an integrated line emission map; SUM[I] . Channel interval (in mapunits.channel) (e.g. K km/s) a velocity map; = SUM[I.V]/SUM[I] (in CUNITs of V axis) and a velocity dispersion map; = SQRT[ - ] of all channel maps, you specify: INSET=AURORA FREQ Choose option 0, 1 and 2 from the OPTION menu and give a name for the output set. The program will create a new set in which the FREQ axis disappeared and a new axis (PARAM) is made with length 3. The first subset along the PARAM axis contains the integrated subsets (in units of the original data) and the second one contains the velocity field (m/s) and the third the dispersion in m/s. The velocity is an intensity weighted mean of the converted velocities along your operation axis (the FREQ axis in the example). In general, the program will work for profiles in any direction and instead of velocity you could think of any kind of physical coordinate. The program inserts automatically the correct units in the header of the output set. Use can be made of a cutoff in the data values. This is achieved by specifying a range in amplitudes with the keyword RANGE= This keyword is prompted if AUTO=N (default). If AUTO=Y then a lower cutof value is calculated per profile. This threshold is the absolute value of the pixel in the profile with the highest negative value and only pixel values higher than the threshold are included in the moment analysis. Examples of the use of the RANGE= keyword: RANGE=0, 20 (If 0 moments MOMENTS Version 1.0 (Oct 9 1992) MOMENTS INSET=M8320 f Set M8320 has 3 axes RA-NCP from -50 to 40 DEC-NCP from -50 to 20 FREQ-OHEL from 1 to 59 MOMENTS BOX=-10 -10 10 10 BOX range for set M8320 : RA-NCP from -10 to 10 DEC-NCP from -10 to 10 MOMENTS OPTION=1 3 4:6 MOMENTS OUTSET=M8320moments Set M8320moments has 3 axes RA-NCP from -50 to 40 DEC-NCP from -50 to 20 PARAM-MOMENTS from 0 to 4 MOMENTS RANGE= MOMENTS WINDOW= ============================= MOMENTS =========================== Profiles examined from set [M8320] Results in output set [M8320moments] -subset 0: Intensity weighted mean of physical coords. -subset 1: Physical coordinate of peak value in profile. -subset 2: Peak value in profile. -subset 3: Dispersion in intensities. -subset 4: Number of subset contributions. Units of operation axis: KM/S Units of data: W.U. MOMENTS +++ FINISHED +++ Updates: Apr 22, 1991: VOG, Document created. Oct 8, 1992: VOG, Store physical coordinate of peak also (option 3). Jan 20, 1993: VOG, Profile statistics in function, keyword WINMODE= added. Jul 1, 1994: VOG, 'Mode' option implemented. Oct 25, 1995: VOG, Changed sigma in 3rd moment (skewness) Feb 1, 2000: JPT, Increased number of subsets. May 26, 2000: VOG, Added option flag for st_weights to be able to get a stand alone dispersion set. Apr 20, 2007: VOG, Changed documentation about profile integration Dec 5, 2014: VOG, Promoted calculations to double precision. More attention to restriction of positive weights. Apr 28, 2016: VOG, Removed (very) old bug with 'messbuf' too small when including the set name in an output message.