mnirs 0.8.0

The initial release of analyse_kinetics() and family of kinetics modelling functions!

analyse_kinetics()

analyse_kinetics(
    data,
    nirs_channels = c(smo2_left, smo2_right),
    method = "monoexponential",
    use_TD = TRUE,      ## use time delay parameter
    direction = "auto"  ## auto-detect response direction
) |> 
    print() |>  ## the formatted table prints the coefficients
    plot()      ## plot observations & fitted data

Vector-level and model functions

The individual fitting methods called by analyse_kinetics() can be called directly outside of the “mnirs” data structure:

peak_slope(x, t, width = 5, direction = "auto")

response_time(x, t, response_fraction = c(0.5, 0.632))
t <- 1:100
monoexponential(t, A = 10, B = 100, tau = 8, TD = 15)

sigmoidsl(t, A = 10, B = 100, xmid = 30, slope = 4)
nls(x ~ SSmonoexponential(t, A, B, tau, TD), data = data)

nls(x ~ SSlogistic(t, A, B, xmid, slope), data = data)

mV̇O2 recovery kinetics and muscle Oxidative Capacity assessment

An emerging method using in mNIRS research, a series of repeated brief occlusions can be used to estimate the recovery rate of muscle oxygen uptake from NIRS channels, as a proxy for muscle oxidative capacity. This method can be performed in {mnirs} using recursive calls to analyse_kinetics():

## fit an exponential through the peak slopes of successive occlusions
analyse_kinetics(
    occlusion_intervals,
    nirs_channels = hhb,
    method = "peak_slope",
    span = 3,
) |> 
    print() |>  ## print intermediate results and pass along
    analyse_kinetics(
        nirs_channels = slope,
        time_channel = peak_slope_time,
        method = "monoexponential",
        group_intervals = list(trial1 = 1:10, trial2 = 11:20)
    )

Correcting for blood volume changes

Articles

mnirs 0.7.2

read_mnirs()

example_mnirs("pionirs")
#> [1] "<R library>/mnirs/inst/extdata/pionirs_occlusion.ftn2"
df <- create_mnirs_data(
    PIONIRS_ftn2,
    nirs_channels = c(o2hb = "O2Hb(CH1)", hhb = "HHb(CH1)", thb = "THb(CH1)"),
    time_channel = c(time = "Time"),
    event_channel = c(labels = "TagLabel")
)

attr(df, "nirs_channels")
# [1] "o2hb" "hhb"  "thb" 

Core processing functions

## combine multiple specification types for one boundary
extract_intervals(
    data, 
    start = list(by_lap(2), by_time(400)),
    end = list(by_lap(3), by_label("10-min marker"))
)
custom_colours <- c(
    smo2_left_vl = palette_mnirs("pink"),
    smo2_right_vl = palette_mnirs("light blue"),
    smo2_left_rf = palette_mnirs("purple"),
    smo2_right_rf = palette_mnirs("dark blue")
)
# smo2_left_vl smo2_right_vl  smo2_left_rf smo2_right_rf 
#  "#ff80ff"   "#0080ff"   "#9f79ee" "#00468Bff" 

plot(result) +
    scale_colour_manual(
        values = c(
            smo2_left_vl = palette_mnirs("pink"),
            smo2_right_vl = palette_mnirs("light blue"),
            smo2_left_rf = palette_mnirs("purple"),
            smo2_right_rf = palette_mnirs("dark blue")
        )
    )
read_mnirs(...) |> 
    print() |>  ## intermediate view data frame
    extract_intervals(...) |> 
    print() |>  ## view returned list of data frames
    plot()      ## and plot those results

Package accessories

mnirs 0.7.1

mnirs 0.7.0

Highlights

This minor version update includes mostly internal refactoring, but enough user-facing changes and a few breaking deprecations, so that it’s more than just a patch. This version lays the foundation for the incoming (hopefully soon) mnirs analyse_kinetics suite of functions.

Working with lists and grouped data frames

replace_mnirs(
    data = list(df1, df2),
    outlier_cutoff = 3,
    span = 5
)
#> $interval_1
#> # A tibble:
#>     time  smo2    o2hb
#>    <dbl> <dbl>   <dbl>
#>  1   0    42.8 -0.0289
#>  2   0.1  42.8 -0.0524
#>  3   0.2  42.8 -0.0916
#>  4   0.3  42.9 -0.138 
#>  5   0.4  43.2 -0.205 
#> 
#> $interval_2
#> # A tibble:
#>     time  smo2  o2hb
#>    <dbl> <dbl> <dbl>
#>  1   9.9  51.7 -2.29
#>  2  10    51.7 -2.32
#>  3  10.1  51.8 -2.31
#>  4  10.2  52.2 -2.22
#>  5  10.3  52.4 -2.12

Channel grouping and processing

shift_mnirs(
    data,
    nirs_channels = c(smo2, o2hb),
    group_channels = "ensemble",
    to = 0,
    span = 5
)
filter_mnirs(
    data,
    nirs_channels = c(smo2, o2hb),
    method = list(smo2 = "moving_average", o2hb = "butterworth"),
    span = 5,     ## only used by "moving_average" channels
    order = 2,    ## only used by "butterworth" channels (and below args)
    W = 0.02,
    type = "low",
    na.rm = TRUE
)

Function and argument renaming

interval_list <- extract_intervals(
    data,
    nirs_channels = c(smo2_left, smo2_right),
    group_intervals = "ensemble",
    start = by_time(368, 1084),
    span = c(-20, 90)
)
#> $ensemble
#> # A tibble:
#>     time smo2_left smo2_right
#>    <dbl>     <dbl>      <dbl>
#>  1 -20        56.3       59.2
#>  2 -19.9      56.1       59.2
#>  3 -19.8      56.1       59.2
#>  4 -19.7      56.2       58.9
#>  5 -19.6      56.4       58.9

Performance improvements & bug fixes

read_mnirs()

create_mnirs_data()

resample_mnirs()

replace_mnirs()

filter_mnirs()

shift_mnirs()

rescale_mnirs()

extract_intervals()

plot.mnirs()

Internal validation & shared functions

mnirs 0.6.5

read_mnirs()

## read an mNIRS file with two "smo2" channels
df <- read_mnirs(file_path = example_mnirs("moxy_ramp"))

attr(df, "nirs_channels")
#> [1] "SmO2 Live"    "SmO2 Live(2)"

Core function updates

mnirs 0.6.4

Bug fix

mnirs 0.6.3

Plotting improvements

read_mnirs() |> 
    extract_intervals() |> 
    plot()
## returns a plot with a facet for each interval
read_mnirs() |> 
    extract_intervals() |> 
    class()
#> [1] "mnirs" "list"

Modified lap extraction behaviour

read_mnirs() |> 
    extract_intervals(
        start = by_lap(1, 3),
        span = c(0, 60),
    )
## returns a list of two intervals with the first 60-sec of laps 1 and 3, respectively.

Updated core functions

create_mnirs_data(df, nirs_channels = c(o2hb, hhb))

mnirs 0.6.2

Core updates

Core function argument changes

Small edits

mnirs 0.6.1

Bug fixes

mnirs 0.6.0

Prepare for CRAN submission

Updated core functions

mnirs 0.5.2

Shiny app

mnirs 0.5.1

Updated core functions

mnirs 0.5.0

Updated core functions

Package resources

mnirs 0.4.2 and prior