Get the code (version 2010)

IDL   download calc_kcor.pro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;    K-corrections calculator in IDL. See http://kcor.sai.msu.ru for the 
;    reference. Available filter-colour combinations must be present in the
;    keys of the 'coeff' structure.
;
;    INPUT
;         filter_name  - name of the bandpass (string).
;                        At present, SDSS (ugriz), UKIRT WFCAM (YJHK), 
;                        Johnson-Cousins (UBVRcIc), and 2MASS (J2H2Ks2) 
;                        are supported
;         redshift     - redfshift of a galaxy (floating point)
;         colour_name  - colour identification (string)
;         colour_value - value of colour in magnitudes (floating point)
;                        should be in the AB mags for ugrizYJHK 
;                        and in Vega mags for Johnson-Cousins/2MASS colours
;
;    RETURN VALUE:  K-correction in the specified filter for given redshift  
;                        and colour values (floating point)
;
;    EXAMPLES OF USAGE:
;    IDL> print,calc_kcor('g',0.15,'g - r',1.1)
;         0.481612
;    IDL> print,calc_kcor('B',0.2,'B - Rc',1.4)
;         0.618700
;    
;    AUTHORS: Chilingarian, I., Melchior. A.-L., and Zolotukhin, I. (c) 2010
;    LICENSE: Simplified BSD license, see http://kcor.sai.msu.ru/license.txt
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

function calc_kcor, filter_name, redshift, colour_name, colour_value

    coeff = {$
        B_BRc:[$
            [0,0,0,0],$
            [-1.99412,3.45377,0.818214,-0.630543],$
            [15.9592,-3.99873,6.44175,0.828667],$
            [-101.876,-44.4243,-12.6224,0],$
            [299.29,86.789,0,0],$
            [-304.526,0,0,0]$
        ],$
        H2_H2Ks2:[$
            [0,0,0,0],$
            [-1.88351,1.19742,10.0062,-18.0133],$
            [11.1068,20.6816,-16.6483,139.907],$
            [-79.1256,-406.065,-48.6619,-430.432],$
            [551.385,1453.82,354.176,473.859],$
            [-1728.49,-1785.33,-705.044,0],$
            [2027.48,950.465,0,0],$
            [-741.198,0,0,0]$
        ],$
        H2_J2H2:[$
            [0,0,0,0],$
            [-4.99539,5.79815,4.19097,-7.36237],$
            [70.4664,-202.698,244.798,-65.7179],$
            [-142.831,553.379,-1247.8,574.124],$
            [-414.164,1206.23,467.602,-799.626],$
            [763.857,-2270.69,1845.38,0],$
            [-563.812,-1227.82,0,0],$
            [1392.67,0,0,0]$
        ],$
        H_HK:[$
            [0,0,0,0],$
            [-0.87512,-2.72791,-17.6307,-17.3916],$
            [31.4138,111.592,200.198,131.142],$
            [-324.271,-788.024,-714.143,-392.762],$
            [1352.22,2204.45,1055.26,424.915],$
            [-2703.7,-2572,-641.976,0],$
            [2491.12,995.135,0,0],$
            [-783.755,0,0,0]$
        ],$
        H_JH:[$
            [0,0,0,0],$
            [-1.78842,3.95359,-4.93259,-8.37687],$
            [19.1586,-0.700536,99.4518,-35.4881],$
            [-95.0735,-256.834,-188.045,419.65],$
            [202.148,943.972,-873.02,-600.689],$
            [17.4164,-341.246,1673.54,0],$
            [-927.944,-1024.17,0,0],$
            [1121.11,0,0,0]$
        ],$
        Ic_VIc:[$
            [0,0,0,0],$
            [-7.92467,17.6389,-15.2414,5.12562],$
            [15.7555,-1.99263,10.663,-10.8329],$
            [-88.0145,-42.9575,46.7401,0],$
            [266.377,-67.5785,0,0],$
            [-164.217,0,0,0]$
        ],$
        J2_J2Ks2:[$
            [0,0,0,0],$
            [-2.85079,1.7402,0.754404,-0.41967],$
            [24.1679,-34.9114,11.6095,0.691538],$
            [-32.3501,59.9733,-29.6886,0],$
            [-30.2249,43.3261,0,0],$
            [-36.8587,0,0,0]$
        ],$
        J2_J2H2:[$
            [0,0,0,0],$
            [-0.905709,-4.17058,11.5452,-7.7345],$
            [5.38206,-6.73039,-5.94359,20.5753],$
            [-5.99575,32.9624,-72.08,0],$
            [-19.9099,92.1681,0,0],$
            [-45.7148,0,0,0]$
        ],$
        J_JK:[$
            [0,0,0,0],$
            [-0.748177,2.44544,-0.785813,-0.611364],$
            [1.10982,-13.8174,16.6888,1.06015],$
            [-0.89512,12.109,-35.2342,0],$
            [10.3783,34.8843,0,0],$
            [-33.2195,0,0,0]$
        ],$
        J_JH:[$
            [0,0,0,0],$
            [-1.06673,1.73114,-0.672799,-7.63872],$
            [3.07102,3.07554,26.2735,18.4105],$
            [-10.9191,-41.8091,-66.1621,0],$
            [40.8958,88.2172,0,0],$
            [-58.7677,0,0,0]$
        ],$
        Ks2_J2Ks2:[$
            [0,0,0,0],$
            [-5.08065,-0.15919,4.15442,-0.794224],$
            [62.8862,-61.9293,-2.11406,1.56637],$
            [-191.117,212.626,-15.1137,0],$
            [116.797,-151.833,0,0],$
            [41.4071,0,0,0]$
        ],$
        Ks2_H2Ks2:[$
            [0,0,0,0],$
            [-3.90879,5.05938,10.5434,-10.9614],$
            [23.6036,-97.0952,14.0686,28.994],$
            [-44.4514,266.242,-108.639,0],$
            [-15.8337,-117.61,0,0],$
            [28.3737,0,0,0]$
        ],$
        K_JK:[$
            [0,0,0,0],$
            [-2.79151,4.08684,1.8311,-1.16444],$
            [12.9577,-41.0232,2.88049,2.64813],$
            [-64.5644,114.188,-16.5243,0],$
            [132.091,-84.5005,0,0],$
            [-95.1022,0,0,0]$
        ],$
        K_HK:[$
            [0,0,0,0],$
            [-1.31705,5.57641,-4.86809,-9.34749],$
            [-2.85707,-42.3794,47.2056,24.9617],$
            [-7.17652,100.163,-89.0219,0],$
            [56.7029,-66.4791,0,0],$
            [-61.2373,0,0,0]$
        ],$
        
        Rc_BRc:[$
            [0,0,0,0],$
            [-2.83216,4.64989,-2.86494,0.90422],$
            [4.97464,5.34587,0.408024,-2.47204],$
            [-57.3361,-30.3302,18.4741,0],$
            [224.219,-19.3575,0,0],$
            [-194.829,0,0,0]$
        ],$
        U_URc:[$
            [0,0,0,0],$
            [2.84791,2.31564,-0.411492,-0.0362256],$
            [-18.8238,13.2852,6.74212,-2.16222],$
            [-307.885,-124.303,-9.92117,12.7453],$
            [3040.57,428.811,-124.492,-14.3232],$
            [-10677.7,-39.2842,197.445,0],$
            [16022.4,-641.309,0,0],$
            [-8586.18,0,0,0]$
        ],$
        V_VIc:[$
            [0,0,0,0],$
            [-1.37734,-1.3982,4.76093,-1.59598],$
            [19.0533,-17.9194,8.32856,0.622176],$
            [-86.9899,-13.6809,-9.25747,0],$
            [305.09,39.4246,0,0],$
            [-324.357,0,0,0]$
        ],$
        V_VRc:[$
            [0,0,0,0],$
            [-2.21628,8.32648,-7.8023,9.53426],$
            [13.136,-1.18745,3.66083,-41.3694],$
            [-117.152,-28.1502,116.992,0],$
            [365.049,-93.68,0,0],$
            [-298.582,0,0,0]$
        ],$
        Y_YH:[$
            [0,0,0,0],$
            [-1.92818,2.26887,6.18075,-4.7355],$
            [13.4865,-7.53789,-10.7556,13.6548],$
            [-47.959,7.80791,-17.2056,0],$
            [86.8046,20.9729,0,0],$
            [-67.9877,0,0,0]$
        ],$
        Y_YK:[$
            [0,0,0,0],$
            [-0.766345,3.06682,0.771616,-2.59031],$
            [4.16016,0.0879331,12.9685,6.70949],$
            [-45.3704,-62.3077,-35.9553,0],$
            [177.731,120.196,0,0],$
            [-210.145,0,0,0]$
        ],$
        g_gr:[$
            [0,0,0,0],$
            [-0.804947,3.32028,1.8793,-1.49],$
            [5.32498,-10.753,8.16366,1.89345],$
            [-20.3373,-7.42978,-19.021,0],$
            [62.8153,47.4034,0,0],$
            [-79.5544,0,0,0]$
        ],$
        g_gi:[$
            [0,0,0,0],$
            [-0.545947,0.299034,3.98684,-1.80155],$
            [6.38878,-20.5413,10.0568,2.99832],$
            [22.9318,-10.4281,-30.279,0],$
            [-21.4324,98.0747,0,0],$
            [-86.8239,0,0,0]$
        ],$
        g_gz:[$
            [0,0,0,0],$
            [0.375663,-1.5098,3.98319,-1.43652],$
            [3.50825,-16.9043,7.97596,2.55763],$
            [45.0561,-15.9583,-28.1667,0],$
            [-64.5893,109.974,0,0],$
            [-79.4649,0,0,0]$
        ],$
        i_gi:[$
            [0,0,0,0],$
            [-2.40717,4.72555,-3.72005,1.47911],$
            [10.8559,5.13437,-1.99939,-3.5971],$
            [-93.6061,-17.5939,26.5366,0],$
            [290.009,-46.9939,0,0],$
            [-230.77,0,0,0]$
        ],$
        i_ui:[$
            [0,0,0,0],$
            [-2.59334,1.58474,-0.212443,0.00262402],$
            [18.3125,-4.88146,0.767957,0.0123197],$
            [-72.5586,1.37633,-1.33158,0],$
            [185.168,11.5798,0,0],$
            [-196.516,0,0,0]$
        ],$
        r_gr:[$
            [0,0,0,0],$
            [-1.61166,3.87173,-3.87312,2.66605],$
            [8.48781,13.2126,-6.4946,-7.31552],$
            [-87.2971,-35.0474,41.5335,0],$
            [271.64,-26.9081,0,0],$
            [-232.289,0,0,0]$
        ],$
        r_ur:[$
            [0,0,0,0],$
            [-1.98173,1.04346,0.0221613,-0.0391318],$
            [9.34198,1.639,-0.392805,0.192349],$
            [-39.8237,-10.3007,-1.9142,0],$
            [123.94,25.7117,0,0],$
            [-150.964,0,0,0]$
        ],$
        u_ur:[$
            [0,0,0,0],$
            [1.54907,2.33077,0.0863027,-0.129934],$
            [-67.2858,19.6834,-3.48982,0.769095],$
            [227.169,-41.4199,-4.31236,0],$
            [-233.872,62.8703,0,0],$
            [-18.0493,0,0,0]$
        ],$
        u_ui:[$
            [0,0,0,0],$
            [1.51973,1.62087,0.314757,-0.118175],$
            [-65.2593,17.0211,-3.42331,0.641827],$
            [200.74,-20.6839,-5.00841,0],$
            [-236.018,52.3746,0,0],$
            [-9.91078,0,0,0]$
        ],$
        u_uz:[$
            [0,0,0,0],$
            [3.23407,0.119541,0.549622,-0.101494],$
            [-73.6664,23.7596,-4.88373,0.575285],$
            [180.924,-14.7506,-3.00815,0],$
            [-217.452,33.4529,0,0],$
            [23.5401,0,0,0]$
        ],$
        z_rz:[$
            [0,0,0,0],$
            [-1.68992,3.2247,0.494208,0.425893],$
            [15.0417,-21.8675,-4.54296,1.37908],$
            [-44.522,76.0708,-6.46192,0],$
            [18.0191,-56.9078,0,0],$
            [24.2478,0,0,0]$
        ],$
        z_gz:[$
            [0,0,0,0],$
            [-3.49804,6.15684,-4.02179,1.26893],$
            [12.7541,-1.49658,-2.47768,-2.55071],$
            [-60.2735,20.8725,21.5907,0],$
            [77.1165,-85.6706,0,0],$
            [38.401,0,0,0]$
        ],$
        z_uz:[$
            [0,0,0,0],$
            [-3.51099,2.17402,-0.332435,0.0209126],$
            [24.2976,-9.79764,1.05165,-0.0449372],$
            [-52.4363,13.9363,-0.864778,0],$
            [52.5216,-3.16925,0,0],$
            [-38.931,0,0,0]$
        ]$
    }

    tags = tag_names(coeff)
    tag_col = strupcase(filter_name+'_'+strcompress(strjoin(strsplit(colour_name,'-',/extr)),/remove_all))

    cidx = where(tags eq tag_col, ccnt)
    if(ccnt ne 1 or redshift ge 0.5) then begin
        message,'Fitting function not found or redshift is out of range',/inf
        return,!values.f_nan
    endif
    c=coeff.(cidx)
    s_c = size(c)

    kcor=0.0

    for i=0, s_c[1]-1 do begin
        for j=0, s_c[2]-1 do begin
            kcor = kcor+colour_value^i*redshift^j*c[i,j]    
        endfor
    endfor

    return, kcor
   
