IMOD(1)
π IMOD(1) β the BRL-CAD glow-up page β¨
okay so bestie, welcome to imod β she's a BRL-CAD girlie and she lives in your terminal. this is the IMOD(1) page, and honestly? she ate. let's get into it π
πΈ NAME πΈ
imod β modify a stream of short integers with arithmetic operations. yes, that's her whole job and she's iconic for it π
β¨ SYNOPSIS β¨
imod [-a add] [-s sub] [-m mult] [-d div] [-A] [-e exp] [-r root] [file.s] > output.s
like, that's the whole vibe right there. stack the flags, feed her data, catch the output π«Ά
π DESCRIPTION π
okay so here's the tea, bestie: imod reads a stream of 16-bit signed short integers and applies a whole sequence of arithmetic operations to each value, then writes the modified short integers to standard output. literally that simple, and she does it flawlessly. if you hand her the optional file.s argument, she reads from that file. if you don't? she reads from standard input. no cap π§
and here's the fun part: you can give her any number of operations on the command line, and they get applied to each value in the order they appear. order matters, bestie, don't forget it π
for efficiency (she's smart like that), the operations are precomputed once into a 65536-entry lookup table that maps every possible input short to its result. one table, all the math, no re-computing per value. main character energy honestly π
but okay, the output is constrained to the signed 16-bit range (-32768 to 32767), so anything that lands outside gets clipped to the nearest limit β and when the program finishes, she prints a count of the high and low clipping events to standard error. so if you're like "where did my data go π" β check stderr, she told you.
π© also, important: imod refuses to run if either standard input or standard output is a terminal. she's not about that interactive life, periodt.
she's the short-integer counterpart of bwmod(1) and dmod(1), operating on the same kind of data used by tools such as dsp(5). family reunion π«Ά
π OPTIONS π
-aval β add val to each value. tiny little boost, she's so generous π-sval β subtract val from each value. bye bye, numbers β¨-mval β multiply each value by val. she's multiplying, she's slaying π₯-dval β divide each value by val. but bestie, listen: a val of zero aborts the program. do not test her, she will not do it π-Aβ replace each value with its absolute value. all positive vibes only π-eval β raise each value to the power val (exponentiation). glow-up via math β-rval β take the val-th root of each value (which is equivalent to raising to the power1/val). and yeah, same warning as-d: a val of zero aborts the program. zero is not invited to this party π-h,-?β print a usage message and exit. the "help me bestie" flags π«Ά
π¦ EXAMPLES π¦
Example 1. Scale and offset a short-integer data stream
imod -m 2.0 -a 100 < terrain.s > brighter.s
reads short integers from terrain.s, multiplies each by 2.0 and then adds 100, writing the result to brighter.s. and because the operations are applied in command-line order, each value becomes 2*value + 100. any results that exceed the 16-bit range are clipped β and reported on standard error, remember? she's always keeping receipts on stderr π
Example 2. Rectify and attenuate a signal before further processing
imod -A -d 4 < signal.s | dpeak > peaks.s
takes the absolute value of every sample in signal.s, divides each by 4 to bring the magnitudes down, and pipes the rectified stream directly into dpeak(1) for peak detection. pipeline girlies stay winning π
β¨
π SEE ALSO π
brlcad(1), bwmod(1), dmod(1), smod(1), umod(1), istats(1), dsp(5)
the whole friend group fr fr π«Ά
π AUTHOR π
BRL-CAD Team β she didn't come alone, bestie π
π COPYRIGHT π
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. if something's acting up, tell them, not me ππ
and that's the page, bestie! π this was the IMOD(1) page from the BRL-CAD manual, and the footer energy lives here now: BRL-CAD, IMOD(1). go clip some shorts π
πβ¨
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms