I'm analyzing some data in python. I have stumbled across unusual problem:

I have the function...

def fun1(params_used_below_except_lk_and_lk2):
    lk = 0.0
    lk2 = 0.0
    for raw_data, hist, freq in raw_data_hist_list:
        lk2 = lk2 + fun2(some_constants_and_params_from_this_scope)
        q = fun2(same_args_as_before)
        lk = lk + q
    print lk, lk2

For some set of input parameters, This function with specific input 
prints out the same constant twice (as expected):

15377.7424582 15377.7424582 (twice the same value)

If I comment out lines q = fun2.... and lk = lk + q, fun1, with the same 
parameters, prints:

0.0 3.3469936856

First value is expected, but I cannot understand how come the second 
value is different in these two cases!

Thanks in advance! 


fun1 source:

def process_measurements_beta_lk(x, raw_data_hist_list):
    lk = 0.0
    lk2 = 0.0
    (p,q,loc,scale) = x
    for raw_data, hist, freq in raw_data_hist_list:
        lk2 =   lk2 + get_beta_func_fit_quality_hist_lk('beta',
(p,q,loc,scale), raw_data, hist)
#        q = get_beta_func_fit_quality_hist_lk('beta',(p,q,loc,scale), 
raw_data, hist)
#       lk = lk + q
                                                                                
                  
    print lk, lk2
    retrun lk






-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to