The current cdsutils installation (r361) has a new and improved NDS avg() function. The previous version was buggy, was calculating the standard deviation incorrectly, and had a clunky interface. This new version fixes those issues:
The standard deviation was previously being calculated incorrectly and the returned values were wrong (off by some unknown but kind of large factor). The new version uses the python numpy.var() function to calculate the variance, from which the standard deviation is calculated. It has been verified to be correct.
Previously, the avg() function required full channel names, with IFO prefixes. This new version works like the ezca interface whereby the IFO prefix can be left off of the channel name. This makes things much cleaner, and allows scripts to be portable. E.g., instead of:
cdsutils.avg(2, IFO+':LSC-DARM_OUT')
just do:
cdsutils.avg(2, 'LSC-DARM_OUT')
Probably the thing that's going to cause the most trouble is that the interface to the function has been fixed up. Previously, the function was returning a dictionary of channel:avg key pairs. This was very clunky to use.
The return value of the function now mirrors the input argument. So for instance, if a single channel is requested, a single avg value is returned. If a list of channels is requested, a list of average values is returned, in the same order as the input channel list. So calls like:
avg = cdsutils.avg(2, 'LSC-DARM_OUT').values()[0]
can now just be:
avg = cdsutils.avg(2, 'LSC-DARM_OUT')
If the stddev option is provided, the output will be an (avg, stddev) tuple, or if multiple channels is requested, a list of such tuples, e.g.:
avg, stddev = cdsutils.avg(2, 'LSC-DARM_OUT', True)
I have fixed all calls to cdsutil.avg() that I could find in the USERAPPS/release. I likely didn't catch everything, though, so be aware of the new interface and update your code appropriately.
controls@opsws5:sbin 0$ cdsutils -h
rana.adhikari@opsws5|~> cdsutils avg -n 2 H1:LSC-MICH_IN1
I pushed a new version of cdsutils (r366) that fixes the issue with the help. Commands were being intercepted by one of the gstreamer libraries:
The "junk" messages, as you refer to them, in the avg output are actually just logging that are going to stderr, and therefore do not affect the stdout output: