Particle tracking using IDL -- John C. Crocker and Eric R. Weeks
Home | Download software | Tutorial | Extra software

avgstd.pro

This finds the average, standard deviation, minimum, and maximum, for a given data set (and also prints out the total number of elements).

IDL> avgstd,findgen(100)

   average        stdev         min           max          number
      49.5000      29.0115      0.00000      99.0000         100
IDL> avgstd,pt
   average        stdev         min           max          number
       3198.67      7758.15      0.00000      47771.2      135270


The /loop keyword is useful for 2D data sets:

IDL> avgstd,pt,/loop

   average        stdev         min           max          number
      135.607      67.4389      10.1184      245.031      22545.0
      104.446      60.2748      9.28572      229.554      22545.0
      18154.6      9594.62      3974.51      47771.2      22545.0
      9.56548      1.30753      3.79221      13.9026      22545.0
     0.175380    0.0756743   0.00208088     0.612230      22545.0
      790.476      441.238      0.00000      1499.00      22545.0


Sometimes I want to run this to get results for lots of data. avgstd returns its information in an optional variable:

IDL> avgstd,findgen(100),result

   average        stdev         min           max          number
      49.5000      29.0115      0.00000      99.0000         100
IDL> help,result
RESULT          FLOAT     = Array[5]

If you're doing this sort of thing (running avgstd in batch mode), you can use the /quiet keyword to supress the screen output, and just use the optional variable to grab the results.


This was written by Eric. Revised 8-16-04 to add the /MORE keyword, for extra functionality and also compatibility with avgbin.


Contact us