79
conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan D. Smith Dec 2015 last updated September 2016 for v.12 this document is best viewed in full screen / presentation mode program available from http://botany.wisc.edu/mcculloh-lab-methods.htm send feedback to [email protected] 1

conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

conductR: an R program to measure stem, leaf or root hydraulic conductance

with an electronic balance or pipette

Duncan D. Smith

Dec 2015 last updated September 2016 for v.12

this document is best viewed in full screen / presentation mode

program available from http://botany.wisc.edu/mcculloh-lab-methods.htm

send feedback to [email protected]

Page 2: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications………………………. Initiating/loading the program……………………………… Measuring stems or roots with a balance…………………. File management (what the program expects)…………… Saved data format…………………………………………… Plotting vulnerability…………………………………………. Measuring stems or roots with a pipette………………….. More file management (using multiple methods)………… Measuring leaves with a balance or pipette……………… Input errors…………………………………………………… Appendix A: all functions and their parameters………….. Appendix B: known issues………………………………….. Appendix C: anticipated questions…………………………

3 8 15 16 28 47 49 58 66 73 74 78 79

2

Outline - how to use the program and potentially useful details

Page 3: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications

You need

•Balance (we use a Sartorius with 4-point precision)•USB cable for balance (note: Sartorius cables are wired differently from others) •Driver for cable - may not be necessary for newer operating systems

•e.g. http://www.ftdichip.com/Drivers/VCP.htm for a Sartorius cable•e.g. http://www.prolific.tw for some other cables

•R (https://cran.r-project.org/)•tcltk (a package that comes with the standard R installation)•X11 or XQuartz (for Macs only - this runs tcltk; http://www.xquartz.org/)•R Studio (https://www.rstudio.com/; optional but provides a better interface on *PC* computers than standard R. Standard R is still needed)

3

Page 4: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications

Communication settings

• Determine port settings. Your balance manual should specify how to find these and change them. Here, I will assume:

• baud=9600• parity=odd• data bits=7• stop bits=1• handshake=software/xonxoff

• Determine port name. This will be COM# on a PC or /dev/cu.usbserial-# on a Mac, where # will vary between ports and computers

• To find #, turn on the balance and connect it to the computer. For a PC, find # in Device Manager —> Ports. For a Mac, open Terminal (in the Utilities folder) and input: ls -l /dev/cu.* For either system, there may be multiple ports so disconnect and reconnect the balance to determine the correct one. On my Mac, #=00001004, which I’ll use in the following examples

4

Page 5: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications

Try basic communication

• Open R• Load the tcltk package by typing “require(tcltk)” in the R console.• Input the following into the R console, replacing the red text with your own port ID (in

the first line) and port settings (in the second line):.Tcl('set serial [open /dev/cu.usbserial-00001004 r+]' ) .Tcl('fconfigure $serial -mode \"9600,o,7,1\" -blocking 0 -handshake xonxoff')

• Now press 'print' on the balance and then in R input:.Tcl('return [read $serial]') .Tcl('close $serial')

• The weight on the balance should appear in R. If not, check port settings

5

Page 6: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications

Let the program tell the balance to print

• We need a print command which is Esc-P-CR-LF for Sartorius balances (CR=carriage return and LF=line feed). In the proper format, this command is \x1B\x50\xD\xA (see http://www.asciitable.com/). For Mettler balances, the command is S-I-CR-LF (\x53\x49\xD\xA)

• Now, run the following lines in R - replacing the red text with your port ID (line 1), port settings (line 2), and print code (line 3):.Tcl('set serial [open /dev/cu.usbserial-00001004 r+]' ) .Tcl('fconfigure $serial -mode \"9600,o,7,1\" -blocking 0 -handshake xonxoff') .Tcl('puts $serial \x1B\x50\xD\xA') .Tcl('flush $serial') Sys.sleep(0.1) .Tcl('return [read $serial]') .Tcl('close $serial')

6

Page 7: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Setting up balance communications

Let the program tell the balance to print (continued)

• R should return the weight on the balance. Note that the flush command forces the print command to send and Sys.sleep(0.1) waits 0.1 s, which should be long enough for a response. If it does not work, I would try a simpler command like ‘tare’ (Esc-T-CR-LF = \x1B\x54\xD\xA) because it will be clear whether the balance received the command or not (i.e. the balance should tare). You might also increase the Sys.sleep() time.

Now to use the program

7

Page 8: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>>

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

Initial setup

opening conductR_X opens the console and script

8

Page 9: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>>

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

9

Initial setup

set working directory (line 14), port number

(line 15), and the location of the conductR

file (line 16)

Do these whenever setting up a new

computer

Page 10: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>>

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

10

Initial setup

change balance communication

settings and any plot preferences

Do this when setting up a new balance

Page 11: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>>

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

11

Initial setup

check physical settings (location and

temperature)

Page 12: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>>

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

12

Initial setup

save the script if changes were made

Page 13: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

1 ########################### conductR #####################################2 ##########################################################################3 #### an R program to measure plant hydraulic conductance with an #########4 #### electronic balance or pipette. #####################################5 ##########################################################################6 #### Written by Duncan D. Smith 2012-2015#################################7 #### free to use and alter for all non-commercial purposes ##############8 #### Conceptually based on John Sperry's conduct.ver1.xls ################ 9 ##########################################################################10 require(tcltk) #load tcltk ##############11 ##########################################################################1213 ##Computer-specific settings - *three* things ############################14 kwd="/users/duncan/desktop" #working directory ###########15 .Tcl('set port /dev/cu.usbserial-00001004') #port number ############16 # source("/users/duncan/documents/conductR/conductR_12.R") ###############17 #run the above line (without #) to 'load' the program18 ##########################################################################1920 ##Communication/Plot Settings#############################################21 .Tcl('set baud 9600') #baud rate ###############22 .Tcl('set prty o') #parity ##################23 .Tcl('set dbit 7') #data bits ###############24 .Tcl('set sbit 1') #stop bits ###############25 .Tcl('set prnt \x1B\x50\xD\xA') #print code (Esc-P-CR-LF) ################26 par(mar=c(5,5,1,1)) #plot margins etc ###########27 ##########################################################################28 29 ##Physical Settings#######################################################30 Tsoln.C=25 #solution temp (C) - will standardize to 20 ##############31 elev=280 #elevation (masl) ##############################32 lat=43 #latitude (deg north) ##############################

13

Initiating the program

>>>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)

“load” the script by copying the source command into the

console

you can close the script

Page 14: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

14

>>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)>

