Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LinuxPops Math Commands

Math

Commands:

    let:            Assign variable a value or the results of a mathematical expression.
    set:            Alias for let.
    int:            Create an integer variable.
    double:         Create a double precision variable;
    eval:           Print out the evaluation of the passed expression.
    dlist:          Display a list of all internal variables.

Math Parser:

Linuxpops contains a general math parser based on David I. Bell and Landon Curt Noll's CALC - An arbitrary precision calculator.

Found here: http://www.isthe.com/chongo/tech/comp/calc/index.html

In addition to the usual = + - * / ^, the following math operations are supported:

    Name    Args    Description

    abs       1-2   absolute value within accuracy b
    acos      1-2   arccosine of a within accuracy b
    acosh     1-2   inverse hyperbolic cosine of a within accuracy b
    acot      1-2   arccotangent of a within accuracy b
    acoth     1-2   inverse hyperbolic cotangent of a within accuracy b
    acsc      1-2   arccosecant of a within accuracy b
    acsch     1-2   inverse csch of a within accuracy b
    agd       1-2   inverse gudermannian function
    appr      1-3   approximate a by multiple of b using rounding c
    asec      1-2   arcsecant of a within accuracy b
    asech     1-2   inverse hyperbolic secant of a within accuracy b
    asin      1-2   arcsine of a within accuracy b
    asinh     1-2   inverse hyperbolic sine of a within accuracy b
    atan      1-2   arctangent of a within accuracy b
    atan2     2-3   angle to point (b,a) within accuracy c
    atanh     1-2   inverse hyperbolic tangent of a within accuracy b
    avg       0+    arithmetic mean of values
    ceil      1     smallest integer greater than or equal to number
    cmp       2     compare values returning -1, 0, or 1
    cos       1-2   cosine of value a within accuracy b
    cosh      1-2   hyperbolic cosine of a within accuracy b
    cot       1-2   cotangent of a within accuracy b
    coth      1-2   hyperbolic cotangent of a within accuracy b
    csc       1-2   cosecant of a within accuracy b
    csch      1-2   hyperbolic cosecant of a within accuracy b
    euler     1     Euler number
    exp       1-2   exponential of value a within accuracy b
    fact      1     factorial
    floor     1     greatest integer less than or equal to number
    frac      1     fractional part of value
    gd        1-2   gudermannian function
    getenv    1     value of environment variable (or NULL)
    hmean     0+    harmonic mean of values
    hypot     2-3   hypotenuse of right triangle within accuracy c
    ilog      2     integral log of a to integral base b
    ilog10    1     integral log of a number base 10
    ilog2     1     integral log of a number base 2
    int       1     integer part of value
    inverse   1     multiplicative inverse of value
    iroot     2     integer b'th root of a
    lcm       1+    least common multiple
    lcmfact   1     lcm of all integers up till number
    ln        1-2   natural logarithm of value a within accuracy b
    log       1-2   base 10 logarithm of value a within accuracy b
    max       0+    maximum value
    meq       3     whether a and b are equal modulo c
    min       0+    minimum value
    mmin      2     a mod b value with smallest abs value
    mod       2-3   residue of a modulo b, rounding type c
    near      2-3   sign of (abs(a-b) - c)
    norm      1     norm of a value (square of absolute value)
    perm      2     permutation number a!/(a-b)!
    pmod      3     mod of a power (a ^ b (mod c))
    power     2-3   value a raised to the power b within accuracy c
    quo       2-3   integer quotient of a by b, rounding type c
    rand      0-2   additive 55 random number [0,2^64), [0,a), or [a,b)
    random    0-2   Blum-Blum-Shub random number [0,2^64), [0,a), or [a,b)
    root      2-3   value a taken to the b'th root within accuracy c
    round     1-3   round value a to b number of decimal places
    scale     2     scale value up or down by a power of two
    sec       1-2   sec of a within accuracy b
    sech      1-2   hyperbolic secant of a within accuracy b
    sgn       1     sign of value (-1, 0, 1)
    sin       1-2   sine of value a within accuracy b
    sinh      1-2   hyperbolic sine of a within accuracy b
    sqrt      1-3   square root of value a within accuracy b
    ssq       1+    sum of squares of values
    tan       1-2   tangent of a within accuracy b
    tanh      1-2   hyperbolic tangent of a within accuracy b
    trunc     1-2   truncate a to b number of decimal places

