Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
Comment thread
jsnel marked this conversation as resolved.
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion man/amp-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}


1 change: 0 additions & 1 deletion man/baseIRF.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ lines(irfvec_corrected, col=2)
}

\keyword{file}

1 change: 0 additions & 1 deletion man/divergeZimage.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}

1 change: 0 additions & 1 deletion man/efit2file.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}

1 change: 0 additions & 1 deletion man/examineFit.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

1 change: 0 additions & 1 deletion man/initModel.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,3 @@ for (f in file_list_cleanup) {
\code{\link{fitModel}}}

\keyword{file}

1 change: 0 additions & 1 deletion man/readData.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}

1 change: 0 additions & 1 deletion man/readclp0.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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}

1 change: 0 additions & 1 deletion man/residPart.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ conditionally linear parameters.
\keyword{methods}
\seealso{ \code{\link{dat-class}}, \code{\link{spec-class}},
\code{\link{kin-class}} }

1 change: 0 additions & 1 deletion man/writeAverage.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ writeAverage(filename, ntimes, nwave, scans,
\author{Katharine M. Mullen, Ivo H. M. van Stokkum}
\seealso{ \code{\link{readData}} }
\keyword{file}

2 changes: 1 addition & 1 deletion src/TIMP_init.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>

/* FIXME:
/* FIXME:
Check these declarations against the C/Fortran source code.
*/

Expand Down
1 change: 0 additions & 1 deletion src/ntr.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,3 @@ void r_ShiftCurve (double *source, double *curve, double *shiftparam,
}

}

2 changes: 1 addition & 1 deletion tests/cp432704.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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


120 changes: 58 additions & 62 deletions tests/kin_ir_simult_script.RRRR
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand All @@ -63,121 +63,117 @@ 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,
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,
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)))




Loading