An empty plotting window will open if one doesn’t exist already

Initiating the program

XQuartz or X11 or Tk (on a PC) will open as well

Page 15: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

15

>>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)

Making measurements with a balance

Measurements will be made with the cond

function

cond() requires you input an ID (‘numbr’ e.g. stem 21), a group

name (‘sp’ as the group is typically a species e.g. “bepa’ for Betula

papyrifera) and a treatment pressure (‘Ptreat.MPa’ e.g. 0 for a

flushed stem*)

*If measuring native conductance and you didn’t measure native xylem pressure, choose some identifying number for Ptreat.MPa (e.g. 999). The program needs a number because it will always try to calculate PLC relative to the most favorable pressure.

Page 16: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

16

>>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)

Making measurements with a balance

Note the use of quotes. Quotes tell R this is a word and to not try to interpret

it. Things without quotes are either numbers or defined variables. Quotes

are needed for numbr if letters are involved (e.g. “21a”)

conductR requires numbr, sp and Ptreat.MPa for grouping measurements together.

• All measurements with the same sp will be pooled in the same .csv files. • All measurements with the same sp, numbr and P.MPa (I call this nomID) will be treated as part of the same conductance measurement. • Measurements with the same sp and numbr (I call this stemID) will be grouped for calculating PLC

There are other options for cond but the defaults are fine for now

(see Appendix A)

Page 17: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

17

>>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)

Making measurements with a balance

I’ll start with no applied pressure to the stem.

For an overview of the methodology of measuring hydraulic conductance see

Anna Jacobsen’s document https://www.csub.edu/~ajacobsen/Conductivity%20Methods_2014.pdf

Page 18: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

18

>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making measurements with a balance

Individual flow rates (black) will start to plot every 6

seconds (by default) as they accumulate, followed by the

running means (cyan)

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

Page 19: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

19

>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making measurements with a balance

Each bar represents one unit of resolution: My balance resolution is

0.0002 g and measurements are every 6

s, so the resolution is 0.000033 g/s

Page 20: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

20

>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making measurements with a balance

Balance resolution can be changed in cond,

e.g., cond(…,resl=0.0001)

(if it’s wrong it doesn’t affect calculations it’s mostly used to assess

variability)

Page 21: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

21

>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making measurements with a balance

Wait for stability

This looks pretty good (repeating pattern)

Page 22: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

22

>>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making measurements with a balance

Click the “Done” button

(the button is part of XQuartz (or X11 or Tcl), so select that

program if you see no button)

Page 23: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345678

9

23

>>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)

Making measurements with a balance

choose which running mean to

keep follow the prompts

Page 24: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345678

9

24

>>>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)

Making measurements with a balance

what was the pressure driving flow? (0 in this case)

Page 25: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345678

9

25

>>>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242

Making measurements with a balance

What are the stem’s diameter and length?

Page 26: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345678

9

26

>>>>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=

Making measurements with a balance

Check the solution temperature change if needed

Page 27: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00020

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345678

9

27

>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”

Making measurements with a balance

A “flowdata.csv” file with all measurements and important settings has been created in

your working directory

The program will add to this file every time you measure this

species (bepa)

*this is the old format to add a full timestamp (yyyy-mm-dd hh-mm-ss), but beyond ‘dd’ serves no purpose (it used to have a purpose).

Page 28: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

The saved flowdata.csv file

looks like this

Making measurements with a balance

time of each measurement

(seconds since 1970 - R’s choice not

mine)time (s) between

measurements

readings from balance

each flow rate (g/s)

running means of flow rates (g/s)

first reading

last reading

ver 10 also saves time as decimal day (not shown) 28

Page 29: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Making measurements with a balance

pressure driving flow (user input)

pressure driving flow converted

to MPa

stem diameter

stem length

stem number

species

treatment pressure

species and

number combined

species, number

treatment pressure

combinedsolution

temperature

which point was chosen

as finalwhether point was used to

calculate conductance

(will make more sense later)

flowdata continued

29

ver 11+ also includes a

measurement number,

which mostly helps the program

when fixing errors

Page 30: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

30

> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)

Making measurements with a balance

Now I’ll measure with applied pressure to the stem.

Run cond exactly as before

(press the up arrow to recall previous commands in the

console)

Page 31: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00160

0.00170

0.00180

0.00190 bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

31

>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!"

Making measurements with a balance

When there are many points, only the recent ones are shown in the main plot. All running means are in the inset

Inset size (as a fraction of total plot size) is controlled by ovrl in

cond. See Appendix A

Page 32: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00160

0.00170

0.00180

0.00190 bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345

678

9

1011

121314

15

1617

1819

1020

32

>> source(“/users/duncan/desktop/conductR/conductR_12.R”)> cond(21,”bepa”,0)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!"

Making measurements with a balance

Reasonably stable. Note that the y range of the plot is the range of all the data, so while it’s noisy,

there is not much variation in terms of measurement

resolution

Page 33: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00160

0.00170

0.00180

0.00190 bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345

678

9

1011

121314

15

1617

1819

1020

33

“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm)no previous diameter. d.mm= 5.2no previous length. l.mm= 242“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=

Making measurements with a balance

As before, click done, choose a point and input the pressure

This time the program knows the diameter and

length from before

Page 34: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00160

0.00170

0.00180

0.00190 bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s)

12345

678

9

1011

121314

15

1617

1819

1020

34

no previous length. l.mm= 242“data written in NEW file as: 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”

Making measurements with a balance

All these measurements are added to the

existing flowdata.csv file

Page 35: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 1 2 3 40.0000

0.0005

0.0010

0.0015

elapsed time (min)

mea

n fl

ow ra

te, Q

(g/s

)

35

10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”

Making measurements with a balance

When there are two or more sets of

measurements, the program shows all running

means over time. Red points are those we chose

to keep

The program shows this plot for only 1 second before making the next plot. To toggle through plots, select

Quartz window and use left and right arrow keys while holding ⌘

Page 36: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2k = 0.2675r2 = 1

36

10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”

Making measurements with a balance

And final running means vs pressure

