# Copyright (c) 2002 Peter Guntert. All rights reserved. ## 7MACROS: scale - scale the data to a given maximal magnitude or noise level ## ## Usage: scale max|noise {} ## ## "scale" is a standard macro that scales the data such that the maximal ## absolute value or the noise level get the magnitude . The ## default levels are 500000 for the maximal absolute value and 100 for ## the noise level. ## ## See also: multiply parameter mode level var t if (nparam.lt.1 .or. nparam.gt.2) \ error "*** Error: Illegal number of parameters." mode := '$mode' if (mode.eq.'max') then if (.not.def('level')) level = 500000 t = smax if (t.le.0.0) error "*** Error: Illegal maximal absolute value $t." multiply level/t print " Maximal absolute value scaled from $t to $level." else if (mode.eq.'noise') then if (.not.def('level')) level = 100 t = snoise if (t.le.0.0) error "*** Error: Illegal noise level $t." multiply level/t print " Noise level scaled from $t to $level." else error "*** Error: Illegal scaling mode \"$mode\"." end if