ofr calculator v 1.4h donna sueper jimenez group, cu boulder, april 1, 2014 1

18
OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

Upload: moris-booker

Post on 25-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

1

OFR Calculator v 1.4H

Donna SueperJimenez Group, CU Boulder,

April 1, 2014

Page 2: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

2

The main output of the OFR panel are, in general two plots: the relative and absolute oxidation enhancement as a function of oxidation age/OH enhancement.

Introduction

These sample plots show the individual measurements and averages obtained by grouping the data into equally numbered points in the x dimension. These graphs can be modified to show the individual measurements colored by a third trace, and to show averages sorted into day and night groupings. The no-Oxidant data is averaged separately, to one value.

The analysis steps can be broken down into 3 main steps:(1) Ensure a good comparison of ambient data and reactor data by adjusting Ox enhanced data based on a comparison of data taken through reactors with no oxidative forcing and ambient data.(2) Calculate the absolute and relative enhancements for the chosen oxidant. (y-axis)(3) Plot the data and generate averages. (x axis)

Amber Ortega
Were you planning on doing the dual axis to fix the big gap between the lights off and lights points? (See my example out of slide view). --> CHANGE Equivalent Age to Photochemical Age for all plots.
Amber Ortega
Graphs are for one oxidant type, i.e. hOH. DOnna, is is possible to stack? Say you want hOH, sOH, and O3 all on one plot ...?
Amber Ortega
In here we are calculating or using OHexp (or O3exp). I think it's important to let users know where that step happens.
Donna Sueper
Code now changed to say Photochemical age (days) for these plots. As for the realization that the zero-added exposure value is too 'far', I will leave that up to the user to modify.... I'd rather keep the 'real' data as shown.The goal isn't to generate plots perfect for papers, just accurate ones.I did add info about the separate averages in the text.
Donna Sueper
Users can do this themselves. Waves are named with the different oxidation schemes, so new graphs pop up with different names.
Donna Sueper
agreed
Page 3: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

3

Code consists of 2 ipfs: • OFR_Tools_v1.* which IS NOT intended to be edited by users • OFR_Field_v1.* which IS intended to be edited by users • and one possibly additional ipf : OFR_Extras_v1.*. The ‘extras’ pf consists of functions

which may or may not be in your current experiment. Simply comment out the functions within the extras ipf until you can compile your experiment.

From the main OFR menu in Igor, select “Make OFR Panel” and this panel will appear:Anything italicized in the panel does not work yet.

Amber Ortega
This is new ... did you run into issues?
Donna Sueper
With Lina... But in general this code should work for any 'monkey with the ambient' set up.
Page 4: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

4

Step 0. Review parametersPressing the Step 0 gold button enlarges the panel to include the display of several ‘popable’ tables. Pressing the right-side gray “Hide OFR settings” hides these tables. All entries in the table are saved as you type them in. All tables must have the same number of points within the waves shown in each table.

The OFRReactorTable consists of two waves: root:OFR:ReactorIDroot:OFR:ReactorVolume

The user should enter a name for each reactor and it’s volume in liters.

The reactor name should be Igor-friendly (does not begin with a number, etc). Reactor names will be used in subsequent tables to identify oxidant and flow states.Below is a sample of a filled in OFRReactorTable:

Step 0. Review parameters: OFRReactorTable

Page 5: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

5

Step 0. Review parameters: OFRParameterTableThe OFRParameterTable consists of three waves: root:OFR:AmbParametersDescription root:OFR:AmbParametersUnitsroot:OFR:AmbParametersValueThe purpose of this table is to have one place for all the values needed for exposure calculations; entries can be numerical constants or the full path of time-dependent waves (all waves must be the same size/index as your time wave for AMS data). See the OFROxTable for further information.The names and units of some parameters, specifically the ones given by default must not be changed, (i.e. Reactor_Key, AmbPres , AmbTemp) but the values should be changed (the defaults are only entered for guidance).Below is a sample of a filled in OFRparameterTable:

An important parameter is Reactor_Key. The wave for this parameter must contain integers; the value of 0 indicates an ambient measurement; 1 measurement through the reactor identified in the first row of the previous reactorID table, etc.Users can use the syntax such as key = valve[p] == 3 ? key[p] : 2 to generate this wave. This reactor_key wave may also have nans.

Page 6: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

6

Step 0. Review parameters: OFRReactorFlowTable

The OFRReactorFlowTable consists of these waves: root:OFR:ReactorFlowIDroot:OFR:ReactorFlowDescriptionroot:OFR:ReactorFlowValueroot:OFR:ReactorFlowStartRunroot:OFR:ReactorFlowStopRunThe purpose of this table is to have one place to document changing flow rates.

Below is a sample of a filled in OFRReactorFlowTable :

• Entries in the first column must match reactor names as is given in the OFRReactorTable.

• The wave ReactorFlowDescription is for user’s edification only; entries in this wave are not used in calculations.

Page 7: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

7

Step 0. Review parameters: OFROxTable

The OFROxTable consists of these waves: root:OFR:OxNameroot:OFR:OxDescriptionroot:OFR:OxReactorIDroot:OFR:OxKeyWaveListroot:OFR:OxRunStartroot:OFR:OxRunStoproot:OFR:OxMeasPostReactor The purpose of this table is to have one place to document changing oxidation conditions.

Below is a sample of a filled in OFRReactorFlowTable :

Entries for the OxName must be Igor-friendly. Entries in the third column must match reactor names as is given in the

OFRReactorTable. Entries in the OxKeyWaveList must use names set by the user in the

OFRParameterTable. The wave OxDescription is for user’s edification only; entries in this wave are not used

in calculations.

Amber Ortega
We should give a description of how this OxKeyWaveList works ...
Donna Sueper
I want to punt.. my reply is that users should look at the existing softOH code and replicate. I'm afraid to go into syntax details here.
Page 8: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

8

Step 1. Validate settingsThis step checks and validates user entries.

It checks:• for the existence and consistent length of the time series and run series waves • all waves indicated by non numeric entries in the OFRParameterTable

It updates/ fill in the drop down menu above the step 3 gold button with all (unique) oxidant scheme names (i.e. hardOH, softOH, O3, NO3, etc)

It generates important key waves:• root:OFR:AmbKey consisting of 0s and 1s, when the measurement is ambient, bypassing

all reactors and chemical, physical manipulation of the signal before it reaches the detector