Page 37: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2k = 0.2675r2 = 1

37

10-24-27 bepa flowdata.csv to /users/duncan/desktop”> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”

Making measurements with a balance

Note conductance (k) show here has units of g s-1 MPa-1, corrected to

20 C - even though plot gives pressure in cm

Page 38: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2k = 0.2675r2 = 1

38

> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)

Making measurements with a balance

You have the option to remove bad points. This can be more useful later

Page 39: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

39

> cond(21,”bepa”,0)"CLICK DONE! WHEN FINISHED - DO NOT HIT ESC!”which point to keep? (blank=last)ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)

Making measurements with a balance

Next I’ll measure flow with no applied

pressure, using cond just as before

Page 40: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

-0.00016

-0.00012

-0.00008

bepa 21 0 MPa

elapsed time

flow

rate

, Q (g

/s) 12

34

56

7

8910

111213

14

40

ending pressure? (cm) 66.6previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)> cond(21,”bepa”,0)> “CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)

Making measurements with a balance

initiate measurements as before and wait for stability. Then choose point to keep, input pressure, change or keep diameter and length

Page 41: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 2 4 6 8 100.0000

0.0005

0.0010

0.0015

elapsed time (min)

mea

n fl

ow ra

te, Q

(g/s

)

“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)> cond(21,”bepa”,0)> “CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm) 0previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”

41

Making measurements with a balance

Again, all points over time are shown…

Page 42: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2

3

k = 0.2613r2 = 0.998

42

Making measurements with a balance

Followed by finals vs pressure

exclude points? (input number to exclude, blank=no change)> cond(21,”bepa”,0)> “CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm) 0previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”exclude points? (input number to exclude, blank=no change)

This looks good. The background points (1 and 3) are quite

similar

Page 43: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2

3

k = 0.2551r2 = 1

Followed by finals vs pressure

43

Making measurements with a balance

This looks good. The background points (1 and 3) are quite

similar but I can delete* #1, just to show what happens

*don’t worry, those data aren’t really gone

> cond(21,”bepa”,0)> “CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm) 0previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”exclude points? (input number to exclude, blank=no change) 1exclude points? (input number to exclude, blank=no change)

Page 44: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2

3

k = 0.2551r2 = 1

44

Making measurements with a balance

> “CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last)ending pressure? (cm) 0previous d.mm=5.2 blank=use otherwise d.mm=previous l.mm=242 blank=use otherwise l.mm=previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”exclude points? (input number to exclude, blank=no change) 1exclude points? (input number to exclude, blank=no change)> cond(21,”bepa”,0,justcalc=T)

It was fine with #1 but there’s no ‘undo’

To get #1 back, run cond just as before, but add justcalc=T

This will skip making measurements and allow you

to calculate and save conductance

Page 45: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 10 20 30 40 50 600.0000

0.0005

0.0010

0.0015

bepa 21 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(g/s

)1

2

3

k = 0.2613r2 = 0.998

45

Making measurements with a balance

previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to 2015-12-09 10-24-27 bepa flowdata.csv to /users/duncan/desktop”exclude points? (input number to exclude, blank=no change) 1exclude points? (input number to exclude, blank=no change)> cond(21,”bepa”,0,justcalc=T)“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)save conductance? (y=yes blank=no) y

Now you’re asked to save conductance. When we

excluded a point, it didn’t ask. By default, the

program requires at least 3 measurements,

which is the bare minimum to assess if Q vs P is linear. The minimum requirement

can be changed. See Appendix A

Page 46: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

46

Making measurements with a balance

> cond(21,”bepa”,0,justcalc=T)“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)save conductance? (y=yes blank=no) y“data written in NEW file as: 2015-12-09 11-05-23 bepa condcalc.csv to /users/duncan/desktop” sp numbr P.MPa nomID stemID l.mm1 bepa 21 0 bepa 21 0 MPa bepa 21 242 d.mm k.g.s.MPa r2 K.g.mm.s.MPa 1 5.2 0.261289 0.9982949 63.231945Ks.g.s.MPa.mm plc1 2.97741 0

Conductance calculations are saved in a new

“condcalc.csv” file* in your working directory

and the program shows you all data within that file

saved conductances and conductivities are

