iraf-v216 · Code · Issues (50) · Pull requests (81)
iraf.net Issue #21
Clarify status of the code taken from Numerical Recipes
closed olebole opened this issue on 2017-05-01 · 2 comments
olebole commented on 2017-05-01
IRAF contains a number of files that contain code from the book “Numerical Recipes” (NR). It seems that IRAF is allowed to “use” this code as long as the following lines are included:
# Based on Numerical Recipes by Press, Flannery, Teukolsky, and Vetterling.
# Used by permission of the authors.
# Copyright(c) 1986 Numerical Recipes Software.
This looks however questionable here: First it says “use” and not “distribute” or “modify”, which makes these files unsuitable for an Open Source project. The FAQ of the NR book about licensing says:
- […] Can you include Numerical Recipes routines as part of that source code, including a notice that they are only allowed to be used with your application?
- Sorry, no. We never give permission for Numerical Recipes source code to be posted on any public server, or distributed with any freeware or shareware package […]
- You want to translate some (or all) the Numerical Recipes routines to a different computer language, and then redistribute the resulting translations.
- […] However, you can’t redistribute the translations in any manner, since they are “derivative works” and still subject to our copyright.
There are the following files that contain a copyright statement from Numerical Recipes:
pkg/xtools/numrecipes.x
noao/onedspec/splot/spdeblend.x
noao/rv/numrep.x
noao/artdata/numrecipes.x
The following common procedures from NR are used here, that can probably easily replaced from other sources:
gammln(xx)
: natural log of gamma function.gasdev(seed)
: normally distributed deviate of zero mean and unit varpoidev(xm, seed)
: Poisson deviates for a given mean.
The following routines are used only in the noao/rv
package.
four1(data, nn, isign)
: Replaces DATA by it’s discrete transformrealft(data, N, isign)
: Fourier Transform of a set of 2N data points.twofft(data1, data2, fft1, fft2, N)
: calls four1()
The only non-trivial one here is four1()
; the two others just call four1()
.
Then we have LU decomposition functions, used in pkg/utilities/stxtools/xtwcs.x
:
ludcmp(a, n, np, indx, d)
lubksb(a, n, np, indx, b)
luminv(a, n, np)
And Levenberg-Marquardt nonlinear chi square minimization, used quite commonly
mr_eval(x, y, npts, params, flags, np, a, delta, nfit, chisq)
mr_invert(a, b, n)
mr_solve(x, y, npts, params, flags, np, nfit, mr, chisq)
Maybe this could be replaced by cminpack?
Funnily, several of these functions are defined several times over the code… However it seems that much NR code could be replaced by free code without too much effort, or removed without losing too much functionality.
There are also a number of files which dont have the required copyright statement:
sys/mwcs/mwlu.x
noao/astutil/asttools/asttimes.x
noao/digiphot/daophot/daolib/daoran.x
noao/digiphot/daophot/daolib/ran3.x
noao/onedspec/splot/deblend.x
noao/rv/deblend.x
noao/rv/rvidlines/iddeblend.x
noao/imred/vtel/mrqmin.x
pkg/utilities/nttools/trebin/tucspl.f
pkg/utilities/nttools/trebin/tuhunt.f
pkg/utilities/nttools/trebin/tuispl.f
pkg/utilities/nttools/trebin/tuiep3.f
pkg/utilities/nttools/stxtools/ludcmd.x
pkg/utilities/nttools/stxtools/lubksd.f
pkg/utilities/nttools/stxtools/ludcmp.x
pkg/utilities/nttools/stxtools/lubksb.f
pkg/images/tv/imexamine/iejimexam.x
Interestingly, many of them use copies of the same functions (mr_fit
and such) as above, so by solving the problems above many of these files can be legalized as well. Until then, they should at least get the required copyright (was aleardy promised three years ago, but then forgotten).
The cfitsio versions included in IRAF also have copies from NR code; namely the files
vendor/cfitsio/eval.y
vendor/cfitsio/eval_y.c
vendor/cfitsio/quantize.c
pkg/tbtables/cfitsio/eval.y
pkg/tbtables/cfitsio/eval_y.c
Again, the required copyright statement is not there. This can however be solved by updating cfitsio – their authors were very cooperative here when they were asked to remove NR code.
olebole commented on 2017-05-02
I’t want to point out another aspect here: the NR License allows redistribution only for non-wrapping code (important phrase emphasized by me):
You want to distribute an executable (.exe) file that has some Numerical Recipes routines bound inside. The NR routines are not separable from the executable file, and they are not visible to the user of the executable as separately invokable entities. (In particular, your executable is not a wrapper for the NR routines to be used in a workbench or mix-and-match environment.)
- For noncommercial use, we grant automatic permission for this kind of redistribution.
- For commercial use, you must have an institutional subscription (see here) and are subject to its applicable terms. There is generally no additional fee associated with redistribution.
IRAF is, however, exactly that: a wrapper (also) for the NR routines to be used in a workbench, and they are visible to the user. So, at least this license does not apply here. It should be clarified what other license exactly is meant here.
olebole commented on 2017-11-01
For MR_SOLVE
, see this comment.
There is also some other code that is copied from text books:
math$bevington
- Bevington, Robinson: Data Reduction and Error Analysis for the Physical Sciences. 1st ed. from 1969. This code is from from before 1976 and does not contain a copyright statement, so according to the Copyright Act of 1976 it is public domainmath$deboor
- Carl DeBoor: A Practical Guide to Splines, 1978. This code also appears in netlib, and DeBoor wrote it as an US government employee, which makes this code public domain.math$llsq
- Charles L. Lawson and Richard J. Hanso:Solving Least Squares Problems”, 1974. Investigations of the scipy people show that this is now licensed under BSD.math$ieee
- “Programs for Digital Signal Processing” by the IEEE Press. This code is unused however and can just be removed.
Fixed in #37
Last updated on 2017-11-01