EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: The select record MEDIAN calculation
From: Dennis Armstrong <[email protected]>
To: EPICS Tech-Talk <[email protected]>
Date: Tue, 08 Apr 2008 16:55:28 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi all

I have a question regarding the calculation of the MEDIAN value in the
select record.

I have done some tests on the select record with the SELM field set to
"Median Signal" and the results I have achieved seems to be at odds with
the definition of the median value as defined. For example the wikipedia
site http://en.wikipedia.org/wiki/Median defines it as:-

Quote "In probability theory and statistics, a median is described as
the number separating the higher half of a sample, a population, or a
probability distribution, from the lower half. The median of a finite
list of numbers can be found by arranging all the observations from
lowest value to highest value and picking the middle one. If there is an
even number of observations, the median is not unique, so one often
takes the mean of the two middle values." unquote

When I use an even number of input values the output is wrong as it
fails to produce the average value of the two middle input values.

When I use an odd number of input values this is sometimes wrong as it
fails to sometimes select the middle input values.

examples of this follow:-

Using all 12 inputs on the SELECT record
INPUT values
   INPA 0.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00
   INPB 0.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00
   INPC 0.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00
   INPD 0.00  0.00 15.00 15.00 15.00 15.00 15.00 15.00 15.00 15.00 15.00
   INPE 0.00  0.00  0.00 16.00 16.00 16.00 16.00 16.00 16.00 16.00 16.00
   INPF 0.00  0.00  0.00  0.00 17.00 17.00 17.00 17.00 17.00 17.00 17.00
   INPG 0.00  0.00  0.00  0.00  0.00 18.00 18.00 18.00 18.00 18.00 18.00
   INPH 0.00  0.00  0.00  0.00  0.00  0.00 19.00 19.00 19.00 19.00 19.00
   INPI 0.00  0.00  0.00  0.00  0.00  0.00  0.00 20.00 20.00 20.00 20.00
   INPJ 0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 21.00 21.00 21.00
   INPK 0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 22.00 22.00
   INPL 0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 23.00

OUTPUT values
EPICS
Median  0.00  0.00 12.00 13.00 13.00 13.00 14.00 15.00 16.00 17.00 18.00

calculated
Maths
Median  0.00  0.00  0.00  0.00  6.00 12.50 13.50 14.50 15.50 16.50 17.50


Now if I use only 11 inputs on the SELECT record
INPUT
   INPA   0.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00 12.00
   INPB   0.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00 13.00
   INPC   0.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00 14.00
   INPD   0.00  0.00 15.00 15.00 15.00 15.00 15.00 15.00 15.00 15.00
   INPE   0.00  0.00  0.00 16.00 16.00 16.00 16.00 16.00 16.00 16.00
   INPF   0.00  0.00  0.00  0.00 17.00 17.00 17.00 17.00 17.00 17.00
   INPG   0.00  0.00  0.00  0.00  0.00 18.00 18.00 18.00 18.00 18.00
   INPH   0.00  0.00  0.00  0.00  0.00  0.00 19.00 19.00 19.00 19.00
   INPI   0.00  0.00  0.00  0.00  0.00  0.00  0.00 20.00 20.00 20.00
   INPJ   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 21.00 21.00
   INPK   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00 22.00

OUTPUT
EPICS
Median    0.00  0.00  0.00  0.00  0.00 12.00 13.00 14.00 15.00 17.00

calculated
Maths
Median    0.00  0.00  0.00  0.00 12.00 13.00 14.00 15.00 16.00 17.00

So is anybody using the select record in this mode? and what results do
you get?


regards
- --
Dennis Armstrong
Swiss Light Source WBGB/003         Tel.: (+41)-(0)56-310-5109
5232 Villigen, PSI                  Fax.: (+41)-(0)56-310-4413
Switzerland
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH+4dgj5Sc5kP8ZAYRAlt7AJ9hn4hxZ1QthpAAkr+h7eEgeQPk9QCggcTK
MdQ3VCBWTRiBHHwi9Jxv0hk=
=cML4
-----END PGP SIGNATURE-----

Replies:
Re: The select record MEDIAN calculation Andrew Johnson

Navigate by Date:
Prev: RE: Example for VME reg-based port driver for asyn on Linux? Mark Rivers
Next: [EDM] init color failed (cannot find EdmPvObject) Touchard Dominique
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Example for VME reg-based port driver for asyn on Linux? Mark Rivers
Next: Re: The select record MEDIAN calculation Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·