standardized to 20 C.

*shown is the old name format with full timestamp (yyyy-mm-dd hh-mm-ss), but beyond ‘dd’ serves no purpose (it used to have a purpose).

Page 47: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

>>>>>>>>>>>>>> showvuln(“qudo")

if constructing a vulnerability curve, the showvuln function plots all data in

condcalc.csv for the specified species (note this is qudo not bepa)

Ks is plotted by default (see Appendix A)

47

0 1 2 3 4 50.0

0.1

0.2

0.3

0.4

0.5

P.MPa

Ks.g.s.MPa.mm

qudo 3qudo 5

Viewing vulnerability

Page 48: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0 1 2 3 4 50

2040

6080

P.MPa

PLC

qudo 3qudo 5

>>>>>>>>>>>>> showvuln(“qudo)> showvuln(“qudo”,as.plc=T)

plotting PLC is another option (see Appendix A)

48

Viewing vulnerability

Page 49: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Measurements with a pipette: manual mode

Most details of the program are the same except you control the measurements

Instead of the program measuring change at fixed times, you tell the program when a fixed unit of fluid has

moved into (or out of) the xylem

49

Page 50: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

50

Making measurements with a pipette

>>>>>>>>>>>>>> cond(1,”test”,0,resl=0.01,manul=T)

Use the cond function just as with the balance but:

use manul=T; resolution (resl) will be the

volume increment (ml) of each measurement

(with the balance, resl had units of g and setting it was not

crucial)

Page 51: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

51

>>>>>>>>>>>>>> cond(1,”test”,0,resl=0.01,manul=T)

Here I’m measuring stem 1 of species “test”

(These data will be made up)

For these “measurements” I will use three different pressure

heads

Making measurements with a pipette

Page 52: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

52

>>>>>>>>>>>>>> cond(1,”test”,0,resl=0.01,manul=T)

Note this layout of windows is useful:

The console has to be selected to make measurements so keep it to the side of the plot so you can see

the data

Making measurements with a pipette

Page 53: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

53

>>>>>>>>>>>> cond(1,”test”,0,resl=0.01,manul=T)ready to start! increment = 0.01 ml (press enter)

Once initiated, the program is ready to start the timer

Making measurements with a pipette

Page 54: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

54

>> cond(1,”test”,0,resl=0.01,manul=T)ready to start! increment = 0.01 ml (press enter)record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done

Making measurements with a pipette

Hit enter every time the meniscus crosses a tick mark

on the pipette

Flow rates and running means accumulate

0.000

0.002

0.004

0.006

0.008

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

Page 55: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

55

>> cond(1,”test”,0,resl=0.01,manul=T)ready to start! increment = 0.01 ml (press enter)record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done

Making measurements with a pipette

Just hitting enter tells the program that the meniscus has

moved one tick mark.

If you missed one tick, you could input “2” and hit enter on

the next tick

0.000

0.002

0.004

0.006

0.008

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

Page 56: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.000

0.002

0.004

0.006

0.008

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

123456789

56

record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done d

Making measurements with a pipette

To finish, there is no “done” button, instead input “d” and

hit enter as prompted

Page 57: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.000

0.002

0.004

0.006

0.008

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

123456789

57

record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 8d.mm blank and no previous. d.mm= 3.2l.mm blank and no previous. l.mm= 152previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=

Making measurements with a pipette

As with the balance, choose a point, input the pressure,

diameter and length Check solution temp

Page 58: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

58

record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 8d.mm blank and no previous. d.mm= 3.2l.mm blank and no previous. l.mm= 152previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data written in NEW file as: 2015-12-09 12-24-27 test flowdata manul.csv to /users/duncan/desktop”

Making measurements with a pipette

A new flowdata .csv file of all the measurements gets

created*

*this .csv will have nearly the same layout as one created when using the balance. The key difference is units will be in ml instead of g. Note that ‘manul’ appears in the file name. This prevents an error if you happen to use the balance and pipette on the same species

0.000

0.002

0.004

0.006

0.008

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

123456789

As with the balance, choose a point, input the pressure,

diameter and length Check solution temp

Page 59: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.000

0.001

0.002

0.003

0.004

0.005

test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

59

12-24-27 test flowdata manul.csv to /users/duncan/desktop”> cond(1,”test”,0,resl=0.01,manul=T)ready to start! increment = 0.01 ml (press enter)record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done d

Making measurements with a pipette

Repeat for a different pressure head

wait for stability

Page 60: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

60

record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 4previous d.mm=3.2 blank=keep otherwise d.mm =previous l.mm=152 blank=keep otherwise l.mm =previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 test flowdata.csv to /users/duncan/desktop”

Making measurements with a pipette

All running means vs time

0.0 0.5 1.0 1.50.0025

0.0035

0.0045

elapsed time (min)

mea

n fl

ow ra

te, Q

(ml/s

)

Page 61: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

61

record n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 4previous d.mm=3.2 blank=keep otherwise d.mm =previous l.mm=152 blank=keep otherwise l.mm =previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 test flowdata.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)