There are many more commands in the calc program, but do not lend themselves to our application.

Linuxpops will substitute named variables with their current values before passing to the math processor.

Examples:

    Linuxpops(C) >> double tvar
    Linuxpops(C) >>  # New Variable: tvar
    Linuxpops(C) >> let tvar = pi
    Linuxpops(C) >>  # Setting tvar to 3.141593
    Linuxpops(C) >> tvar = pi
    Linuxpops(C) >>  # Setting tvar to 3.141593
    Linuxpops(C) >> print tvar
    DVar:    tvar = 3.1415926535897931

If a scan is loaded you can print and use header variables in math functions:

    Linuxpops(H0) >> get 6941.03
    Linuxpops(H0) >>  # Fetching Scan 6941.03 into H0
    Linuxpops(H0) >>  # read_scan(): Returned: 6941.00
    Linuxpops(H0) >> p restfreq
    HEADER: restfreq = 112000.0000000000000000
    Linuxpops(H0) >> eval restfreq / 1e3
    Results: 112.000000
    Linuxpops(H0) >> double freqGHz
    Linuxpops(H0) >>  # New Variable: freqGHz
    Linuxpops(H0) >> freqGHz = restfreq / 1e3
    Linuxpops(H0) >>  # Setting freqGHz to 112.000000
    Linuxpops(H0) >> print freqGHz
    DVar:    freqGHz = 112.0000000000000000

