[macro 1] 'Rogers for University of Massachusetts, Amherst 'Based on macro used in Colella et al., 2021 (https://github.com/jpcolella/peer_respo/blob/main/VO2-VCO2-H2O-120sec_per_cage.txt) 'This macro assumes that there is a criterion channel. 'This macro goes up to calculation of VO2, VCO2, VH2O and saves a modified file. ' Macro for FMS with multiple SS-4 and single multiplexed flow channel. Using equations for pull system. Baseline is marker B, Muliplexer chamber 8. 'This macro assumes that there is a criterion channel. 'This macro goes up to calculation of VO2, VCO2, VH2O and saves a modified file. '60 seconds per chamber active channel CO2_PPM correct lag all_samples shift 5 active channel H2O_ppt correct lag all_samples shift 5 active channel Percent_O2 correct lag all_samples shift 7 transform z_transform all_samples z 0.17 active channel Flow_Rate correction smooth_nearest_neighbor all_samples width 5 repeat 1 transform general all_samples expression FeO2=Percent_O2/100 transform general all_samples expression FeCO2=CO2_PPM/1000000 transform general all_samples expression FeH2O=H2O_ppt/1000 transform general all_samples expression FepO2=FeO2/(1-FeH2O) transform general all_samples expression FepCO2=FeCO2 transform general all_samples expression corr_fac_1=1-FeH2O transform general all_samples expression FRdry = Flow_Rate/(1-FeH2O) 'Baseline all of the fractional concentrations active channel FepO2 make_temp_data_copy all_samples correction baseline_single_markers all_samples marker B average_left samples 30 search_type level search_percent 50 catmull_rom copy_only extrapolate_none span_value 0.2095 grr overwrite_data_with_copy all_samples 'add delta o2 create channel assign title last_channel = delta_O2 active channel delta_O2 make_temp_data_copy all_samples correction baseline_single_markers all_samples marker B average_left samples 30 search_type level search_percent 50 catmull_rom copy_only extrapolate_none grr overwrite_data_with_copy all_samples transform linear all_samples slope -1 intercept 0 'Create an FiCO2 channel from the baseline sections with the interpolated channel tool. active channel FepCO2 create interpolated_channel source_channel FepCO2 destination_channel FiCO2 value_channel Resp_channel = 7 selection Most_level percent 50 interpolation Catmull_Rom_spline 'Copy CO2dry to a new channel and create delta CO2 active channel FepCO2 create channel assign title last_channel = deltaCO2 active channel deltaCO2 make_temp_data_copy all_samples correction baseline_single_markers all_samples marker B average_left samples 30 search_type level search_percent 50 catmull_rom copy_only extrapolate_none grr overwrite_data_with_copy all_samples 'Create an FiH2O channel with the interpolated channel tool active channel FeH2O create interpolated_channel source_channel FeH2O destination_channel FiH2O value_channel Resp_channel = 7 selection Most_level percent 50 interpolation Catmull_Rom_spline 'Copy FeH2O to a new channel and create deltaH2O active channel FeH2O create channel assign title last_channel = deltaH2O active channel deltaH2O make_temp_data_copy all_samples correction baseline_single_markers all_samples marker B average_left samples 30 search_type level search_percent 50 catmull_rom copy_only extrapolate_none grr overwrite_data_with_copy all_samples 'Now calculate VO2, VCO2 and VH2O according to equations in Lighton 2008 11.7, 11.8, 11.9 transform general all_samples expression VO2 = FRdry*(delta_O2-deltaCO2*0.2095)/(1-0.2095) transform general all_samples expression VCO2 = FRdry*(deltaCO2 + delta_O2*FiCO2)/(1+FiCO2) transform general all_samples expression Vh2Oml = FRdry*deltaH2O/(1-FiH2O) transform general all_samples expression VH2O = 0.803*FRdry*deltaH2O/(1-FiH2O) transform general all_samples expression RQ=VCO2/VO2 'Save the calculations to a new file with prefix Mod- 'save all_samples prefix mod- 'extract data for {n} = 1 to 7 active channel VO2 if exists_marker {n} then select marker_anchor {n} 60 samples left search_all_samples findwindow level selected width 15 select selectedwindow selected getstats mean writestats FileName to spreadsheet assign column_title filename write_string chamber {n} 'write_string ch{n} search_num_right ch{n} to spreadsheet 'assign column_title Bird_ID writestats StartTime to spreadsheet assign column_title StartTime writestats StartDate to spreadsheet assign column_title StartDate writestats StartSample to spreadsheet assign column_title StartSample writestats Mean to spreadsheet assign column_title mean_VO2 'active channel Temp1 'getstats mean 'writestats Mean to spreadsheet 'assign column_title mean_temp active channel VCO2 getstats mean writestats Mean to spreadsheet assign column_title mean_VCO2 active channel VH2O getstats mean writestats Mean to spreadsheet assign column_title mean_VH2O active channel RQ getstats mean writestats Mean to spreadsheet assign column_title mean_RQ active channel corr_fac_1 getstats mean writestats Mean to spreadsheet assign column_title corr_fac_1 writestats newline to spreadsheet for more marker {n} select marker_anchor {n} 60 samples right search_from_selected select marker_anchor {n} 60 samples left search_from_selected active channel VO2 findwindow level selected width 15 select selectedwindow selected getstats mean writestats FileName to spreadsheet assign column_title filename write_string chamber {n} 'write_string ch{n} search_num_right ch{n} to spreadsheet 'assign column_title Bird_ID writestats StartTime to spreadsheet assign column_title StartTime writestats StartDate to spreadsheet assign column_title StartDate writestats StartSample to spreadsheet assign column_title StartSample writestats Mean to spreadsheet assign column_title mean_VO2 active channel VCO2 getstats mean writestats Mean to spreadsheet assign column_title mean_VCO2 'active channel Temp1 'getstats mean 'writestats Mean to spreadsheet 'assign column_title mean_Temp active channel VH2O getstats mean writestats Mean to spreadsheet assign column_title mean_VH2O active channel RQ getstats mean writestats Mean to spreadsheet assign column_title mean_RQ active channel corr_fac_1 getstats mean writestats Mean to spreadsheet assign column_title corr_fac_1 writestats newline to spreadsheet next marker endif next {n} [/macro 1]