end

Python   download calc_kcor.py
def calc_kcor(filter_name, redshift, colour_name, colour_value):
    """
    K-corrections calculator in Python. See http://kcor.sai.msu.ru for the 
    reference. Available filter-colour combinations must be present in the 
    `coeff` dictionary keys.

    @type   filter_name: string    
    @param  filter_name: Name of the filter to calculate K-correction for, e.g. 
                         'u', 'g', 'r' for some of the SDSS filters, or 'J2', 
                         'H2', 'Ks2' for 2MASS filters (must be present in 
                         `coeff` dictionary)
    @type      redshift: float    
    @param     redshift: Redshift of a galaxy, should be between 0.0 and 0.5 (no
                         check is made, however)
    @type   colour_name: string    
    @param  colour_name: Human name of the colour, e.g. 'u - g', 'g - r', 
                         'V - Rc', 'J2 - Ks2' (must be present in `coeff` dictionary)
    @type  colour_value: float    
    @param colour_value: Value of the galaxy's colour, specified in colour_name    
    @rtype:              float
    @return:             K-correction in specified filter for given redshift and 
                         colour    
    @version:            2010
    @author:             Chilingarian, I., Melchior. A.-L., and Zolotukhin, I.
    @license:            Simplified BSD license, see http://kcor.sai.msu.ru/license.txt


    Usage example:
    
        >>> calc_kcor('g', 0.2, 'g - r', 1.1)
        0.60969373400000026
        >>> calc_kcor('Ic', 0.4, 'V - Ic', 2.0)
        0.310069919999993
        >>> calc_kcor('H', 0.5, 'H - K', 0.1)
        -0.21574611249999176
        
    """
    coeff = {

        'B_BRc': [
            [0,0,0,0],
            [-1.99412,3.45377,0.818214,-0.630543],
            [15.9592,-3.99873,6.44175,0.828667],
            [-101.876,-44.4243,-12.6224,0],
            [299.29,86.789,0,0],
            [-304.526,0,0,0],
        ],

        'H2_H2Ks2': [
            [0,0,0,0],
            [-1.88351,1.19742,10.0062,-18.0133],
            [11.1068,20.6816,-16.6483,139.907],
            [-79.1256,-406.065,-48.6619,-430.432],
            [551.385,1453.82,354.176,473.859],
            [-1728.49,-1785.33,-705.044,0],
            [2027.48,950.465,0,0],
            [-741.198,0,0,0],
        ],

        'H2_J2H2': [
            [0,0,0,0],
            [-4.99539,5.79815,4.19097,-7.36237],
            [70.4664,-202.698,244.798,-65.7179],
            [-142.831,553.379,-1247.8,574.124],
            [-414.164,1206.23,467.602,-799.626],
            [763.857,-2270.69,1845.38,0],
            [-563.812,-1227.82,0,0],
            [1392.67,0,0,0],
        ],

        'H_HK': [
            [0,0,0,0],
            [-0.87512,-2.72791,-17.6307,-17.3916],
            [31.4138,111.592,200.198,131.142],
            [-324.271,-788.024,-714.143,-392.762],
            [1352.22,2204.45,1055.26,424.915],
            [-2703.7,-2572,-641.976,0],
            [2491.12,995.135,0,0],
            [-783.755,0,0,0],
        ],

        'H_JH': [
            [0,0,0,0],
            [-1.78842,3.95359,-4.93259,-8.37687],
            [19.1586,-0.700536,99.4518,-35.4881],
            [-95.0735,-256.834,-188.045,419.65],
            [202.148,943.972,-873.02,-600.689],
            [17.4164,-341.246,1673.54,0],
            [-927.944,-1024.17,0,0],
            [1121.11,0,0,0],
        ],

        'Ic_VIc': [
            [0,0,0,0],
            [-7.92467,17.6389,-15.2414,5.12562],
            [15.7555,-1.99263,10.663,-10.8329],
            [-88.0145,-42.9575,46.7401,0],
            [266.377,-67.5785,0,0],
            [-164.217,0,0,0],
        ],

        'J2_J2Ks2': [
            [0,0,0,0],
            [-2.85079,1.7402,0.754404,-0.41967],
            [24.1679,-34.9114,11.6095,0.691538],
            [-32.3501,59.9733,-29.6886,0],
            [-30.2249,43.3261,0,0],
            [-36.8587,0,0,0],
        ],

        'J2_J2H2': [
            [0,0,0,0],
            [-0.905709,-4.17058,11.5452,-7.7345],
            [5.38206,-6.73039,-5.94359,20.5753],
            [-5.99575,32.9624,-72.08,0],
            [-19.9099,92.1681,0,0],
            [-45.7148,0,0,0],
        ],

        'J_JK': [
            [0,0,0,0],
            [-0.748177,2.44544,-0.785813,-0.611364],
            [1.10982,-13.8174,16.6888,1.06015],
            [-0.89512,12.109,-35.2342,0],
            [10.3783,34.8843,0,0],
            [-33.2195,0,0,0],
        ],

        'J_JH': [
            [0,0,0,0],
            [-1.06673,1.73114,-0.672799,-7.63872],
            [3.07102,3.07554,26.2735,18.4105],
            [-10.9191,-41.8091,-66.1621,0],
            [40.8958,88.2172,0,0],
            [-58.7677,0,0,0],
        ],

        'Ks2_J2Ks2': [
            [0,0,0,0],
            [-5.08065,-0.15919,4.15442,-0.794224],
            [62.8862,-61.9293,-2.11406,1.56637],
            [-191.117,212.626,-15.1137,0],
            [116.797,-151.833,0,0],
            [41.4071,0,0,0],
        ],

        'Ks2_H2Ks2': [
            [0,0,0,0],
            [-3.90879,5.05938,10.5434,-10.9614],
            [23.6036,-97.0952,14.0686,28.994],
            [-44.4514,266.242,-108.639,0],
            [-15.8337,-117.61,0,0],
            [28.3737,0,0,0],
        ],

        'K_JK': [
            [0,0,0,0],
            [-2.79151,4.08684,1.8311,-1.16444],
            [12.9577,-41.0232,2.88049,2.64813],
            [-64.5644,114.188,-16.5243,0],
            [132.091,-84.5005,0,0],
            [-95.1022,0,0,0],
        ],

        'K_HK': [
            [0,0,0,0],
            [-1.31705,5.57641,-4.86809,-9.34749],
            [-2.85707,-42.3794,47.2056,24.9617],
            [-7.17652,100.163,-89.0219,0],
            [56.7029,-66.4791,0,0],
            [-61.2373,0,0,0],
        ],
        
        'Rc_BRc': [
            [0,0,0,0],
            [-2.83216,4.64989,-2.86494,0.90422],
            [4.97464,5.34587,0.408024,-2.47204],
            [-57.3361,-30.3302,18.4741,0],
            [224.219,-19.3575,0,0],
            [-194.829,0,0,0],
        ],

        'U_URc': [
            [0,0,0,0],
            [2.84791,2.31564,-0.411492,-0.0362256],
            [-18.8238,13.2852,6.74212,-2.16222],
            [-307.885,-124.303,-9.92117,12.7453],
            [3040.57,428.811,-124.492,-14.3232],
            [-10677.7,-39.2842,197.445,0],
            [16022.4,-641.309,0,0],
            [-8586.18,0,0,0],
        ],

        'V_VIc': [
            [0,0,0,0],
            [-1.37734,-1.3982,4.76093,-1.59598],
            [19.0533,-17.9194,8.32856,0.622176],
            [-86.9899,-13.6809,-9.25747,0],
            [305.09,39.4246,0,0],
            [-324.357,0,0,0],
        ],

        'V_VRc': [
            [0,0,0,0],
            [-2.21628,8.32648,-7.8023,9.53426],
            [13.136,-1.18745,3.66083,-41.3694],
            [-117.152,-28.1502,116.992,0],
            [365.049,-93.68,0,0],
            [-298.582,0,0,0],
        ],

        'Y_YH': [
            [0,0,0,0],
            [-1.92818,2.26887,6.18075,-4.7355],
            [13.4865,-7.53789,-10.7556,13.6548],
            [-47.959,7.80791,-17.2056,0],
            [86.8046,20.9729,0,0],
            [-67.9877,0,0,0],
        ],

        'Y_YK': [
            [0,0,0,0],
            [-0.766345,3.06682,0.771616,-2.59031],
            [4.16016,0.0879331,12.9685,6.70949],
            [-45.3704,-62.3077,-35.9553,0],
            [177.731,120.196,0,0],
            [-210.145,0,0,0],
        ],

        'g_gr': [
            [0,0,0,0],
            [-0.804947,3.32028,1.8793,-1.49],
            [5.32498,-10.753,8.16366,1.89345],
            [-20.3373,-7.42978,-19.021,0],
            [62.8153,47.4034,0,0],
            [-79.5544,0,0,0],
        ],

        'g_gi': [
            [0,0,0,0],
            [-0.545947,0.299034,3.98684,-1.80155],
            [6.38878,-20.5413,10.0568,2.99832],
            [22.9318,-10.4281,-30.279,0],
            [-21.4324,98.0747,0,0],
            [-86.8239,0,0,0],
        ],

        'g_gz': [
            [0,0,0,0],
            [0.375663,-1.5098,3.98319,-1.43652],
            [3.50825,-16.9043,7.97596,2.55763],
            [45.0561,-15.9583,-28.1667,0],
            [-64.5893,109.974,0,0],
            [-79.4649,0,0,0],
        ],

        'i_gi': [
            [0,0,0,0],
            [-2.40717,4.72555,-3.72005,1.47911],
            [10.8559,5.13437,-1.99939,-3.5971],
            [-93.6061,-17.5939,26.5366,0],
            [290.009,-46.9939,0,0],
            [-230.77,0,0,0],
        ],

        'i_ui': [
            [0,0,0,0],
            [-2.59334,1.58474,-0.212443,0.00262402],
            [18.3125,-4.88146,0.767957,0.0123197],
            [-72.5586,1.37633,-1.33158,0],
            [185.168,11.5798,0,0],
            [-196.516,0,0,0],
        ],

        'r_gr': [
            [0,0,0,0],
            [-1.61166,3.87173,-3.87312,2.66605],
            [8.48781,13.2126,-6.4946,-7.31552],
            [-87.2971,-35.0474,41.5335,0],
            [271.64,-26.9081,0,0],
            [-232.289,0,0,0],
        ],

        'r_ur': [
            [0,0,0,0],
            [-1.98173,1.04346,0.0221613,-0.0391318],
            [9.34198,1.639,-0.392805,0.192349],
            [-39.8237,-10.3007,-1.9142,0],
            [123.94,25.7117,0,0],
            [-150.964,0,0,0],
        ],

        'u_ur': [
            [0,0,0,0],
            [1.54907,2.33077,0.0863027,-0.129934],
            [-67.2858,19.6834,-3.48982,0.769095],
            [227.169,-41.4199,-4.31236,0],
            [-233.872,62.8703,0,0],
            [-18.0493,0,0,0],
        ],

        'u_ui': [
            [0,0,0,0],
            [1.51973,1.62087,0.314757,-0.118175],
            [-65.2593,17.0211,-3.42331,0.641827],
            [200.74,-20.6839,-5.00841,0],
            [-236.018,52.3746,0,0],
            [-9.91078,0,0,0],
        ],

        'u_uz': [
            [0,0,0,0],
            [3.23407,0.119541,0.549622,-0.101494],
            [-73.6664,23.7596,-4.88373,0.575285],
            [180.924,-14.7506,-3.00815,0],
            [-217.452,33.4529,0,0],
            [23.5401,0,0,0],
        ],

        'z_rz': [
            [0,0,0,0],
            [-1.68992,3.2247,0.494208,0.425893],
            [15.0417,-21.8675,-4.54296,1.37908],
            [-44.522,76.0708,-6.46192,0],
            [18.0191,-56.9078,0,0],
            [24.2478,0,0,0],
        ],

        'z_gz': [
            [0,0,0,0],
            [-3.49804,6.15684,-4.02179,1.26893],
            [12.7541,-1.49658,-2.47768,-2.55071],
            [-60.2735,20.8725,21.5907,0],
            [77.1165,-85.6706,0,0],
            [38.401,0,0,0],
        ],

        'z_uz': [
            [0,0,0,0],
            [-3.51099,2.17402,-0.332435,0.0209126],
            [24.2976,-9.79764,1.05165,-0.0449372],
            [-52.4363,13.9363,-0.864778,0],
            [52.5216,-3.16925,0,0],
            [-38.931,0,0,0],
        ],

    }

    c = coeff[filter_name + '_' + colour_name.replace(' - ', '')]
    kcor = 0.0

    for x, a in enumerate(c):
	    for y, b in enumerate(c[x]):
		    kcor += c[x][y] * redshift**x * colour_value**y
				
    return kcor