Making measurements with a pipette

Final running means vs pressure

4 5 6 7 80.0025

0.0035

0.0045

test 1 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(ml/s

)

1

2

k = 5.88r2 = 1

Page 62: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

62

blank=no change)> cond(1,”test”,0,resl=0.01,manul=T)ready to start! increment = 0.01 ml (press enter)record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done d

Making measurements with a pipette

Repeat for third pressure head.

0.0000

0.0005

0.0010

0.0015

0.0020

0.0025 test 1 0 MPa

elapsed time

flow

rate

, Q (m

l/s)

Page 63: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

63

record n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 2previous d.mm=3.2 blank=keep otherwise d.mm =previous l.mm=152 blank=keep otherwise l.mm =previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 test flowdata manul.csv to /users/duncan/desktop”

Making measurements with a pipette

All running means vs time

0 1 2 3 4 5 60.002

0.003

0.004

0.005

elapsed time (min)

mea

n fl

ow ra

te, Q

(ml/s

)

Page 64: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

64

record n increments; blank=1; d=donerecord n increments; blank=1; d=done dwhich point to keep? (blank=last)ending pressure? (cm) 2previous d.mm=3.2 blank=keep otherwise d.mm =previous l.mm=152 blank=keep otherwise l.mm =previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 test flowdata manul.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)

Making measurements with a pipette

Final running means vs pressure

2 3 4 5 6 7 80.002

0.003

0.004

0.005

test 1 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(ml/s

)

1

2

3

k = 5.88r2 = 1

Page 65: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

65

flowdata manul.csv to /users/duncan/desktop”“(go back one plot to see all mean flow rates)”exclude points? (input number to exclude, blank=no change)save conductance? (y=yes blank=no) y“data written in NEW file as: 2015-12-09 12-55-33 test condcalc manul.csv to /users/duncan/desktop” sp numbr P.MPa nomID stemID l.mm1 test 1 0 test 1 0 MPa test 1 152 d.mm k.g.s.MPa r2 K.g.mm.s.MPa 1 3.2 5.900161 0.9997041 896.8244Ks.g.s.MPa.mm plc1 111.511 0

Making measurements with a pipette

A new condcalc .csv file gets created

Here are the data in that file

2 3 4 5 6 7 80.002

0.003

0.004

0.005

test 1 0 MPa

pressure (cm)

mea

n fl

ow ra

te, Q

(ml/s

)

1

2

3

k = 5.88r2 = 1

Page 66: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Measuring leaves (balance or pipette)

The program may be configured to measure hydraulic conductance of leaves with the evaporative flux method

The protocol of measuring background flow rates doesn’t lend itself to leaf hydraulics very well. The flow through a transpiring

leaf depends on leaf water potential, which cannot be measured without disrupting hydraulic conductance (e.g. pressure bomb or

chamber psychrometry).

Given this limitation, the program calculates leaf hydraulic conductance from a single flow rate and water potential

66

Page 67: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

67

>>>>>>>>>>>>>> cond(12,”bepa”,0,dt=6,kleaf=T)

Making leaf measurements (shown with a balance)

Initiate measurements using the cond function as before, but

add kleaf=T

which will let the program know there will only be one measurement before

conductance can be calculated and what information to prompt from you

manul may be T (pipette) or F (balance; default)

Page 68: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00188

0.00192

0.00196

0.00200 bepa 12 0 MPa

