Coder Social home page Coder Social logo

intensiveacifit's Introduction

IntensiveACiFit

The goal of IntensiveACiFit is to fit intensive data mentioned in Zhou et al (2019). Most of the codes are from C4-Parameter-Estimation, and revised for use with LI-6800 RACiRor ACi data measured by LI-6800(use the method advised by Zhou et al (2019)). If you use this package for your data, please cite Zhou et al (2019) first:

Zhou, Haoran, Erol Akçay, 和 Brent R. Helliker. 2019. Estimating C4 photosynthesis parameters by fitting intensive A/Ci curves. Photosynthesis Research 141 (2): 181–94. https://doi.org/10.1007/s11120-019-00619-8.

Installation

You can install the development version of IntensiveACiFit like so:

remotes::install_github('zhujiedong/IntensiveACiFit')
# or
remotes::install_git(
        'https://gitee.com/zhu_jie_dong/IntensiveACiFit.git')

Example code

Please note that this is the very beginning of this package. I plan to add plot method to give a quick way to plot the fitted data, but it is still in plan. The following show some codes that may be helpful to give a quick view of the results.

In the extdata folder of the repo, I included a simulated RACiR data generated by plantecophys::ACiC4 (as currently I do not have RACiR data measured in C4 plant).

The format of the data should be LI-6800 measurement without changing the header, something like the following table:

elapsed E Emm A
0 0.0018594 1.859397 5.589868
2 0.0018582 1.858232 7.963561
4 0.0018556 1.855645 10.675401
6 0.0018550 1.854993 13.590991
8 0.0018522 1.852195 15.891795

You can also refer to the example data.

Please refer to Zhou et al (2019) for the details of the function parameters.

library(IntensiveACiFit)

aci = read.csv('data/sim-data-utf8.csv')

#-------------- C4EstimateWithCA -------------------#

# 直接使用相关的数据进行拟合即可
# aci 是刚刚导入的 LI-6800 数据
# 其他参数请参考帮助文档或者文献
# startp 由推荐值,但可能需要根据具体情况微调,
# 例如我这里进行了调整,是拟合的初值
# 一般 CaBreakL 和 CaBreakH 在 20 和 60 之间
# 意义同 plantecophys 的 ci transition 
# alpha1 和 x 一般是这个默认值
# 除非文献中看到更适合自己测量植物的值或
# 者有实际测量计算值才能修改
ca_c4estimate = C4EstimateWithCA(aci, alpha1 = 0.15, x=0.4, 
    CaBreakL = 10, CaBreakH = 45, 
    startp = c(45, 300, 3, 20, 120, 100))
# 此处主要是展示数据的结构
str(ca_c4estimate)

A.obs = aci$A
Ci.obs = aci$Pci

# 调用拟合的各阶段的数据
RcPc = unlist(ca_c4estimate$limitation_stage[1], 
    use.names=FALSE)
RcPr = unlist(ca_c4estimate$limitation_stage[2], 
    use.names=FALSE)
RrPc = unlist(ca_c4estimate$limitation_stage[3], 
    use.names=FALSE)
RrPr = unlist(ca_c4estimate$limitation_stage[4], 
    use.names=FALSE)

# 设置个喜欢的颜色,设置相关作图用到的参数和图例
cols = palette('Set 3')[3:7]
xrange<-max(Ci.obs)
yrange<-max(A.obs) + max(A.obs) * 0.1
leg.text<-c("Obs A", "Cal RcPc", "Cal RcPr",
    "Cal RrPc","Cal RrPr")

