THIN

From ICE Enterprises
Jump to navigation Jump to search

Copy one file to another with optional offset, length, and decimation

<IN>     Input file
<OUT>    Output file
<START>  Starting offset (inclusive)
<END>    Ending offset (exclusive)
<INC>    Increment between input file elements
<FSTART> Frame Starting offset
<FEND>   Frame Ending offset
<FINC>   Frame Increment between input file elements

This primitive performs data thinning on 1D, 2D, or record oriented file
formats. The last 3 arguments apply only to 2D interframe. (The X-Midas
TWODTHIN function). If the increment is negative, this primitive performs the
UPZERO function.

The <START>, <END>, and <INC> arguments are absolute, offset addresses by
default. To use abscissa addressing, precede the argument with a tilde (~). To
use relative addressing, precede the argument with a plus.

The <START> and <END> are ZERO based offsets, so that start=2 end=10 actually
gets the data elements starting and INCLUDING offset=2 up and EXCLUDING
offset=10.  This corresponds to the one-based elements 3 through 10. This is
identical to the way file trimming arguments are used.

Examples:

  1. Copy infile to outfile downsampling by factor of 2 (i.e. 50% reduction)
    nM> thin infile outfile ,, 2
    -or-
    nM> thin infile outfile inc=2

  2. Copy elements 1-3 of infile to outfile.
    nM> thin infile outfile 0 3

  3. Copy all but the last two elements of infile to outfile.
    nM> thin infile outfile 0 -2

  4. Copy every third element from the 2nd element to the end of the file (EOF).
    nM> thin infile outfile 1 -0 3

  5. Copy 20 elements starting at 1 second into the file.
    nM> thin infile outfile ~1 +20

  6. Copy every other element from 1sec to 2sec into the file.
    nM> thin infile outfile ~1 ~2 2

  7. Upsample infile by 8 by inserting 7 zeros between each value.
    nM> thin infile outfile INC=-8
  or
    nM> thin infile outfile INC=.125

  8. Get Y cut of a type 2000 file at index x (without adjustments).
    nM> thin in2000 out2000 fstart=x fend=x+1
    -or- into a type 1000 file with xstart, xdelta, xunits re-adjusted
    nM> thin in2000 out1000{type=1000,xs=inys,xd=inyd,xu=inxu,yu=none} &
             fstart=x fend=x+1

  9. Reset the Frame Start value of a thinned Type 2000 data pipe
     nM> set reg.<id>.fstart <new fstart value>

 10. Reset the frame start, stop and increment of a thinned Type 2000 data pipe
     nM> set reg.<id>.fvals {FSTART=<val>,FEND=<val>,FINC=<val>}

 11. Thin out file forcing abscissa + timecode addressing
     nM> thin infile outfile startTime endTime /addressing=TIMECODE

 12. Thin out file using only abscissa addressing (do not add timecode)
     nM> thin infile outfile startSec endSec /addr=ABSCISSA

Switches:
  /ABSC        Use ABSCISSA_LEGACY addressing for ALL arguments
  /ADDR=       Alias for /ADDRESSING
  /ADDRESSING= Addressing mode. [DEF=INDEX] (Since 2.9.1)
      INDEX           - Absolute indexing.
      ABSCISSA        - Abscissa indexing only (e.g. time or frequency).
      TIMECODE        - Indexing using time: abscissa address +
                        (TimeLine (if exists) or timecode, in that order).
      ABSCISSA_AUTO   - Same as TIMECODE mode when abscissa units is Time,
                        otherwise same a ABSCISSA mode.
      ABSCISSA_LEGACY - Similar to ABSCISSA_AUTO, but ONLY use
                        abscissa + TimeLine/timecode when abscissa units is Time
                        and when return index is greater than 100e6 seconds.
  /RESTART=T|F Enable/disable the output pipe from restarting when certain
               properties (inc, start, end, and fend) are changed. [DEF=TRUE]
  /TL=n        Specify the number of elements to process on each read