elapsed time

flow

rate

into

leaf

, Q (g

/s)

68

>>>>>>>>>>>>> cond(12,”bepa”,0,dt=6,kleaf=T)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESC

Making leaf measurements (shown with a balance)

Measurements will accumulate as before

(note that rates are into the leaf - out of

the balance)

Page 69: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00180

0.00190

0.00200

bepa 12 0 MPa

elapsed time

flow

rate

into

leaf

, Q (g

/s)

123

456

7

89

10

11

1213

1415

10

69

>>>>>>>>>>> cond(12,”bepa”,0,dt=6,kleaf=T)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last) infeed pressure (cm)

Making leaf measurements (shown with a balance)

After asking for point to keep, program asks for the pressure of water just before it enters the leaf.

This may be measured as hydraulic head. Zero is ideal - and

a good assumption if unknown.

Page 70: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.00180

0.00190

0.00200

bepa 12 0 MPa

elapsed time

flow

rate

into

leaf

, Q (g

/s)

123

456

7

89

10

11

1213

1415

10

70

>>>>>>>> cond(12,”bepa”,0,dt=6,kleaf=T)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last) infeed pressure (cm) 0leaf pressure (MPa) 1previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=

Making leaf measurements (shown with a balance)

Next, the leaf must be removed from the tubing and pressure-bombed to get the driving force for

flow*

*The assumption is that leaf pressure is a negative number. If your input is positive, the program will make it negative.

Page 71: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.0 0.2 0.4 0.6 0.8 1.00.0000

0.0005

0.0010

0.0015

bepa 12 0 MPa

pressure difference (MPa)

mea

n fl

ow ra

te in

to le

af, Q

(g/s

)

1k = 0.00166r2=NA

71

>>>>>> cond(12,”bepa”,0,dt=6,kleaf=T)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last) infeed pressure (cm) 0leaf pressure (MPa) 1previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 bepa flowdata kleaf.csv to /users/duncan/desktop”

Making leaf measurements (shown with a balance)

The flow data gets saved* and the flow vs pressure

relationship will be shown. Since we only have one point, the line runs through the origin

The “pressure difference” on the x-axis is infeed - leaf*

*this .csv will have a different layout from one created when measuring stems (or roots). Note that ‘kleaf’ appears in the file name. This prevents an error if you happen to measure leaves and stems or roots on the same species

Page 72: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

0.0 0.2 0.4 0.6 0.8 1.00.0000

0.0005

0.0010

0.0015

bepa 12 0 MPa

pressure difference (MPa)

mea

n fl

ow ra

te in

to le

af, Q

(g/s

)

1k = 0.00166r2=NA

72

>>> cond(12,”bepa”,0,dt=6,kleaf=T)“CLICK DONE! WHEN FINISHED - DO NOT HIT ESCwhich point to keep? (blank=last) infeed pressure (cm) 0leaf pressure (MPa) 1previous Tsoln.C= 25 blank=use, otherwise Tsoln.C=“data APPENDED to: 2015-12-09 12-24-27 bepa flowdata kleaf.csv to /users/duncan/desktop”exclude points? (input number to exclude, blank=no change)save conductance? (y=yes blank=no) y

Making leaf measurements (shown with a balance)

Next, you’re prompted to exclude points if needed and save

conductance. Done

Page 73: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

A number of features prevent the user from inputting values that cause the program to error. For example, when asked which point to keep, the input can only be an integer between 1 and the total number of mean flow rates, which often helps if you accidentally enter pressure instead. Pressure, diameter, length and temperature must be numbers. The program will ask for new values if these criteria are not met. Some accidents are accepted by the program though. Most common errors are fixed via cond(…,fix=T), where … must contain the number, species and treatment pressure of the measurement you want to fix. Using fix=T will prompt you for which measurement to fix (i.e. the numbers shown in the Q vs P plot), what to fix (options depend on measurement type - leaf or stem/root), and what the corrected value is. Changes are made to the flowdata csv file then the program proceeds as if a measurement was just completed.

Dealing with input errors

73

Page 74: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Appendix A: Functions and their parameters

cond(numbr,sp,Ptreat.MPa=0,runmean=4,dt=6,resl=0.0002,mxplot=10,

justcalc=F,manul=F,testmode=F,

ovrl=0.3,

kleaf=F,

nmin=3,

fix=F)

