moment functions with dimen keyword [message #63797] |
Wed, 19 November 2008 16:08  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
Someone mentioned the desirability of having the mean, etc. functions
take a dimension keyword. It struck me as such a good idea that I
spent this afternoon making versions of the built-in MOMENT, MEAN,
VARIANCE, STDDEV, SKEWNESS and KURTOSIS functions so that they accept
a DIMEN= keyword that works as you'd expect.
However, given that the majority of the code and documentation is from
the original files[*], and is therefore copyright ITT, it's clearly
not kosher for me to distribute them. Would people be interested in a
"diff" that could be used to patch the built-in functions to generate
the new ones (which I assume would be okay)? Or can anyone think of
another solution? Or is this something that no one really needs
anyway? :-)=
-Jeremy.
[*] Actually, while the code in MOMENT remains largely the same, the
code for the other functions is entirely re-written, it's just that
the documentation is essentially identical. So I could in principle re-
write the documentation for those and distribute them legitimately...
but that won't work for MOMENT_D.
|
|
|
|
|
Re: moment functions with dimen keyword [message #63852 is a reply to message #63797] |
Thu, 20 November 2008 08:32   |
Spon
Messages: 178 Registered: September 2007
|
Senior Member |
|
|
On Nov 20, 2:40 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Nov 20, 4:28 am, Spon <christoph.b...@gmail.com> wrote:
>
>
>
>> On Nov 20, 12:08 am, Jeremy Bailin <astroco...@gmail.com> wrote about:
>
>>> [...] making versions of the built-in MOMENT, MEAN,
>>> VARIANCE, STDDEV, SKEWNESS and KURTOSIS functions so that they accept
>>> a DIMEN= keyword that works as you'd expect.
>
>>> Or is this something that no one really needs
>>> anyway? :-)=
>
>>> -Jeremy.
>
>> Hi Jeremy,
>
>> this addition would definitely be much appreciated :-)
>
>> I think I would personally opt for giving the new functions different
>> names, just to prevent any back-compatability issues (deep nested mean
>> () calls in procedures that have _extra keywords set and suddenly
>> don't do what you're expecting, for example.)
>
>> Looking forward to this, it would simplify things greatly for me!
>
>> Thanks,
>> Chris
>
> Chris,
>
> Actually, they are all renamed to MOMENT_D, MEAN_D, etc. Perhaps I
> might distribute a shell script that you can run somewhere in your
> path that goes and finds the built-in moment etc. functions, copies
> them over, renames them to the _D versions, and then applies my
> patches. That way I don't distribute any ITT code, but it's simple to
> distribute my functions. At least, I could do that for Unix/Mac...
> does Windows have the Bourne shell? (or patch, for that matter?) :-)=
>
> -Jeremy.
>
> -Jeremy.
Jeremy,
I use Cygwin for this sort of stuff. It does a pretty good impression
of BASH, even if it is a bit of a monster in terms of size (it also
supports X11 which is where, I suspect, the extra weight comes from).
I've never tried to run IDL through it, though, I suspect there's a
lot of headaches down that path!
It'd be fine for running a script through, although possibly trying to
get it to mount all the windows directories stored in IDL's !path
would be fun! :-)
Regards,
Chris
|
|
|
Re: moment functions with dimen keyword [message #63854 is a reply to message #63797] |
Thu, 20 November 2008 07:35   |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Thu, 20 Nov 2008, Paolo wrote:
> FÖLDY Lajos wrote:
>> On Thu, 20 Nov 2008, Paolo wrote:
>>
>>> I have done the same last year with moment....
>>> and I am sure many others did! (to save execution
>>> time, I added a keyword maxmoment, such that it
>>> does not compute the kurtosis if I only need the average).
>>
>> IDL 6.4's MOMENT has a MAXMOMENT keyword. Use the source, Luke!
>
> Correct my statement "I added" to "RSI added"
> (it's hard to remember what I did last week,
> not to mention one year ago...)
> Yes, I shamelessy modified the source code.
> But I am not distributing it, so I don't think
> I am in violation of copyright.
>
I think you have misunderstood me. I did not want to blame you with
copyright violation. With "Use the source, Luke!" I just tried to hint
that the MAXMOMENT keyword can be seen in the source, but not in the
documentation :-)
regards,
lajos
|
|
|
Re: moment functions with dimen keyword [message #63856 is a reply to message #63797] |
Thu, 20 November 2008 07:22   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
FÖLDY Lajos wrote:
> On Thu, 20 Nov 2008, Paolo wrote:
>
>> I have done the same last year with moment....
>> and I am sure many others did! (to save execution
>> time, I added a keyword maxmoment, such that it
>> does not compute the kurtosis if I only need the average).
>
> IDL 6.4's MOMENT has a MAXMOMENT keyword. Use the source, Luke!
Correct my statement "I added" to "RSI added"
(it's hard to remember what I did last week,
not to mention one year ago...)
Yes, I shamelessy modified the source code.
But I am not distributing it, so I don't think
I am in violation of copyright.
Ciao,
Paolo
> (not the documentation :-)
>
> regards,
> lajos
>
> ; CALLING SEQUENCE:
> ; Result = Moment(X)
> ;
> ; INPUTS:
> ; X: An N-element vector of type integer, float or double.
> ;
> ; KEYWORD PARAMETERS:
> ; DOUBLE: IF set to a non-zero value, computations are done in
> ; double precision arithmetic.
> ;
> ; MDEV: Use this keyword to specify a named variable which returns
> ; the mean absolute deviation of X.
> ;
> ; SDEV: Use this keyword to specify a named variable which returns
> ; the standard deviation of X.
> ;
> ; MAXMOMENT:
> ; Use this keyword to limit the number of moments:
> ; Maxmoment = 1 Calculate only the mean.
> ; Maxmoment = 2 Calculate the mean and variance.
> ; Maxmoment = 3 Calculate the mean, variance, and skewness.
> ; Maxmoment = 4 Calculate the mean, variance, skewness,
> ; and kurtosis (the default).
> ;
> ; NAN: Treat NaN elements as missing data.
> ; (Due to problems with IEEE support on some platforms,
> ; infinite data will be treated as missing as well. )
|
|
|
Re: moment functions with dimen keyword [message #63862 is a reply to message #63797] |
Thu, 20 November 2008 06:45   |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Thu, 20 Nov 2008, Paolo wrote:
> I have done the same last year with moment....
> and I am sure many others did! (to save execution
> time, I added a keyword maxmoment, such that it
> does not compute the kurtosis if I only need the average).
IDL 6.4's MOMENT has a MAXMOMENT keyword. Use the source, Luke!
(not the documentation :-)
regards,
lajos
; CALLING SEQUENCE:
; Result = Moment(X)
;
; INPUTS:
; X: An N-element vector of type integer, float or double.
;
; KEYWORD PARAMETERS:
; DOUBLE: IF set to a non-zero value, computations are done in
; double precision arithmetic.
;
; MDEV: Use this keyword to specify a named variable which returns
; the mean absolute deviation of X.
;
; SDEV: Use this keyword to specify a named variable which returns
; the standard deviation of X.
;
; MAXMOMENT:
; Use this keyword to limit the number of moments:
; Maxmoment = 1 Calculate only the mean.
; Maxmoment = 2 Calculate the mean and variance.
; Maxmoment = 3 Calculate the mean, variance, and skewness.
; Maxmoment = 4 Calculate the mean, variance, skewness,
; and kurtosis (the default).
;
; NAN: Treat NaN elements as missing data.
; (Due to problems with IEEE support on some platforms,
; infinite data will be treated as missing as well. )
|
|
|
|