From 900d6b7c65aa72bc2b2dba0dfe7fd7cb5e11de1d Mon Sep 17 00:00:00 2001 From: Joris Snellenburg Date: Sat, 28 Feb 2026 19:58:23 +0100 Subject: [PATCH 1/3] Update checkout actions to latest --- .github/workflows/r.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 408f310..756bd49 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -44,7 +44,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 From 6c2b644ad53652a14a23aceb0f5e8d2ef4057721 Mon Sep 17 00:00:00 2001 From: Joris Snellenburg Date: Sun, 1 Mar 2026 17:31:21 +0100 Subject: [PATCH 2/3] Update .github/workflows/r.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/r.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 756bd49..051328f 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -44,6 +44,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: + # This workflow uses actions/checkout@v4; other workflows (e.g. lint) may still use @v3. - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 From 358f595a84f3441c0eb6b727d4a1a0c82f3c6683 Mon Sep 17 00:00:00 2001 From: Joris Snellenburg Date: Sun, 1 Mar 2026 17:42:47 +0100 Subject: [PATCH 3/3] Add pre-commit-config --- .github/workflows/r.yml | 1 - .pre-commit-config.yaml | 20 ++++++ COPYING | 10 +-- NAMESPACE | 4 +- man/amp-class.Rd | 2 +- man/baseIRF.Rd | 1 - man/divergeZimage.Rd | 1 - man/efit2file.Rd | 1 - man/examineFit.Rd | 1 - man/initModel.Rd | 1 - man/readData.Rd | 1 - man/readclp0.Rd | 1 - man/residPart.Rd | 1 - man/writeAverage.Rd | 1 - src/TIMP_init.c | 2 +- src/ntr.c | 1 - tests/cp432704.txt | 2 +- tests/kin_ir_simult_script.RRRR | 120 +++++++++++++++----------------- 18 files changed, 88 insertions(+), 83 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 051328f..756bd49 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -44,7 +44,6 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - # This workflow uses actions/checkout@v4; other workflows (e.g. lint) may still use @v3. - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a1a24f5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: mixed-line-ending + args: [--fix=lf] + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: '\.(Rd|txt)$' + - id: check-merge-conflict + - id: check-yaml + - id: check-case-conflict + - id: check-added-large-files + - id: fix-byte-order-marker + +# Optional R linting (to be enabled some point in the future): +# - repo: https://github.com/lorenzwalthert/precommit +# rev: v0.4.3 +# hooks: +# - id: lintr diff --git a/COPYING b/COPYING index d60c31a..e90dfed 100644 --- a/COPYING +++ b/COPYING @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest diff --git a/NAMESPACE b/NAMESPACE index 896cf12..9324aaa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,7 +13,7 @@ importFrom("stats", "IQR", "approxfun", "coef", "deviance", "dnorm", "numericDeriv", "optim", "predict", "printCoefmat", "pt", "quantile", "rnorm", "symnum") importFrom("utils", "capture.output", "read.table", "tail", - "write.table") + "write.table") importFrom("fields","image.plot","tim.colors","two.colors") importFrom("nnls","nnls","nnnpls") importFrom("deSolve","lsoda") @@ -32,7 +32,7 @@ exportClasses(dat, kin, spec, mass, amp, exportMethods(getClpindepX, residPart, plotter) -export(readData, preProcess, baseIRF, initModel, +export(readData, preProcess, baseIRF, initModel, fitModel, examineFit, sumKinSpecEst) export(dat, kin, spec, mass, amp, theta, multimodel, res, multitheta, diff --git a/man/amp-class.Rd b/man/amp-class.Rd index 1af2e99..36c8f96 100644 --- a/man/amp-class.Rd +++ b/man/amp-class.Rd @@ -97,4 +97,4 @@ Objects can be created by calls of the form \code{new("amp", ...)} or \code{\link{kin-class}}, \code{\link{spec-class}}, \code{\link{opt-class}} } \keyword{classes} - \ No newline at end of file + diff --git a/man/baseIRF.Rd b/man/baseIRF.Rd index ab04979..58c89af 100644 --- a/man/baseIRF.Rd +++ b/man/baseIRF.Rd @@ -27,4 +27,3 @@ lines(irfvec_corrected, col=2) } \keyword{file} - diff --git a/man/divergeZimage.Rd b/man/divergeZimage.Rd index 73daf13..8e01d59 100644 --- a/man/divergeZimage.Rd +++ b/man/divergeZimage.Rd @@ -60,4 +60,3 @@ divergeZimage(exd, lin=10, title="plot linearly to 10") \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \seealso{ \code{\link{dat}} } \keyword{hplot} - diff --git a/man/efit2file.Rd b/man/efit2file.Rd index 0f7aba1..9e25b3a 100644 --- a/man/efit2file.Rd +++ b/man/efit2file.Rd @@ -22,4 +22,3 @@ efit2file(filename, skip = 2, numcol, nrows=vector()) \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \seealso{ \code{\link{readData}} } \keyword{file} - diff --git a/man/examineFit.Rd b/man/examineFit.Rd index bc347cd..527548a 100644 --- a/man/examineFit.Rd +++ b/man/examineFit.Rd @@ -28,4 +28,3 @@ used to examine results. \seealso{ \code{\link{fitModel}}, \code{\link{opt} }} \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \keyword{file } - diff --git a/man/initModel.Rd b/man/initModel.Rd index be81ad9..212c040 100644 --- a/man/initModel.Rd +++ b/man/initModel.Rd @@ -142,4 +142,3 @@ for (f in file_list_cleanup) { \code{\link{fitModel}}} \keyword{file} - diff --git a/man/readData.Rd b/man/readData.Rd index 20dfbda..a2175ea 100644 --- a/man/readData.Rd +++ b/man/readData.Rd @@ -23,4 +23,3 @@ an object of class \code{dat} \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \seealso{ \code{\link{preProcess}} } \keyword{file} - diff --git a/man/readclp0.Rd b/man/readclp0.Rd index c89dea3..a471344 100644 --- a/man/readclp0.Rd +++ b/man/readclp0.Rd @@ -29,4 +29,3 @@ constraint, e.g., \code{1 218.800000000000011 220.099999999999994}. \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \seealso{ \code{\link{initModel}} } \keyword{file} - diff --git a/man/residPart.Rd b/man/residPart.Rd index 9236f6d..79db1b5 100644 --- a/man/residPart.Rd +++ b/man/residPart.Rd @@ -42,4 +42,3 @@ conditionally linear parameters. \keyword{methods} \seealso{ \code{\link{dat-class}}, \code{\link{spec-class}}, \code{\link{kin-class}} } - diff --git a/man/writeAverage.Rd b/man/writeAverage.Rd index a109dd4..9d1a0a4 100644 --- a/man/writeAverage.Rd +++ b/man/writeAverage.Rd @@ -32,4 +32,3 @@ writeAverage(filename, ntimes, nwave, scans, \author{Katharine M. Mullen, Ivo H. M. van Stokkum} \seealso{ \code{\link{readData}} } \keyword{file} - diff --git a/src/TIMP_init.c b/src/TIMP_init.c index 7802ad4..fa19fac 100644 --- a/src/TIMP_init.c +++ b/src/TIMP_init.c @@ -1,7 +1,7 @@ #include // for NULL #include -/* FIXME: +/* FIXME: Check these declarations against the C/Fortran source code. */ diff --git a/src/ntr.c b/src/ntr.c index a167384..5953d68 100644 --- a/src/ntr.c +++ b/src/ntr.c @@ -379,4 +379,3 @@ void r_ShiftCurve (double *source, double *curve, double *shiftparam, } } - diff --git a/tests/cp432704.txt b/tests/cp432704.txt index 31a8a73..e073636 100644 --- a/tests/cp432704.txt +++ b/tests/cp432704.txt @@ -58,4 +58,4 @@ Intervalnr 32 4000.0 -0.126935 -0.130437 -0.051907 -0.049243 -0.025468 0.001448 -0.009269 -0.034469 -0.004993 0.015112 0.004591 -0.000325 -0.022176 -0.060636 -0.020398 -0.061835 -0.068047 -0.088709 -0.084846 -0.052776 -0.073668 -0.042461 -0.067557 -0.093212 -0.046617 -0.058758 -0.09643 -0.200879 -0.288366 -0.413487 -0.446774 -0.665556 4500.0 -0.287226 -0.199561 -0.131996 -0.090379 -0.080615 -0.089427 -0.047825 -0.040071 -0.042969 -0.021777 -0.068934 -0.010184 -0.031449 -0.082132 -0.038011 -0.090518 -0.081269 -0.125011 -0.105967 -0.101456 -0.112074 -0.133302 -0.135132 -0.185979 -0.108661 -0.109846 -0.135039 -0.269572 -0.393002 -0.368709 -0.605479 -0.710526 5000.0 -0.150652 -0.142447 -0.074923 -0.035518 -0.068344 -0.032002 -0.017734 -0.01965 -0.031751 -0.00745 -0.058985 -0.028062 -0.046932 -0.079923 -0.056799 -0.092247 -0.089361 -0.118415 -0.099252 -0.091571 -0.125333 -0.123225 -0.109232 -0.176052 -0.063067 -0.086861 -0.127057 -0.206568 -0.274212 -0.393552 -0.489718 -0.676398 - \ No newline at end of file + diff --git a/tests/kin_ir_simult_script.RRRR b/tests/kin_ir_simult_script.RRRR index 067308b..1755d6b 100644 --- a/tests/kin_ir_simult_script.RRRR +++ b/tests/kin_ir_simult_script.RRRR @@ -10,8 +10,8 @@ require(TIMP) ############################## -## Read in and preprocess (by baseline correction) -## 4 datasets +## Read in and preprocess (by baseline correction) +## 4 datasets ############################## did1<-readData("0902.txt") @@ -27,30 +27,30 @@ did4<-readData("1402.txt") did4<-preProcess(data = did4, baselinelambda = c(3, 7, 1, 32)) ############################## -## Make a list of the 4 datasets, to be -## used for simulteneous analysis +## Make a list of the 4 datasets, to be +## used for simulteneous analysis ############################## -data <- list(did1, did2, did3, did4) +data <- list(did1, did2, did3, did4) ############################## -## Initial model. +## Initial model. ############################## -model_allfree <- initModel(mod_type = "kin", -kinpar=c(1.1, 0.05, 0.001), -irfpar=c(.05, 0.495912E-01), +model_allfree <- initModel(mod_type = "kin", +kinpar=c(1.1, 0.05, 0.001), +irfpar=c(.05, 0.495912E-01), lambdac = 1670, -parmu = list(-.0158119812957), -seqmod=TRUE, positivepar=c("kinpar"), -weightpar=list( c(-16,.3,1,2000,.1), c(NA,NA,1590,1612,.1)), +parmu = list(-.0158119812957), +seqmod=TRUE, positivepar=c("kinpar"), +weightpar=list( c(-16,.3,1,2000,.1), c(NA,NA,1590,1612,.1)), cohspec = list( type = "irf")) ############################## -## First apply the initial model to each dataset separately. +## First apply the initial model to each dataset separately. ############################## -didRes1<-fitModel(list(did1), list(model_allfree), opt=kinopt(iter=2, +didRes1<-fitModel(list(did1), list(model_allfree), opt=kinopt(iter=2, makeps="d1", title = "Dataset 1, single analysis")) didRes2<-fitModel(list(did2), list(model_allfree), opt=kinopt(iter=2, @@ -63,56 +63,56 @@ didRes4<-fitModel(list(did4), list(model_allfree), opt=kinopt(iter=2, makeps="d4", title = "Dataset 4, single analysis")) ############################## -## Apply the initial model to datasets 1 and 2 together. -## Make the kinetic and irf parameters free to vary between -## datasets, and add a spectral equality constraint between -## datasets. Also add a dataset scaling parameter. +## Apply the initial model to datasets 1 and 2 together. +## Make the kinetic and irf parameters free to vary between +## datasets, and add a spectral equality constraint between +## datasets. Also add a dataset scaling parameter. ############################## -didRes<-fitModel(list(did1,did2), modspec = list(model_allfree), +didRes<-fitModel(list(did1,did2), modspec = list(model_allfree), modeldiffs = list( dscal = list(list(to=1,from=2,value=1)), change = list( list(what="kinpar", spec= c(1.011, 0.05, 0.005), dataset=2), list(what="irfpar", spec= c(.051, 0.496912E-01), dataset=2), -list(what="clpequspec", spec=list(list(to=3, from=3, low=100, high=1810, -dataset=2)), dataset=1), +list(what="clpequspec", spec=list(list(to=3, from=3, low=100, high=1810, +dataset=2)), dataset=1), list(what="clpequ", spec=c(1), dataset=1))), opt=kinopt(iter=5)) ############################## -## Apply the initial model to datasets 3 and 4 together. -## Make the kinetic and irf parameters free to vary between -## datasets, and add a spectral equality constraint between -## datasets. Also add a dataset scaling parameter -- but this -## time also add a higher order polynomial for dispersion to the +## Apply the initial model to datasets 3 and 4 together. +## Make the kinetic and irf parameters free to vary between +## datasets, and add a spectral equality constraint between +## datasets. Also add a dataset scaling parameter -- but this +## time also add a higher order polynomial for dispersion to the ## 2nd dataset (dataset 4) via the parmu parameterization. ############################## -didRes<-fitModel(list(did3,did4), list(model_allfree), +didRes<-fitModel(list(did3,did4), list(model_allfree), modeldiffs = list( dscal = list(list(to=1,from=2,value=1)), change = list( list(what="kinpar", spec= c(1.0, 0.05, 0.005), dataset=2), list(what="irfpar", spec= c(.05, 0.496912E-01), dataset=2), -list(what="clpequspec", spec=list(list(to=3, from=3, low=100, -high=1810, dataset=1)), dataset=2), -list(what="clpequ", spec=c(1), dataset=2), -list(what = "parmu", spec=list(c(-.0158119812957)), dataset=2))), +list(what="clpequspec", spec=list(list(to=3, from=3, low=100, +high=1810, dataset=1)), dataset=2), +list(what="clpequ", spec=c(1), dataset=2), +list(what = "parmu", spec=list(c(-.0158119812957)), dataset=2))), opt=kinopt(iter=1)) ############################## ## Analyze all 4 datasets (previously put into the list "data") together. ## Make all the kinetic and IRF parameters free between datasets, and give -## the IRF model different starting values for each dataset. Also add some +## the IRF model different starting values for each dataset. Also add some ## spectral relations between dataset (that are actually equalities, since the ## linear relations are fixed to 1. The datasets are related as a whole via ## scaling parameters dscal. For the 3rd dataset dscal is estimated at ## at each wavelength (per-clp). ############################## -didRes<-fitModel(data, list(model_allfree), -modeldiffs = list(dscal = +didRes<-fitModel(data, list(model_allfree), +modeldiffs = list(dscal = list( -list(to=4,from=1,value=1), -list(to=2,from=1,value=1), +list(to=4,from=1,value=1), +list(to=2,from=1,value=1), list(to=3,from=1,value=rep(1,32), perclp=TRUE)), change = list( list(what="kinpar", spec= c(1.01, 0.05, 0.005), dataset=2:4, @@ -120,45 +120,45 @@ type="multifree"), list(what="irfpar", spec= c(.067, 0.18), dataset=2:4, type="multifree"), list(what="clpequspec", spec=list( -list(to=3, from=3, low=100, high=1810, startrelpar=1, dataset=3), -list(to=1, from=1, low=100, high=1810, startrelpar=1, dataset=2)), +list(to=3, from=3, low=100, high=1810, startrelpar=1, dataset=3), +list(to=1, from=1, low=100, high=1810, startrelpar=1, dataset=2)), dataset=c(1,4), type="multifree"), -list(what="clpequ", spec=c(1,1), dataset=c(1,4), type="multifree"), +list(what="clpequ", spec=c(1,1), dataset=c(1,4), type="multifree"), list(what = "fixed", spec = list(clpequ=c(1,2)), dataset=c(1,4)))), -opt=kinopt(iter=3, linrange=3, superimpose=1:4, +opt=kinopt(iter=3, linrange=3, superimpose=1:4, selectedtraces=seq(1,data[[1]]@nl, by=3))) ############################## ## Add a more sophisticated model for the coherent artifact, -## via the $type = "irfmulti" argument. The +## via the $type = "irfmulti" argument. The ## time profile of the IRF is used for the coherent ## artifact/scatter model, but the IRF parameters are taken per ## dataset. ############################## -model_irfcoh <- initModel(mod_type = "kin", -kinpar=c(1.0, 0.05, 0.005), -irfpar=c(.05, 0.495912E-01), +model_irfcoh <- initModel(mod_type = "kin", +kinpar=c(1.0, 0.05, 0.005), +irfpar=c(.05, 0.495912E-01), lambdac = 1670, fixed = list(irfpar=2), -parmu = list(c(-.0158119812957)), -seqmod=TRUE,iter=2, positivepar=c("kinpar", "coh"), -weightpar=list( c(-16,.3,1,2000,.1), c(NA,NA,1590,1612,.1)), +parmu = list(c(-.0158119812957)), +seqmod=TRUE,iter=2, positivepar=c("kinpar", "coh"), +weightpar=list( c(-16,.3,1,2000,.1), c(NA,NA,1590,1612,.1)), cohspec = list( type = "irfmulti", numdatasets = 4)) ############################## -## Fit with this more sophisticated coherent artifact model, -## and fixing the width of the IRF. +## Fit with this more sophisticated coherent artifact model, +## and fixing the width of the IRF. ############################## -didRes<-fitModel(data, list(model_irfcoh), -modeldiffs = list(dscal = +didRes<-fitModel(data, list(model_irfcoh), +modeldiffs = list(dscal = list( -list(to=4,from=1,value=1), -list(to=2,from=1,value=1), +list(to=4,from=1,value=1), +list(to=2,from=1,value=1), list(to=3,from=1,value=rep(1,32), perclp=TRUE)), change = list( list(what="kinpar", spec= c(1.01, 0.05, 0.005), dataset=2:4, @@ -166,18 +166,14 @@ type="multifree"), list(what="irfpar", spec= c(.067, 0.18), dataset=2:4, type="multifree"), list(what="clpequspec", spec=list( -list(to=3, from=3, low=100, high=1810, startrelpar=1, dataset=3), -list(to=1, from=1, low=100, high=1810, startrelpar=1, dataset=2)), +list(to=3, from=3, low=100, high=1810, startrelpar=1, dataset=3), +list(to=1, from=1, low=100, high=1810, startrelpar=1, dataset=2)), dataset=c(1,4), type="multifree"), -list(what="clpequ", spec=c(1,1), dataset=c(1,4), type="multifree"), +list(what="clpequ", spec=c(1,1), dataset=c(1,4), type="multifree"), list(what = "fixed", spec = list(clpequ=c(1,2)), dataset=c(1,4)))), -list(what = "fixed", spec = list(clpequ=c(1), irfpar=2), dataset=2:3), +list(what = "fixed", spec = list(clpequ=c(1), irfpar=2), dataset=2:3), -opt=kinopt(iter=3, linrange=3, superimpose=1:4, +opt=kinopt(iter=3, linrange=3, superimpose=1:4, selectedtraces=seq(1,data[[1]]@nl, by=3))) - - - -