* Copyright (C) 2023 Dennis J. Darland * This file is part of Dennis J Darland's Glucose Prediction Software. * It is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with it. If not, see . &DUMP = 0 &TRACE = 0 TRACE('count') TRACE('order') TRACE('LINE') TRACE('T_ksteps') OUTPUT('out',3,128,'relate_several_cross_out3.txt') OUTPUT('out1',11,128,'relate1_steps_out3.txt') OUTPUT('out2',12,128,'relate2_fat_other_out3.txt') OUTPUT('out3',13,128,'relate3_carb_other_out3.txt') OUTPUT('out4',14,128,'relate4_protein_out3.txt') OUTPUT('out5',15,128,'relate5_fiber_out3.txt') OUTPUT('out6',16,128,'relate6_sugar_out3.txt') OUTPUT('out7',17,128,'relate7_saturated_out3.txt') OUTPUT('out8',18,128,'relate8_fasted_out3.txt') DEFINE('LPAD(S,N,C)') :(LPAD_END) LPAD LPAD = GE(SIZE(S),N) S :S(RETURN) C = IDENT(C) ' ' LPAD = DUPL(C, N - SIZE(S)) S :(RETURN) LPAD_END count = 0 echo = 0 digits = '0123456789.-' T_ksteps = 0.0 T_fat_other = 0.0 T_carb_other = 0.0 T_protein = 0.0 T_fiber = 0.0 T_sugar = 0.0 T_saturated = 0.0 T_fasted = 0.0 * T_metabolism = 0.0 T2_ksteps = 0.0 T2_fat_other = 0.0 T2_carb_other = 0.0 T2_protein = 0.0 T2_fiber = 0.0 T2_sugar = 0.0 T2_saturated = 0.0 T2_ksteps_fat_other = 0.0 T2_carb_other_fat_other = 0.0 T2_protein_fat_other = 0.0 T2_fiber_fat_other = 0.0 T2_sugar_fat_other = 0.0 T2_saturated_fat_other = 0.0 T2_ksteps_carb_other = 0.0 T2_protein_carb_other = 0.0 T2_fiber_carb_other = 0.0 T2_sugar_carb_other = 0.0 T2_saturated_carb_other = 0.0 T2_ksteps_protein = 0.0 T2_fiber_protein = 0.0 T2_sugar_protein = 0.0 T2_saturated_protein = 0.0 T2_ksteps_fiber = 0.0 T2_sugar_fiber = 0.0 T2_saturated_fiber = 0.0 T2_ksteps_sugar = 0.0 T2_saturated_sugar = 0.0 T2_ksteps_saturated = 0.0 * T2_metabolism = 0.0 INPUT('recommended',2,128,'recommended.txt') recommended_ksteps = recommended kstep_exponent = recommended kstep_factor = recommended recommended_fat = recommended recommended_carb = recommended recommended_prot = recommended recommended_fiber = recommended recommended_sugar = recommended recommended_saturated = recommended delta_method = recommended kstep_method = recommended order = recommended factor1 = recommended factor2 = recommended result_file = recommended recommended_fasted = recommended use_prior = recommended fasted_factor = recommended eliminate_extremes = recommended recommended_carb_other = recommended_carb - recommended_fiber - recommended_sugar recommended_fat_other = recommended_fat - recommended_saturated OUTPUT('results_cross',2,128,result_file) DEFINE('getit(str)','getitentry') DEFINE('left(str,le)','leftentry') TOP line = INPUT :f(FINAL) OUTPUT = "DOING BLOCK 1 & 2 A" C_ksteps = getit("C_ksteps") out1 = lpad(C_ksteps, 26, ' ') C_fat_other = getit("C_fat_other") out2 = lpad(C_fat_other, 26, ' ') C_carb_other = getit("C_carb_other") out3 = lpad(C_carb_other, 26, ' ') C_protein = getit("C_protein") out4 = lpad(C_protein, 26, ' ') C_fiber = getit("C_fiber") out5 = lpad(C_fiber, 26, ' ') C_sugar = getit("C_sugar") out6 = lpad(C_sugar, 26, ' ') C_saturated = getit("C_saturated") out7 = lpad(C_saturated, 26, ' ') C_fasted = getit("C_fasted") out8 = lpad(C_fasted, 26, ' ') * C_metabolism = getit("C_metabolism") LE(order,1) :s(DO_1A) OUTPUT = "DOING BLOCK 2 A" C2_ksteps = getit("C2_ksteps") C2_fat_other = getit("C2_fat_other") C2_carb_other = getit("C2_carb_other") C2_protein = getit("C2_protein") C2_fiber = getit("C2_fiber") C2_sugar = getit("C2_sugar") C2_saturated = getit("C2_saturated") LE(order,2) :s(DO_1A) C2_ksteps_fat_other = getit("C2_ksteps_fat_other") C2_carb_other_fat_other = getit("C2_carb_other_fat_other") C2_protein_fat_other = getit("C2_protein_fat_other") C2_fiber_fat_other = getit("C2_fiber_fat_other") C2_sugar_fat_other = getit("C2_sugar_fat_other") C2_saturated_fat_other = getit("C2_saturated_fat_other") C2_ksteps_carb_other = getit("C2_ksteps_carb_other") C2_protein_carb_other = getit("C2_protein_carb_other") C2_fiber_carb_other = getit("C2_fiber_carb_other") C2_sugar_carb_other = getit("C2_sugar_carb_other") C2_saturated_carb_other = getit("C2_saturated_carb_other") C2_ksteps_protein = getit("C2_ksteps_protein") C2_fiber_protein = getit("C2_fiber_protein") C2_sugar_protein = getit("C2_sugar_protein") C2_saturated_protein = getit("C2_saturated_protein") C2_ksteps_fiber = getit("C2_ksteps_fiber") C2_sugar_fiber = getit("C2_sugar_fiber") C2_saturated_fiber = getit("C2_saturated_fiber") C2_ksteps_sugar = getit("C2_ksteps_sugar") C2_saturated_sugar = getit("C2_saturated_sugar") C2_ksteps_saturated = getit("C2_ksteps_saturated") DO_1A OUTPUT = "DOING BLOCK 1 & 2 B" OUT = "--------------------------" OUT = "First Order Coefficients" OUT = "--------------------------" OUT = "Ksteps = " C_ksteps OUT = "fat other = " C_fat_other OUT = "carb_other = " C_carb_other OUT = "protein = " C_protein OUT = "fiber = " C_fiber OUT = "sugar = " C_sugar OUT = "saturated = " C_saturated OUT = "fasted = " C_fasted * OUT = "metabolism = " C_metabolism LE(order,1) :s(do_1B) OUTPUT = "DOING BLOCK 2A" OUT = "--------------------------" OUT = "Second Order Coefficients" OUT = "--------------------------" OUT = "Ksteps = " C2_ksteps OUT = "fat_other = " C2_fat_other OUT = "carb_other = " C2_carb_other OUT = "protein = " C2_protein OUT = "fiber = " C2_fiber OUT = "sugar = " C2_sugar OUT = "saturated = " C2_saturated LE(order,2) :s(do_1B) OUT = "Ksteps_fat_other = " C2_ksteps_fat_other OUT = "carb_other_fat_other = " C2_carb_other_fat_other OUT = "protein_fat_other = " C2_protein_fat_other OUT = "fiber_fat_other = " C2_fiber_fat_other OUT = "sugar_fat_other = " C2_sugar_fat_other OUT = "saturated_fat_other = " C2_saturated_fat_other OUT = "Ksteps_carb_other = " C2_ksteps_carb_other OUT = "protein_carb_other = " C2_protein_carb_other OUT = "fiber_carb_other = " C2_fiber_carb_other OUT = "sugar_carb_other = " C2_sugar_carb_other OUT = "saturated_carb_other = " C2_saturated_carb_other OUT = "Ksteps_protein = " C2_ksteps_protein OUT = "fiber_protein = " C2_fiber_protein OUT = "sugar_protein = " C2_sugar_protein OUT = "saturated_protein = " C2_saturated_protein OUT = "Ksteps_fiber = " C2_ksteps_fiber OUT = "sugar_fiber = " C2_sugar_fiber OUT = "saturated_fiber = " C2_saturated_fiber OUT = "Ksteps_sugar = " C2_ksteps_sugar OUT = "saturated_sugar = " C2_saturated_sugar OUT = "Ksteps_saturated = " C2_ksteps_saturated do_1B OUTPUT = "DOING BLOCK 1 & 2 B" OUTPUT = T_ksteps OUTPUT = C_ksteps T_ksteps = T_ksteps + C_ksteps T_fat_other = T_fat_other + C_fat_other T_carb_other = T_carb_other + C_carb_other T_protein = T_protein + C_protein T_fiber = T_Fiber + C_fiber T_sugar = T_sugar + C_sugar T_saturated = T_saturated + C_saturated T_fasted = T_fasted + C_fasted * T_metabolism = T_metabolism + C_metabolism LE(order,1) :s(DO_1C) OUTPUT = "DOING BLOCK 2C" T2_ksteps = T2_ksteps + C2_ksteps T2_fat_other = T2_fat_other + C2_fat_other T2_carb_other = T2_carb_other + C2_carb_other T2_protein = T2_protein + C2_protein T2_fiber = T2_Fiber + C2_fiber T2_sugar = T2_sugar + C2_sugar T2_saturated = T2_saturated + C2_saturated LE(order,2) :s(DO_1C) T2_ksteps_fat_other = T2_ksteps_fat_other + C2_ksteps_fat_other T2_carb_other_fat_other = T2_carb_other_fat_other + C2_carb_other_fat_other T2_protein_fat_other = T2_protein_fat_other + C2_protein_fat_other T2_fiber_fat_other = T2_Fiber_fat_other + C2_fiber_fat_other T2_sugar_fat_other = T2_sugar_fat_other + C2_sugar_fat_other T2_saturated_fat_other = T2_saturated_fat_other + C2_saturated_fat_other T2_ksteps_carb_other = T2_ksteps_carb_other + C2_ksteps_carb_other T2_protein_carb_other = T2_protein_carb_other + C2_protein_carb_other T2_fiber_carb_other = T2_Fiber_carb_other + C2_fiber_carb_other T2_sugar_carb_other = T2_sugar_carb_other + C2_sugar_carb_other T2_saturated_carb_other = T2_saturated_carb_other + C2_saturated_carb_other T2_ksteps_protein = T2_ksteps_protein + C2_ksteps_protein T2_fiber_protein = T2_Fiber_protein + C2_fiber_protein T2_sugar_protein = T2_sugar_protein + C2_sugar_protein T2_saturated_protein = T2_saturated_protein + C2_saturated_protein T2_ksteps_fiber = T2_ksteps_fiber + C2_ksteps_fiber T2_sugar_fiber = T2_sugar_fiber + C2_sugar_fiber T2_saturated_fiber = T2_saturated_fiber + C2_saturated_fiber T2_ksteps_sugar = T2_ksteps_sugar + C2_ksteps_sugar T2_saturated_sugar = T2_saturated_sugar + C2_saturated_sugar T2_ksteps_saturated = T2_ksteps_saturated + C2_ksteps_saturated T2_fasted = T2_fasted + C2_fasted * T2_metabolism = T2_metabolism + C2_metabolism DO_1C OUTPUT = "BOTTOM LOOP" count = count + 1 :(TOP) getitentry * OUT = "HERE line = " line * OUT = "HERE2 str = " str line ARB str ' = ' SPAN(digits) . getit ARB :f(retry)s(RETURN) retry line = INPUT :s(getitentry)f(FINAL) leftentry str = str + 0.000001 str FENCE len(le) . left_wrk left = ' ' left_wrk ' ' :(RETURN) FINAL OUTPUT = "order = " order OUTPUT = "T_ksteps = " T_ksteps OUTPUT = "count = " count T_ksteps = T_ksteps / count T_fat_other = T_fat_other / count T_carb_other = T_carb_other / count T_protein = T_protein / count T_fiber = T_fiber / count T_sugar = T_sugar / count T_saturated = T_saturated / count T_fasted = T_fasted / count * T_metabolism = T_metabolism / count LT(order,1) :s(DO_1D) T2_ksteps = T2_ksteps / count T2_fat_other = T2_fat_other / count T2_carb_other = T2_carb_other / count T2_protein = T2_protein / count T2_fiber = T2_fiber / count T2_sugar = T2_sugar / count T2_saturated = T2_saturated / count LT(order,2) :s(DO_1D) T2_ksteps_fat_other = T2_ksteps_fat_other / count T2_carb_other_fat_other = T2_carb_other_fat_other / count T2_protein_fat_other = T2_protein_fat_other / count T2_fiber_fat_other = T2_Fiber_fat_other / count T2_sugar_fat_other = T2_sugar_fat_other / count T2_saturated_fat_other = T2_saturated_fat_other / count T2_ksteps_carb_other = T2_ksteps_carb_other / count T2_protein_carb_other = T2_protein_carb_other / count T2_fiber_carb_other = T2_Fiber_carb_other / count T2_sugar_carb_other = T2_sugar_carb_other / count T2_saturated_carb_other = T2_saturated_carb_other / count T2_ksteps_protein = T2_ksteps_protein / count T2_fiber_protein = T2_Fiber_protein / count T2_sugar_protein = T2_sugar_protein / count T2_saturated_protein = T2_saturated_protein / count T2_ksteps_fiber = T2_ksteps_fiber / count T2_sugar_fiber = T2_sugar_fiber / count T2_saturated_fiber = T2_saturated_fiber / count T2_ksteps_sugar = T2_ksteps_sugar / count T2_saturated_sugar = T2_saturated_sugar / count T2_ksteps_saturated = T2_ksteps_saturated / count DO_1D OUT = "--------------------------" OUT = "Averages Follow" OUT = "--------------------------" OUT = "First Order Coefficients" OUT = "--------------------------" OUT = "Ksteps = " T_ksteps OUT = "fat other = " T_fat_other OUT = "carb_other = " T_carb_other OUT = "protein = " T_protein OUT = "fiber = " T_fiber OUT = "sugar = " T_sugar OUT = "saturated = " T_saturated OUT = "fasted = " T_fasted * OUT = "metabolism = " T_metabolism LE(order,1) :s(DO_1E) OUT = "--------------------------" OUT = "Second Order Coefficients" OUT = "--------------------------" OUT = "Ksteps = " T2_ksteps OUT = "fat_other = " T2_fat_other OUT = "carb_other = " T2_carb_other OUT = "protein = " T2_protein OUT = "fiber = " T2_fiber OUT = "sugar = " T2_sugar OUT = "saturated = " T2_saturated LE(order,2) :s(DO_1E) OUT = "Ksteps_fat_other = " T2_ksteps_fat_other OUT = "carb_other_fat_other = " T2_carb_other_fat_other OUT = "protein_fat_other = " T2_protein_fat_other OUT = "fiber_fat_other = " T2_fibe_fat_other OUT = "sugar_fat_other = " T2_sugar_fat_other OUT = "saturated_fat_other = " T2_saturated_fat_other OUT = "Ksteps_carb_other = " T2_ksteps_carb_other OUT = "protein_carb_other = " T2_protein_carb_other OUT = "fiber_carb_other = " T2_fiber_carb_other OUT = "sugar_carb_other = " T2_sugar_carb_other OUT = "saturated_carb_other = " T2_saturated_carb_other OUT = "Ksteps_protein = " T2_ksteps_protein OUT = "fiber_protein = " T2_fiber_protein OUT = "sugar_protein = " T2_sugar_protein OUT = "saturated_protein = " T2_saturated_protein OUT = "Ksteps_fiber = " T2_ksteps_fiber OUT = "sugar_fiber = " T2_sugar_fiber OUT = "saturated_fiber = " T2_saturated_fiber OUT = "Ksteps_sugar = " T2_ksteps_sugar OUT = "saturated_sugar = " T2_saturated_sugar OUT = "Ksteps_saturated = " T2_ksteps_saturated DO_1E results_cross = T_ksteps results_cross = T_fat_other results_cross = T_carb_other results_cross = T_protein results_cross = T_fiber results_cross = T_sugar results_cross = T_saturated results_cross = T_fasted * results_cross = T_metabolism LE(order,1) :s(END) results_cross = T2_ksteps results_cross = T2_fat_other results_cross = T2_carb_other results_cross = T2_protein results_cross = T2_fiber results_cross = T2_sugar results_cross = T2_saturated results_cross = T2_fasted * results_cross = T2_metabolism LE(order,2) :s(END) results_cross = T2_ksteps_fat_other results_cross = T2_carb_other_fat_other results_cross = T2_protein_fat_other results_cross = T2_fiber_fat_other results_cross = T2_sugar_fat_other results_cross = T2_saturated_fat_other results_cross = T2_ksteps_carb_other results_cross = T2_protein_carb_other results_cross = T2_fiber_carb_other results_cross = T2_sugar_carb_other results_cross = T2_saturated_carb_other results_cross = T2_ksteps_protein results_cross = T2_fiber_protein results_cross = T2_sugar_protein results_cross = T2_saturated_protein results_cross = T2_ksteps_fiber results_cross = T2_sugar_fiber results_cross = T2_saturated_fiber results_cross = T2_ksteps_sugar results_cross = T2_saturated_sugar results_cross = T2_ksteps_saturated :(END) err OUT = "ERROR" OUT = "HERE line = " line OUT = "HERE2 str = " str END