• root:OFR:Mask_Ox*_Reac* where Ox* is a string for each Oxidant name and Reac* is a string for each reactor. There will be (# reactors ) x (# unique oxidant names) such waves. In the example given here, these are root:OFR:Mask_HardOH_PAM, root:OFR:Mask_softOH_PAM.

It also sets the dimension labels of each row of the wave root:OFR:AmbParametersValueto the value given in root:OFR:AmbParametersDescription.

If a user changes any values within the any of the settings tables, the user needs to redo Step 1.

Amber Ortega
Example?
Donna Sueper
done
Page 9: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

9

Step 1: Validate settings: OFR_ReactorFlow_timeGraph

The purpose of the graphs optionally displayed in step 1 are to validate by visual inspection the sequence of OFR settings.

If no error messages pop up, two plots are available.

OFR_ReactorFlow_TimeGraph, or ‘Flow tseries’

This time series plot has (number of Reactors)-many y axes. One trace per reactor indicates the flow values as entered by the user in the OFRReactorFlowTable. For runs not indicated in the table the code performs a linear interpolation in time. Another trace per reactor indicates when the system was measuring through the reactor as indicated in the Reactor_key wave.

Page 10: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

10

If no error messages pop up, two plots are available.

OFR_OxLights_TimeGraph, or ‘Ox tseries’

This time series plot has (number of Oxidant schemes)-many vertical axes. One trace per oxidant scheme indicates when we were using this oxidant scheme as defined in the OFROxTable. Another trace per oxidant scheme indicates when the system was measuring through the reactor but in the “No Oxidant or NoOx” state; there is one such wave per reactor. This key wave is useful for when we want to compare the true ambient signal to the signal (“adjust to ambient”) when we measure through the reactor but do not add any oxidative influences to the sample.

Step 1: Validate settings:OFR_OxLights_TimeGraph

1.0

0.8

0.6

0.4

0.2

0.0Har

dOH

no

oxid

ant w

ave

6:00 AM6/11/2010

9:00 PM

1.0

0.8

0.6

0.4

0.2

0.0Sof

tOH

no

oxid

ant w

ave

Mask_HardOH_PAM NoOx_HardOH_PAM Mask_SoftOH_PAM NoOx_SoftOH_PAM

Page 11: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

11

Step 2. Generate adjusted to ambient OFR wave

Before pressing the gold “2. Adjust OFR..” button the user needs to input several parameters:• 2i. Result waves folder location A string containing the full path of a new or existing Igor data folder where all resulting waves will be located. • 2ii. Wave to analyze A string containing the full path of a wave containing the OFR-enhanced time series wave. This wave is typically generated from squirrel or Pika. Users are encouraged to use or rename this wave to contain few (10ish )characters. In the example that follows this wave will be named HROrg_PAM; the entry in the panel looks like “root: HROrg_PAM”.• 2iii. Optional wave containing only ambient measurementsIf this parameter is left blank, the code will look to the values in the wave indicated in 2ii and the ambient key wave root:OFR:ambKey to identify the true ambient measurements.The code will then extract these ambient measurements and create a wave containing only these measurements and fill in the name of this wave for future use. If this parameter is blank, then it assumes that wave entered in 2ii contains ambient measurements.

Users may want to supply their own ambient wave if they want to remove data spikes that may be in the original data or for any other reason. The code will automatically average the ambient wave entered in 2iii over the root:OFR:ambKey periods.

The first task that is done in the step 2 gold button calculation is the generation of the average ambient wave.

Amber Ortega
Need to word these two (2ii and 2iii) clearer ... if nothing is entered in 2iii, then the wave in 2ii needs to be ambient AND OFR.
Donna Sueper
better?
Page 12: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

12

Step 2. Generate adjusted to ambient OFR waveThe gold “2. Adjust OFR..” button performs the following calculations, mostly in the function named OFR_Adjust2Ambient :

Generates several waves with suffixes as listed in the initial comments of the tools ipf.Users are encourage to become familiar with these suffixes.

The wave *AmbAvg contains averages of ambient data; there is one value per contiguous ambient measurement.

The wave *AmbAvg Int contains interpolated values of *AmbAvg . Linear interpolation is performed with the x wave being the time series wave.

The wave *NoOxR contains ratios of OFR at no oxidant to Ambient The wave *NoOxD contains differences of OFR at no oxidant to Ambient The wave *NoOxRInt contains interpolated values of *NoOxR The wave *NoOxDInt contains interpolated values of *NoOxR The wave *AAD contains the Ox enhanced wave adjusted to ambient via difference The wave *AAR contains the Ox enhanced wave adjusted to ambient via ratio

By default the *AAR wave is input the parameter for step 3. Users must use their own judgment for cases when the ratio values vary too much due to low overall signal.

Note that the calculations are independent of an oxidant scheme. However, data is calculated at each oxidant scheme and interpolated across each scheme. This may result in step functions when switching between reactors, for example.

Page 13: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

13

Step 2. A2A* graph

The graph A2A_* is automatically generated and illustrates the calculated waves.For each oxidant scheme and each reactor, there will be plotted on the lower right axis the mask waves indicating the no-oxidant time periods. The graph below does not show typical conditions.

Page 14: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

14

Step 3. Calculate Ox-enhanced ratio, difference to ambient

It is at this point in the analysis that an oxidant needs to be selected in the popup menu “Consider this oxidant”. The gold “3. Calc ratio, ..” button performs calculations, mostly in the function named OFR_calc_ratioDiffToAmbient. The code generates several waves with suffixes as listed in the initial comments of the tools ipf.

The wave *Rat contains ratios of adjusted to ambient OFR to ambient The wave *Dif contains differences of adjusted to ambient OFR to ambient The wave *RatI contains interpolated values of *Rat The wave DifI contains interpolated values of *Dif

By default the *RatI and *DifI wave name is put into the parameter for step 4. As in the case of calculations done in step 2, data is calculated at for each reactor and each oxidant scheme.

Page 15: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

15

Step 3. RatDif* graph

The graph RatDif_* is automatically generated and illustrates the calculated waves.Again, these waves are specific to an oxidation scheme, such as hardOH. But this is only to “nan out” regions not in the oxidant scheme. The window name will contain as much of the name of the original wave to analyze (with suffixes) as is possible.

Page 16: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

16

Step 4. Calculate, plot quantiles of *Rat and *Dif waves

The main function that is called when this gold button is pressed is called OFR_CalcPlotQuantiles. Within this function the function OFR_Calc is called; within this function the photochemical age in days and exposure waves are calculated.

Within OFR_Calc two functions within the field ipf are called for each oxidant method:

OFR_CalcPrep_XXX where XXX is the oxidant method such as hardOH OFR_CalcOx_XXX where XXX is the oxidant method such as hardOH

OFR_CalcPrep_XXX requires two parameters and returns a wave of wave referencesHence, the function declaration can looks like

Function/wave OFR_CalcPrep_HardOH(num, Air_molec_cm3)variable numwave Air_molec_cm3

The main purpose of this function is to check the existence and length of waves needed for the oxidation calculation. This ‘prep’ function is only called once, at the beginning of OFR_Calc to prepare for all calculations to come. It does no ‘real’ work.

Within the OFR_Calc function the wave returned from OFR_CalcPrep_XXX is called ThisOxWaves and is used within the OFR_CalcOx_XXX function.

Page 17: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

17

Step 4. Calculate, plot quantiles of *Rat and *Dif waves

OFR_CalcOx_XXX requires several parameters; two of which, the Photochemical Age and the Oxidant Exposure waves will be filled in within this function. As an example, below is the function declaration for hardOH:

Function OFR_CalcOx_hardOH(ThisOxWaves, OxMask, OxKeyWaveList, reactor_resTime, flow, O3BackOfReactorWave, AmbO3Wave_molcm3, ExpResultWave, AgeResultWave)wave/wave ThisOxWaveswave OxMask, reactor_resTime, flow, O3BackOfReactorWave, AmbO3Wave_molcm3, ExpResultWave, AgeResultWavestring OxKeyWaveList

For each row in the Oxidant table the function OFR_CalcOx_XXX is called. This helps ensures that only the runs within each condition are analyzed separately.

It is the user’s responsibility that the calculations within each OFR_CalcOx_XXX function are correct.

Next, the code uses the user-settable parameters of # of quantiles, optional day/night separation and optional f(z) color scheme choice to calculate averages and the plots such as in slide 2. The data is actually plotted twice, once one bottom axis, a second on the top axis. This is to ensure that the plotted values are valid if the user modifies the top or bottom axis range.

Recall that the no-oxidant data is averaged into it’s own separate bin. The final graph will have (num of quantiles + 1) many averages displayed.

Page 18: OFR Calculator v 1.4H Donna Sueper Jimenez Group, CU Boulder, April 1, 2014 1

18

So what do I do?

The user is responsible for:

• Entering all necessary information into the OFR tables.

• Create/modify/append the function OFR_CalcPrep_XXX and OFR_CalcOx_XXX where XXX is each oxidant listed in the oxidant drop down menu.

• In all cases, users should follow the examples given herein and within the code to do the modifications.

How can I ensure that the data doesn’t perform an average over a time period where the there were interruptions? • If for example the system stopped and restarted in an ambient state but you don’t want

to average over the entire (single) ambient period, simply change your ambient key wave to include nans. For example change the value at the restarted run to be nan. The code looks for contiguous measurements when it does it’s averaging.