plot_c4_fit = function(){
    plot(Ci.obs, A.obs, pch =19, col = cols[1],
        xlim=range(0,xrange),ylim=range(0,yrange), 
        xlab="Ci(Pa)",ylab="A")
    lines(Ci.obs[order(Ci.obs)], RcPc[order(Ci.obs)], 
        col=cols[2], lwd=4.2, pch = 20)
    lines(Ci.obs[order(Ci.obs)], RcPr[order(Ci.obs)], 
        col=cols[3], lwd=4.2, pch = 20)
    lines(Ci.obs[order(Ci.obs)], RrPc[order(Ci.obs)], 
        col=cols[4], lwd=4.2, pch = 20)
    lines(Ci.obs[order(Ci.obs)], RrPr[order(Ci.obs)], 
        col=cols[5], lwd=4.2, pch = 20)
    legend("bottomright",leg.text,col=cols,
            pch=c(20,NA,NA,NA,NA),lty=c(0,1,1,1,1),
            cex=0.5,lwd=c(0,2,2,2,2))
}
plot_c4_fit()

#-------------- C4EstimateWithCAT -------------------#
cat_c4estimate = C4EstimateWithCAT(aci, CaBreakL = 10, CaBreakH = 35)
#str(cat_c4estimate)

RcPc = unlist(cat_c4estimate$limitation_stage[1], 
    use.names=FALSE)
RcPr = unlist(cat_c4estimate$limitation_stage[2], 
    use.names=FALSE)
RrPc = unlist(cat_c4estimate$limitation_stage[3], 
    use.names=FALSE)
RrPr = unlist(cat_c4estimate$limitation_stage[4], 
    use.names=FALSE)

plot_c4_fit()

#-------------- C4EstimateWithoutCA -------------------#
noca_c4estimate = C4EstimateWithoutCA(aci, CaBreakL = 10, 
    CaBreakH = 35)
#str(noca_c4estimate)


RcPc = unlist(noca_c4estimate$limitation_stage[1], 
    use.names=FALSE)
RcPr = unlist(noca_c4estimate$limitation_stage[2], 
    use.names=FALSE)
RrPc = unlist(noca_c4estimate$limitation_stage[3], 
    use.names=FALSE)
RrPr = unlist(noca_c4estimate$limitation_stage[4], 
    use.names=FALSE)

plot_c4_fit()


#-------------- C4EstimateWithoutCAT -------------------#
nocat_c4estimate = C4EstimateWithoutCAT(aci, 
    CaBreakL = 10, CaBreakH = 25)
# str(nocat_c4estimate)

RcPc = unlist(nocat_c4estimate$limitation_stage[1], 
    use.names=FALSE)
RcPr = unlist(nocat_c4estimate$limitation_stage[2], 
    use.names=FALSE)
RrPc = unlist(nocat_c4estimate$limitation_stage[3], 
    use.names=FALSE)
RrPr = unlist(nocat_c4estimate$limitation_stage[4], 
    use.names=FALSE)

plot_c4_fit()


#-------------- C4EstimateWithoutCAYin -------------------#
noca_c4estimate_yin = C4EstimateWithoutCAYin(aci, CaBreakL = 10, 
    CaBreakH = 45)
# str(noca_c4estimate_yin)

RcPc = unlist(noca_c4estimate_yin$limitation_stage[1], 
    use.names=FALSE)
RcPr = unlist(noca_c4estimate_yin$limitation_stage[2], 
    use.names=FALSE)
RrPc = unlist(noca_c4estimate_yin$limitation_stage[3], 
    use.names=FALSE)
RrPr = unlist(noca_c4estimate_yin$limitation_stage[4], 
    use.names=FALSE)

plot_c4_fit()

#-------------- C4EstimateWithoutCAYin -------------------#
nocat_c4estimate_yin = C4EstimateWithoutCAYinT(aci, CaBreakL = 10, CaBreakH = 45)
#str(nocat_c4estimate_yin)

RcPc = unlist(nocat_c4estimate_yin$limitation_stage[1], use.names=FALSE)
RcPr = unlist(nocat_c4estimate_yin$limitation_stage[2], use.names=FALSE)
RrPc = unlist(nocat_c4estimate_yin$limitation_stage[3], use.names=FALSE)
RrPr = unlist(nocat_c4estimate_yin$limitation_stage[4], use.names=FALSE)

plot_c4_fit()

intensiveacifit's People

Contributors

zhujiedong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.