IMOD(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’… 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 πŸŽ€

  • -a val β€” add val to each value. tiny little boost, she's so generous πŸ’–
  • -s val β€” subtract val from each value. bye bye, numbers ✨
  • -m val β€” multiply each value by val. she's multiplying, she's slaying πŸ”₯
  • -d val β€” 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 🌈
  • -e val β€” raise each value to the power val (exponentiation). glow-up via math ⭐
  • -r val β€” take the val-th root of each value (which is equivalent to raising to the power 1/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 πŸ’œ

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