Parameters of the cond function (and their defaults)# stem number (or letter, use quotes with letters)# species (must be in quotes)# treatment pressure in MPa (must be a number)# number of values in running mean# target time (s) between balance readings# resolution of balance (g) or pipette (ml)# leave space for this many measurements when making a new plot after existing one is full# option to skip measurements and just calculate conductance# manual mode (T for use with pipette)# create random numbers instead of reading the balance (useful for demonstration or when altering code)# size of inset showing overall flow data - as a fraction of plot size (0=no inset)# is measurement on a leaf? If T, will ask for leaf pressure and not diam or length. Also nmin=1# the minimum number of points required to calculate k from Q vs P# option to skip measurements and change an input in a previous measurement

74

Page 75: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

showvuln=(sp,yax=c(“k.”,"K.","Ks")[3],

as.plc=F,

horiz=90,

retrn=F)

Parameters of the showvuln function (and their defaults)

# species# what to plot on y axis (conductance, conductivity or specific conductivity (default), respectively)# option to plot percent loss conductivity, if T, yax is ignored# add a horizontal line at this height in PLC plot# option to return entire condcalc.csv file

Note: this function will search the working directory for .csv files that contain “sp condcalc”. If there are multiple matches, it will ask which to use

75

Appendix A: Functions and their parameters

Page 76: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

pcent(rpm,rmax.mm,r=0)

Miscellaneous functions and their parameters

# returns pressure induced by centrifuge in MPa # RPM of centrifuge# radius from center of rotation to meniscus in rotor cup# point of interest in stem relative to center of rotationNote: function uses density of water = 998.2 kg m-3 (20 C)

rpmcent(p,rmax.mmr=0)

# returns RPMs needed to induce given pressure # desired pressure in MPa (needs to be negative)# radius from center of rotation to meniscus in rotor cup# point of interest in stem relative to center of rotationNote: function uses density of water = 998.2 kg m-3 (20 C)

phead(p.cm,rho,grav)

# converts pressure head in cm to MPa # head in cm# density of water in kg m-3# gravity in m s-2

76

Appendix A: Functions and their parameters

Page 77: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Internal functions

cond() uses functions corner() and resbar() to respectively add text and resolution bars to plots

Times are converted from “seconds since 1970” to decimal day via s2dec(), which uses nsplit() and subsplit()

77

Appendix A: Functions and their parameters

Page 78: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

After measurement, warning(s) stating NAs introduced by coercion are sometimes given. These may be do to bad balance outputs or bad inputs for pressure, diameter or length. This should not affect measurements but the warning may cause concern.

The code was written using Sartorius balances, which makes them very easy to set up. For other balances (e.g. Mettler), how the program processes the output is quite difficult to tailor. One needs to understand the variation in balance output and how to consistently parse it into a number. If a simple solution can be found, it will be added.

Appendix B: Known issues

78

Page 79: conductR: an R program to measure stem, leaf or root ...€¦ · conductR: an R program to measure stem, leaf or root hydraulic conductance with an electronic balance or pipette Duncan

Anticipated questions:

How do I save my data? Data is automatically saved to your working directory after every measurement. You need not save anything in R except the conductR code if you alter it

How do I change the defaults in cond()? In the conductR code where it says cond=function(…) you’ll see all the function arguments and their defaults. Change as desired, save and re-source the code into the R console.

What if I input the wrong ____? Your options are to either 1) start over (good when you just started a measurement and, say, used the wrong ID) 2) use cond(…,fix=T) and follow the prompts or 3) manually edit the saved data file(s). If diameter and/or length are wrong and you need to make another measurement before calculating conductance, just input the correct d or l when prompted and the program will use this value. If you calculated conductance with a wrong input, manually recalculate K and/or Ks.

Why is this not an R package? It seemed simpler this way to keep everything organized in one file. Plus, this way the user has full access to and control over the code, which allows things like default arguments to be changed. However, there is potential for problems if your variable names overlap with mine. Besides the functions (see Appendix A) and .Tcl variables (i.e. port settings), I use: kwd, Tsoln, elev, lat, rho, grav

Appendix C

79