Listing Variables:

    Linuxpops(H0) >> dlist
    Defined Dynamic Variables
    D:                 pi:      (double)       3.141593
    D:             planck:      (double)     6.6261e-34
    D:          boltzmann:      (double)     1.3806e-23
    D:                ctr:      (double)       0.017453
    D:                ctd:      (double)      57.295780
    D:                sol:      (double)     2.9979e+08
    D:       last_mouse_x:      (double)     0.0000e+00
    D:      last_mouse_x2:      (double)     0.0000e+00
    D:       last_mouse_y:      (double)     0.0000e+00
    D:      last_mouse_y2:      (double)     0.0000e+00
    D:        manual_tcal:      (double)     0.0000e+00
    D:     interpl8_debug:      (int)                 0
    D:            stquiet:      (int)                 0
    D:     use_multi_hist:      (int)                 0
    D:            freqGHz:      (double)     112.000000
    E:              title       (char)           nsac tests  Environment Title: User define-able
    E:           filename       (char)  SULFURPROJECTBERNAL  Current Selected datafile
    E:          gfilename       (char)     gsdd_aro.lmz_163  Current Selected gains datafile
    E:             source       (char)                G34.3  Currently Selected Source
    E:            backend       (char)                       Spectrometer/Continuum Backend Name: i.e. F1M-HU
    E:           savefile       (char)  SULFURPROJECTBERNAL  Save filename
    E:           userfile       (char)                    .  User filename Used by 'print /w' command
    E:              accum:      (int)                 0      If True, We are in the process of accumulating scans
    E:         accumcount:      (int)                 0      Total number of scans last accumulated
    E:         accumreset:      (int)                 1      If True, Next call to the accum function resets all registers
    E:  acc_plot_select_x:      (int)                 0      Accumm plot x axis: 'num', 'el', 'ut', 'scannum'
    E:  acc_plot_select_y:      (int)                 0      Accumm plot y axis: 'sig', 'sky', 'smror', 'tsys', 'tastar', 'tr', 'jansky'
    E:             acount:      (int)                 0      Total number of items in stack
    E:             ashift:      (int)               -16      Number of channels to shift spectra - or +
    E:            autobad:      (int)                 0      Automatically remove bad channels when encountered
    E:            autotau:      (int)                 0      If True, Process SPTIP's as you encounter them during accum
    E:       badchanepoch:      (int)        1525365363      Epoch of the 'fixed' bad channel array
    E:        badchanshow:      (int)                 0      If True, Place markers on defined bad channels
    E:              bdrop:      (int)                 0      Number of channels to drop from beginning of spectral plot
    E:            bkmatch:      (int)                 0      Backend matching mode: 0 = FEED, 1 = RESOLUTION, 2 = NAME
    E:              bmark:      (int)                 1      If True, show baseline region boxes on plot
    E:              bshow:      (int)                 0      If True, Show the baseline fit on plot
    E:            calmode:      (int)                 0      Cal Mode: 0 = NONE, 1 = CALSCALE, 2 = BEAMEFF, 3 = TELE_EFF
    E:       check_bkname:      (int)                 0
    E:         check_date:      (int)                 0      If True, Use the Date in the search criteria
    E:         check_feed:      (int)                 0      If True, Use the IF Feed in the search criteria
    E:         check_freq:      (int)                 0      If True, Use the Frequency in the search criteria
    E:        check_scans:      (int)                 0      If True, Use the Actual Scan Numbers in the search criteria
    E:       check_source:      (int)                 1      If True, Use the Source Name in the search criteria
    E:       currentImage:      (int)                 0      Current image header index
    E:          dobadchan:      (int)                 1      If True, smooth over defined bad channels
    E:         dobaseline:      (int)                 0      if True, remove computed baseline
    E:        doing_fives:      (int)                 0      It True, analyse 5 point centers like a seq
    E:            dospike:      (int)                 0      If True, Locate and remove and spikes in data: Experimental
    E:              edrop:      (int)                 0      Amount of channels to remove from end of plot
    E:             elgain:      (int)                 0      If True, Compute and use the defined Elevation Gain Terms
    E:               feed:      (int)                 0      Which feed we are processing at and given time
    E:            glength:      (int)                15      The number of data points to include in Gaussian fitting
    E:           gridmode:      (int)                 3      Plot window grid mode: 0 = NONE, 1 = X_ONLY, 2 = Y_ONLY, 3 = FULL
    E:       ignoremapoff:      (int)                 0      If True, Ignore small mapping offsets
    E:          ignorepos:      (int)                 0      If True, ignore RA, Dec & Vel in accum function: Think Planets
    E:             invert:      (int)                 0      If True, invert the phases of continuum data
    E:              issmt:      (int)                 0      If True, data file is from SMT
    E:             usesat:      (int)                 0      Display Strings And Things if True
    E:    last_scan_count:      (int)                74      Number of scans accumulated in last 'accum'
    E:         loopdelay1:      (int)            100000      Delay for any background loops
    E:         loopdelay2:      (int)           2000000      Delay for any foreground loops
    E:           mapangle:      (int)                 0      Preliminary Grid Map plotting angles
    E:       mapbaselines:      (int)                 4      Number of cont samps on sides of map row used for baselines
    E:            markers:      (int)                16      Number of filterbank channels per card: see mshow
    E:              map_w:      (int)                 0      Grid map width in cells
    E:              map_h:      (int)                 0      Grid map height in cells
    E:               mode:      (int)                 2      1 = MODE_CONT, 2 = MODE_SPEC
    E:              mshow:      (int)                 0      If True, draw markers on spectral plot show filter card breaks
    E:               nbox:      (int)                 4      Number of channels to use in the boxcar function
    E:            nbshape:      (int)                41      Number of channels to smooth for bshape command
    E:               nfit:      (int)                 0      Number of parameters for curve fitting 1 - 10
    E:           nignored:      (int)                 0      Number of scans in the ignore-scan array
    E:              nsave:      (int)               323      Current selected nsave value: Used for fetching saved scans
    E:            nspline:      (int)                41      Number of terms to use in bspline function
    E:         numofscans:      (int)               348      Number of scans in currently selected data file
    E:                ons:      (int)                 0      If True, display the 'on' phases in continuum plot
    E:           peakChan:      (int)                40      Channel number with the peak intensity
    E:          plotstyle:      (int)                 0      Plot Style: 0 = HISTOGRAM, 1 = LINES, 2 = POINTS
    E:            plotwin:      (int)                 0      Currently selected Gunplot Window
    E:           procspec:      (int)                 0      If True, Further processing needed: think TP Scans
    E:           read_dir:      (int)                 0      0 = read data files from back to front, 1 = front to back
    E:        rm_fit_data:      (int)                 0      If True, remove the bplot data from yplot: Experimental
    E:        shift_allow:      (int)                 0      If True, allow automatic freq shifting of spectra as encountered
    E:       split_phases:      (int)                 0      If True, do not average ON and OFF five points: Experimental
    E:          stackdone:      (int)                 0      We have reached the end of the stack
    E:          stackindx:      (int)                 0      Current stack pointer
    E:           strictsb:      (int)                 0      If True, Avoid averaging USB and LSB continuum
    E:               used:      (int)                 0      True if this environment is used
    E:             xdelay:      (int)                 0      Amount of time to delay between gnuplot calls uSec
    E:             x1mode:      (int)                 0      Bottom X-Axis of Spectral plot: 0 = FREQ, 1 = VEL, 2 = CHAN
    E:             x2mode:      (int)                 0      Top X-Axis of Spectral plot: 0 = FREQ, 1 = VEL, 2 = CHAN
    E:        yaxis_scale:      (int)                 0      1 = LINEAR_PLOT, 2 = log_PLOT
    E:             yscale:      (int)                 0      0 = Y_AUTO_SCALE, 1 = Y_FIXED_SCALE
    E:              zline:      (int)                 0      If True, Show the zero line in spectral plots
    E:      allow_five_pt:      (int)                 0      Allow five point centers to be accumulated
    E:         bsmoothing:      (int)                 0      Linear vs polynomial intep between baseline regions
    E:         bleadtrail:      (int)                 0      0 = straight, 1 = polynomial fitting of leading and trailing channels
    E:          overwrite:      (int)                 0      If true, then save will overwrite an existing nsave
    E:              nbeff:      (int)                 0      Number of columns to printout during beam eff function
    E:            plottmb:      (int)                 0      If true, plot the expected Tmb too 0 no plot, 1 = LSB, 2 USB
    E:            accumtr:      (double)     0.0000e+00      Running accum Tr
    E:        accumtastar:      (double)     0.0000e+00      Running accum TaStar
    E:      apperatureeff:      (double)     0.0000e+00      Resulting Aperture efficiencies
    E:              avgEl:      (double)        38.1989      Average Elevation of latest accum
    E:           beam_eff:      (double)     0.0000e+00      Computed Beam Eff
    E:              bkres:      (double)     0.0000e+00      backend resolution When searching using BKMATCH_RESOLUTION
    E:             bp_avg:      (double)     1.1963e-07      Average temp of the bandpass (bdrop - edrop)
    E:              bscan:      (double)     0.0000e+00      Beginning scan range during searching
    E:          cal_scale:      (double)         1.0000      Continuum calibration scale when in CALMODE_CALSCALE
    E:               ccur:      (double)      1352.9380      Last mouse click channel
    E:            curScan:      (double)      6941.0300      Last scan loaded
    E:            datamax:      (double)         0.0384      Largest value in h0->data array
    E:            datamin:      (double)        -0.0041      Smallest value in h0->data array
    E:               date:      (double)     0.0000e+00      Date used in searching
    E:              dfreq:      (double)         0.0010      Delta freq tolerance used during searching
    E:              escan:      (double)     50000.0000      Ending scan range during searching
    E:       expectedflux:      (double)     0.0000e+00      User supplied Expected Source Janskys
    E:        expectedtmb:      (double)     0.0000e+00      User supplied Expected Source T-main-beam
    E:               fcur:      (double)      1514.4138      Last mouse click freq
    E:             fft_xb:      (double)     0.0000e+00      FFT X-axis Start
    E:             fft_xe:      (double)     0.0000e+00      FFT X-Axis End
    E:          fittedtau:      (double)         0.3114      Last fitted tau from SPTIP
    E:               freq:      (double)     0.0000e+00      Rest Freq used during Searching
    E:          gaussPeak:      (double)     0.0000e+00      Peak Results of Gaussian Fit
    E:        gaussCenter:      (double)     0.0000e+00      Center Results of Gaussian Fit
    E:            gaussHP:      (double)     0.0000e+00      Width Results of Gaussian Fit
    E:           gaussSum:      (double)     0.0000e+00      Area under the Guassian Results
    E:               hwdc:      (double)         1.0000      Fractional time of backend integration i.e. 0.90 for filters
    E:            if_feed:      (double)     0.0000e+00      [1, 2, 3 or 4]: requested feed: 0.01, 0.02, 0.03, 0.04
    E:          intercept:      (double)     1.7827e-07      Last Intercept from the baseline operation
    E:              jfact:      (double)        24.4152      Currently used Jk/K factor
    E:        jupiter_tmb:      (double)     0.0000e+00      Jupiter Temperature-Main-Beam
    E:          kj_factor:      (double)     0.0000e+00      If Non Zero, use this value for Kelvin to Jansky Conversion
    E:    kp_elgain_term1:      (double)     0.0000e+00      User input elevation 12 Meter gain curve term 1
    E:    kp_elgain_term2:      (double)     0.0000e+00      User input elevation 12 Meter gain curve term 2
    E:    kp_elgain_term3:      (double)     0.0000e+00      User input elevation 12 Meter gain curve term 3
    E:    kp_elgain_term4:      (double)     0.0000e+00      User input elevation 12 Meter gain curve term 4
    E:    kp_elgain_term5:      (double)     0.0000e+00      User input elevation 12 Meter gain curve term 5
    E:            mantau0:      (double)     0.0000e+00      User inputted tau0 value: overrides autotau
    E:           mars_tmb:      (double)     0.0000e+00      Mars Temperature-Main-Beam
    E:        mercury_tmb:      (double)     0.0000e+00      Mercury Temperature-Main-Beam: filled in by 'plan' command
    E:        neptune_tmb:      (double)     0.0000e+00      Neptune Temperature-Main-Beam
    E:             newres:      (double)     0.0000e+00      New resolution to convert data to. Used by chngres
    E:             paperw:      (double)     0.0000e+00      Width of plot window 0 == normal 800 pixels
    E:             paperh:      (double)     0.0000e+00      Height of plot window 0 == normal 600 pixels
    E:              ptime:      (double)     0.0000e+00      Time of day used in the 'planets' program 0.0 - 23.99
    E:                rms:      (double)     9.4228e-06      Last rms value over the baseline region
    E:                rst:      (double)       112.0000      Results of the latest calculation
    E:         saturn_tmb:      (double)     0.0000e+00      Saturn Temperature-Main-Beam
    E:              slope:      (double)    -1.8307e-11      Last slope from the baseline operation
    E:   smt_elgain_term1:      (double)     0.0000e+00      User input elevation SMT gain curve term 1: See elgain
    E:   smt_elgain_term2:      (double)     0.0000e+00      User input elevation SMT gain curve term 2
    E:   smt_elgain_term3:      (double)     0.0000e+00      User input elevation SMT gain curve term 3
    E:   smt_elgain_term4:      (double)     0.0000e+00      User input elevation SMT gain curve term 4
    E:   smt_elgain_term5:      (double)     0.0000e+00      User input elevation SMT gain curve term 5
    E:          stackscan:      (double)     0.0000e+00      Current scan pointed to by stack pointer
    E:           theta_mb:      (double)     0.0000e+00      Manual Theta Main Beam in arcsecs >0.0 overrides computed value
    E:               tcur:      (double)    -7.8744e-05      Last mouse click temperature
    E:        totalweight:      (double)     0.0000e+00      Weighted average of accumulations
    E:               trms:      (double)         0.0013      Theoretical RMS
    E:         uranus_tmb:      (double)     0.0000e+00      Uranus Temperature-Main-Beam
    E:               vcur:      (double)    -11220.9786      Last mouse click velocity
    E:          venus_tmb:      (double)     0.0000e+00      Venus Temperature-Main-Beam
    E:             ylower:      (double)    -1.0000e+09      User set lower y scale for plotting
    E:             yupper:      (double)     1.0000e+09      User set upper y scale for plotting
    E:                p2p:      (double)     1.3326e-05      Computed Peak to Peak
    E:           yplotmin:      (double)        -0.0200      Xgraphics Computed Y-Plot Range Min sent back
    E:           yplotmax:      (double)         0.0400      Xgraphics Computed Y-Plot Range Max
    E:           xplotmin:      (double)      -257.0000      Xgraphics Computed X-Plot Range Min
    E:           xplotmax:      (double)       253.0000      Xgraphics Computed X-Plot Range Max
    E:          tsyslimit:      (double)     10000.0000      Tsys Upper limit for Spectral/Cont accum.
    E:               dvel:      (double)         0.0010      Delta Velocity tolerance
    E:            lowerdb:      (double)     0.0000e+00      Lowest fabs(map_value) allowed when using decibel map plot
    E:             fitmhz:      (double)     0.0000e+00      Width of Spectral Focus/Five-pt fitting (MHz)
    E:          tcallimit:      (double)      2000.0000      Tcal Upper limit for Spectral/Cont accum.


    E: = Environmental Variable
    D: = Statically or Dynamically allocated variable.

NOTE: Normally, these variables are alphabetized, but as new ones are added, spares are removed. These spares, not listed above, maintain the total size of the internal memory and thus don't require rebuilding the user's global memory for each new addition. Major new releases will re-sort these variables.